OpenUSD icon indicating copy to clipboard operation
OpenUSD copied to clipboard

Unlit Surface does not work in Storm

Open dgovil opened this issue 2 years ago • 2 comments

Description of Issue

Storm fails to shadergen the MaterialX unlit shader with the following error

Warning: in _ValidateCompilation at line 229 of /Users/dhruvgovil/Projects/usd/pxr/imaging/hdSt/glslProgram.cpp -- Failed to compile shader (FRAGMENT_SHADER): program_source:1619:5: error: use of undeclared identifier 'u_viewPosition'
    u_viewPosition = vec3(HdGet_worldToViewInverseMatrix() * vec4(0.0, 0.0, 0.0, 1.0));
    ^

This appears to be caused by the shadergen assuming that the uniform which is added in MaterialXGenGlsl/Nodes/SurfaceNodeGlsl.cpp, line 64 is available. However, the unlit surface is using MaterialXGenGlsl/Nodes/UnlitSurfaceNodeGlsl.cpp which doesn't add this uniform.

So it seems like unlit or other shaders that do not output that constant will not work as a result.

Steps to Reproduce

  1. Open the attached file in usdview skydome.zip
  2. Look in the command line to see the error above

System Information (OS, Hardware)

macOS 14.4 M2 Macbook

Package Versions

USD 23.11 , 24.3

dgovil avatar Mar 25 '24 21:03 dgovil

Filed as internal issue #USD-9483

jesschimein avatar Mar 26 '24 21:03 jesschimein

This will be resolved by https://github.com/PixarAnimationStudios/OpenUSD/pull/3045

dgovil avatar Apr 17 '24 21:04 dgovil