Skip to content

Commit

Permalink
Fix arnold light groups in hydra Autodesk#2061
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienblor committed Aug 8, 2024
1 parent f8593ff commit 7f02973
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
4 changes: 4 additions & 0 deletions libs/render_delegate/basis_curves.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions libs/render_delegate/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [&]() {
Expand Down
13 changes: 7 additions & 6 deletions libs/render_delegate/native_rprim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions libs/render_delegate/points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 1 addition & 4 deletions libs/render_delegate/shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion testsuite/test_0065/README
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Light-linking

author: sebastien ortega

PARAMS: {'resaved':'usda', 'hydra': False}
PARAMS: {'resaved':'usda'}

0 comments on commit 7f02973

Please sign in to comment.