Skip to content

Commit

Permalink
Merge pull request #3264 from erikaharrison-adsk/adsk/bugfix/mtlx_met…
Browse files Browse the repository at this point in the history
…al_shadow

Autodesk: Bugfix for MaterialX shadows in Metal

(Internal change: 2341291)
  • Loading branch information
pixar-oss committed Sep 19, 2024
2 parents cdbb2a6 + 80eed9c commit 70b526f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pxr/imaging/hdSt/materialXShaderGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,10 @@ HdStMaterialXShaderGen<Base>::emitLine(
// When emitting the Light loop code for the Surface node, the variable
// 'occlusion' represents shadow occlusion. We don't use MaterialX's
// shadow implementation (hwShadowMap is false). Instead, use our own
// per-light occlusion value calculated in mxInit() and stored in lightData
if (_emittingSurfaceNode && str == "vec3 L = lightShader.direction") {
// per-light occlusion value calculated in mxInit() and stored in lightData.
// Note: Metal uses float3, Glsl uses vec3, in the line we're looking for.
if (_emittingSurfaceNode && (str == "vec3 L = lightShader.direction" ||
str == "float3 L = lightShader.direction" )) {
emitLine(
"occlusion = u_lightData[activeLightIndex].shadowOcclusion", stage);
}
Expand Down

0 comments on commit 70b526f

Please sign in to comment.