PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
5.51k stars 1.14k forks source link

Unlit Surface does not work in Storm #3015

Open dgovil opened 2 months ago

dgovil commented 2 months ago

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

jesschimein commented 2 months ago

Filed as internal issue #USD-9483

dgovil commented 1 month ago

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