From 7f02973d45553ff8091c0de3686bf10dfa7fc6f7 Mon Sep 17 00:00:00 2001 From: Sebastien Blaineau-Ortega Date: Thu, 8 Aug 2024 15:18:44 +0200 Subject: [PATCH] Fix arnold light groups in hydra #2061 --- libs/render_delegate/basis_curves.cpp | 4 ++++ libs/render_delegate/mesh.cpp | 4 ++++ libs/render_delegate/native_rprim.cpp | 13 +++++++------ libs/render_delegate/points.cpp | 4 ++++ libs/render_delegate/shape.cpp | 5 +---- testsuite/test_0065/README | 2 +- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/libs/render_delegate/basis_curves.cpp b/libs/render_delegate/basis_curves.cpp index 6fd33ced3a..99531997a7 100644 --- a/libs/render_delegate/basis_curves.cpp +++ b/libs/render_delegate/basis_curves.cpp @@ -193,6 +193,10 @@ void HdArnoldBasisCurves::Sync( AiNodeSetPtr(GetArnoldNode(), str::shader, GetRenderDelegate()->GetFallbackSurfaceShader()); } } + if (*dirtyBits & HdChangeTracker::DirtyCategories) { + param.Interrupt(); + GetRenderDelegate()->ApplyLightLinking(sceneDelegate, GetArnoldNode(), id); + } if (dirtyPrimvars) { _visibilityFlags.ClearPrimvarFlags(); diff --git a/libs/render_delegate/mesh.cpp b/libs/render_delegate/mesh.cpp index e94cc3f706..82ab09eeff 100644 --- a/libs/render_delegate/mesh.cpp +++ b/libs/render_delegate/mesh.cpp @@ -359,6 +359,10 @@ void HdArnoldMesh::Sync( node, subdivTags.GetCornerIndices(), subdivTags.GetCornerWeights(), subdivTags.GetCreaseIndices(), subdivTags.GetCreaseLengths(), subdivTags.GetCreaseWeights()); } + if (*dirtyBits & HdChangeTracker::DirtyCategories) { + param.Interrupt(); + _renderDelegate->ApplyLightLinking(sceneDelegate, node, id); + } auto materialsAssigned = false; auto assignMaterials = [&]() { diff --git a/libs/render_delegate/native_rprim.cpp b/libs/render_delegate/native_rprim.cpp index ce8bac135f..7766180d12 100644 --- a/libs/render_delegate/native_rprim.cpp +++ b/libs/render_delegate/native_rprim.cpp @@ -39,6 +39,12 @@ void HdArnoldNativeRprim::Sync( HdArnoldRenderParamInterrupt param(renderParam); const auto& id = GetId(); + if (*dirtyBits & HdChangeTracker::DirtyCategories) { + param.Interrupt(); + _renderDelegate->ApplyLightLinking(sceneDelegate, GetArnoldNode(), GetId()); + } + + int defaultVisibility = AI_RAY_ALL; // Sync any built-in parameters. if (*dirtyBits & ArnoldUsdRprimBitsParams && Ai_likely(_paramList != nullptr)) { @@ -107,12 +113,7 @@ void HdArnoldNativeRprim::Sync( const auto visibility = _visibilityFlags.Compose(); AiNodeSetByte(node, str::visibility, visibility); } - - if (*dirtyBits & HdChangeTracker::DirtyCategories) { - param.Interrupt(); - _renderDelegate->ApplyLightLinking(sceneDelegate, node, GetId()); - } - + // NOTE: HdArnoldSetTransform must be set after the primvars as, at the moment, we might rewrite the transform in the // primvars and it doesn't take into account the inheritance. bool transformDirtied = false; diff --git a/libs/render_delegate/points.cpp b/libs/render_delegate/points.cpp index 27f0cfb25e..20cd712230 100644 --- a/libs/render_delegate/points.cpp +++ b/libs/render_delegate/points.cpp @@ -48,6 +48,10 @@ void HdArnoldPoints::Sync( HdArnoldSetTransform(GetArnoldNode(), sceneDelegate, GetId()); transformDirtied = true; } + if (*dirtyBits & HdChangeTracker::DirtyCategories) { + param.Interrupt(); + GetRenderDelegate()->ApplyLightLinking(sceneDelegate, GetArnoldNode(), GetId()); + } CheckVisibilityAndSidedness(sceneDelegate, id, dirtyBits, param); diff --git a/libs/render_delegate/shape.cpp b/libs/render_delegate/shape.cpp index 1d40f2ace2..3883d5e7c8 100644 --- a/libs/render_delegate/shape.cpp +++ b/libs/render_delegate/shape.cpp @@ -50,10 +50,7 @@ void HdArnoldShape::Sync( param.Interrupt(); _SetPrimId(rprim->GetPrimId()); } - if (dirtyBits & HdChangeTracker::DirtyCategories) { - param.Interrupt(); - _renderDelegate->ApplyLightLinking(sceneDelegate, _shape, id); - } + // If render tags are empty, we are displaying everything. if (dirtyBits & HdChangeTracker::DirtyRenderTag) { param.Interrupt(); diff --git a/testsuite/test_0065/README b/testsuite/test_0065/README index 0ec1956b0b..eec9853cba 100644 --- a/testsuite/test_0065/README +++ b/testsuite/test_0065/README @@ -2,4 +2,4 @@ Light-linking author: sebastien ortega -PARAMS: {'resaved':'usda', 'hydra': False} \ No newline at end of file +PARAMS: {'resaved':'usda'} \ No newline at end of file