Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for geompropvalueuniform node #2092

Conversation

crydalch
Copy link
Contributor

Adds a string-/filename-friendly primvar/geompropvalue node, as was proposed for 1.39.

@crydalch
Copy link
Contributor Author

This is till a WIP PR of course, but a quick summary of the changes in-progress:

  • Adds geompropvalueuniform
  • Removed string signature from geompropvalue
  • Adds uniform string/filename signatures to UsdPrimvarReader

Thanks in advance for feedback, and especially any help with the codegen and/or various shading targets.

@crydalch
Copy link
Contributor Author

Fixed a few more mistakes/issues (thanks @ld-kerley for looking it over!), down to 8 failures (on my end at least).

@crydalch
Copy link
Contributor Author

crydalch commented Oct 31, 2024

geompropvalueuniform_blank

Okay CI issues are resolved, so build is "clean", but no luck getting it to work so far, in MaterialXViewer.

Maybe some MacOS-specific quirk or something else causing it to fail? I'm not seeing any messages/shell output, and just passing a texture map to the image node displays correctly. :(

<materialx version="1.39">
  <surfacematerial name="mtlxsurfacematerial1" type="material">
    <input name="surfaceshader" type="surfaceshader" nodename="mtlxstandard_surface" />
  </surfacematerial>
  <standard_surface name="mtlxstandard_surface" type="surfaceshader">
    <input name="base_color" type="color3" nodename="mtlximage1" />
  </standard_surface>
  <image name="mtlximage1" type="color3">
    <input name="default" type="color3" value="0, 1, 0" />
    <input name="file" type="filename" nodename="mtlxgeompropvalue1" />
  </image>
  <geompropvalueuniform name="mtlxgeompropvalue1" type="filename">
    <input name="geomprop" type="string" value="my_string_primvar" />
    <input name="default" type="filename" value="grid.jpg" />
  </geompropvalueuniform>
</materialx>

grid

@crydalch
Copy link
Contributor Author

crydalch commented Nov 5, 2024

Was given tip to use MaterialXGraphEditor (which uses GLSL even on MacOS), and it's showing this error:

ERROR: 0:2590: Samplers not allowed except in non-buffer uniforms and in-parameters
ERROR: 0:2594: Use of undeclared identifier 'geompropvalueuniform_filename_out'

I suspect the second item is because the property isn't authored on the generic shaderball geometry (it's not clear if/how that's even possible); so that might just be a red herring.

Signed-off-by: Jonathan Stone <jstone@lucasfilm.com>
@krohmerNV
Copy link
Contributor

Since @jstone-lucasfilm asked for more discussions ;)
I'm wondering if filenames in primvars is the only use case here. I'm no fan of such a feature. I know, it's very common in some offline rendering workflows, but it does not apply to real-time rendering and it hides important material properties elsewhere in the scene. If you see other useful application, I would be interested.

@crydalch
Copy link
Contributor Author

crydalch commented Dec 9, 2024

Thanks @krohmerNV! Yes filenames are the main use case, it's been a long-standing request for path tracing workflows; the primvars setting the texture map paths are authored in the scene, but I get that real-time renderers don't like or use it (or don't use it much, at least). There could be other cases for uniform strings, but those would just be hypotheticals at this point.

FWIW, the current geompropvalue has strings, which also don't work (hence this PR would also remove those signatures from geompropvalue). We included strings and filenames just so they have a home together in geompropvalueuniform; string properties couldn't work anyway, because all string/filename inputs are uniform anyway.

@krohmerNV
Copy link
Contributor

As I said, I know that these workflows exist. If they are good and you want to use them you need to decide on your own. ;)

But aside from that, having uniform geometry properties seems to be valuable. It might help constant folding even for real-time renderers.

Signed-off-by: Jonathan Stone <jstone@lucasfilm.com>
@jstone-lucasfilm
Copy link
Member

This looks very reasonable to me, thanks @crydalch, and I'm CC'ing @ld-kerley and @kwokcb for their thoughts.

@jstone-lucasfilm jstone-lucasfilm changed the title Add geompropvalueuniform Add support for geompropvalueuniform node Dec 13, 2024
Copy link
Member

@jstone-lucasfilm jstone-lucasfilm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks good to me, thanks @crydalch!

@jstone-lucasfilm jstone-lucasfilm merged commit 81ed31d into AcademySoftwareFoundation:main Dec 14, 2024
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants