13#ifdef WITH_HYDRA_DISPLAY_DRIVER
23#include <pxr/imaging/hd/renderPassState.h>
28 HdRprimCollection
const &collection,
30 : HdRenderPass(index, collection), _renderParam(renderParam)
32 Session *
const session = _renderParam->session;
39 GetRenderIndex()->GetRenderDelegate());
40 if (renderDelegate->IsDisplaySupported()) {
41#ifdef WITH_HYDRA_DISPLAY_DRIVER
42 session->set_display_driver(
43 make_unique<HdCyclesDisplayDriver>(renderParam, renderDelegate->GetHgi()));
50 Session *
const session = _renderParam->session;
56 for (
const HdRenderPassAovBinding &aovBinding : _renderParam->GetAovBindings()) {
57 if (aovBinding.renderBuffer && !aovBinding.renderBuffer->IsConverged()) {
65void HdCyclesRenderPass::ResetConverged()
67 for (
const HdRenderPassAovBinding &aovBinding : _renderParam->
GetAovBindings()) {
69 renderBuffer->SetConverged(
false);
74void HdCyclesRenderPass::_Execute(
const HdRenderPassStateSharedPtr &renderPassState,
75 const TfTokenVector &renderTags)
77 Scene *
const scene = _renderParam->session->scene;
78 Session *
const session = _renderParam->session;
84 if (scene->
mutex.try_lock()) {
85 const auto renderDelegate =
static_cast<HdCyclesDelegate *
>(
86 GetRenderIndex()->GetRenderDelegate());
88 const unsigned int settingsVersion = renderDelegate->GetRenderSettingsVersion();
91 const HdRenderPassAovBindingVector &aovBindings = renderPassState->GetAovBindings();
92 if (_renderParam->GetAovBindings() != aovBindings ||
94 (settingsVersion != _lastSettingsVersion && scene->
integrator->use_denoise_is_modified()))
96 _renderParam->SyncAovBindings(aovBindings);
98 if (renderDelegate->IsDisplaySupported()) {
100 HdRenderPassAovBinding displayAovBinding = !aovBindings.empty() ? aovBindings.front() :
101 HdRenderPassAovBinding();
102 if (displayAovBinding.aovName == HdAovTokens->color && displayAovBinding.renderBuffer) {
103 _renderParam->SetDisplayAovBinding(displayAovBinding);
106 _renderParam->SetDisplayAovBinding(HdRenderPassAovBinding());
112#if PXR_VERSION >= 2102
113 CameraUtilFraming framing = renderPassState->GetFraming();
114 if (!framing.IsValid()) {
115 const GfVec4f vp = renderPassState->GetViewport();
116 framing = CameraUtilFraming(GfRect2i(GfVec2i(0),
int(vp[2]),
int(vp[3])));
119 scene->
camera->set_full_width(framing.dataWindow.GetWidth());
120 scene->
camera->set_full_height(framing.dataWindow.GetHeight());
122 const GfVec4f vp = renderPassState->GetViewport();
123 scene->
camera->set_full_width(
int(vp[2]));
124 scene->
camera->set_full_height(
int(vp[3]));
127 if (
const auto camera =
static_cast<const HdCyclesCamera *
>(renderPassState->GetCamera())) {
128 camera->ApplyCameraSettings(_renderParam, scene->
camera);
132 renderPassState->GetWorldToViewMatrix(),
133 renderPassState->GetProjectionMatrix(),
134 renderPassState->GetClipPlanes(),
139 if (scene->
need_reset() || settingsVersion != _lastSettingsVersion) {
140 _lastSettingsVersion = settingsVersion;
145 BufferParams buffer_params;
146#if PXR_VERSION >= 2102
147 buffer_params.
full_x =
static_cast<int>(framing.displayWindow.GetMin()[0]);
148 buffer_params.
full_y =
static_cast<int>(framing.displayWindow.GetMin()[1]);
149 buffer_params.
full_width =
static_cast<int>(framing.displayWindow.GetSize()[0]);
150 buffer_params.
full_height =
static_cast<int>(framing.displayWindow.GetSize()[1]);
152 buffer_params.
window_x = framing.dataWindow.GetMinX() - buffer_params.
full_x;
153 buffer_params.
window_y = framing.dataWindow.GetMinY() - buffer_params.
full_y;
154 buffer_params.
window_width = framing.dataWindow.GetWidth();
155 buffer_params.
window_height = framing.dataWindow.GetHeight();
160 buffer_params.
width =
static_cast<int>(vp[2]);
161 buffer_params.
height =
static_cast<int>(vp[3]);
171 scene->
mutex.unlock();
180void HdCyclesRenderPass::_MarkCollectionDirty() {}
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between camera
void ApplyCameraSettings(PXR_NS::HdRenderParam *renderParam, CCL_NS::Camera *targetCamera) const
~HdCyclesRenderPass() override
HdCyclesRenderPass(PXR_NS::HdRenderIndex *index, const PXR_NS::HdRprimCollection &collection, HdCyclesSession *renderParam)
bool IsConverged() const override
const PXR_NS::HdRenderPassAovBindingVector & GetAovBindings() const
void cancel(bool quick=false)
void reset(const SessionParams &session_params, const BufferParams &buffer_params)
void set_output_driver(unique_ptr< OutputDriver > driver)
#define HDCYCLES_NAMESPACE_CLOSE_SCOPE
bool need_reset(const bool check_camera=true)