-
Notifications
You must be signed in to change notification settings - Fork 358
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
Reading texture path from primvar #878
Comments
Hi Francois, The current logic to add in "default" Based on the spec the
The current MaterialX USD definitions have this type of basic implementation (string here):
I think you want to create a
This is "a" way to associate the node with a One thing I noted @jstone-lucasfilm, @dbsmythe is that UDIMs are parsed using the
I would have expected this instead:
|
@flord , I was actually shocked that a UsdPrimvarReader_string feeding a UsdUvTexture's Rather, we want to fulfill MaterialX's filename substitutions semantics in USD/Hydra, in a way that works for CPU and GPU renderers efficiently, and on which we can track changes properly for incremental updates. We have some ideas on how we might go about that, but it's a good sized project that is not currently on our 6 month roadmap. That's not terribly helpful to your immediate goals, I know, but at least it maybe can help us align on a direction to pursue? @bernardkwok , I am not sure whether UsdMtlx handles <geominfo> elements, as we consider primvars to be part of the geometry, and it sounds like @flord is constructing his assets as USD, so specifying the actual primvars in the native USD way may be sufficient? Getting Hydra to pay attention to them is the issue, here. |
For the future version of MaterialX, we were considering to allow connecting a uniform string inputs (eg, of an image texture node, equivalent to USD UV Texture) to a uniform string outputs (eg, of a geompropvalue node, equivalent to USD Primvar Reader). This was influenced (inspired) by the USD preview shader prims (in v2.0 of the proposal). Note, the uniform requirement of the Primvar Reader shader implies that only uniform primvars are supported. This is very much equivalent to substitution, but fits entirely in the USD framework of primvars on geometry and primvar readers in the shader network. |
@spiffmon Arnold does support it in the UsdPrimvarReader shader but only since I asked them to fix it. ;) |
Hi there; I was pointed to this thread by a staffmember of sidefx, to whom I was asking for help trying to do the exact thing described in this thread (namely: using a uniform string primvar to drive a texture path parameter on a materialX shader). I too am working in Houdini Solaris, currently 19.5. The use case I am trying to address includes things like procedurally scattering rocks and trees within a set environment, as well as some procedural construction of geometry using Houdini. It's not practical to create separate shaders for each bit of geometry that might need a different set of textures, so being able to assign one shader and have the geometry drive the required texture paths is much simpler from a scene management perspective. I imagine destruction workflows might have a similar requirement (requiring a separate shader setup for each fragment of a shattered building would be quite complicated to manage). I'd love to transition my stuff to materialX, to take advantage of Karma XPU, and am trying to understand the current state of the art. I'm curious where this issue stands now, and how other folks might be addressing this kind of work with materialX currently? Thanks! |
Hi @ahemberger , renderer-independent support for primvar substitution still does not exist in Hydra, which means you can only use renderer-specific affordances (RenderMan also has its own syntax for primvar substitutions in texture filenames... which will only work for .tex textures). |
Hey @spiffmon, thanks for this sir! Let me try to say that back to you, to make sure I understand: the feature I'm asking about (being able to store a constant string primvar on an object, e.g. "basecolor", and then be able to pass the value of that primvar to a MaterialX shader parameter) is contingent on Hydra (side question: is that a thing that's currently on a roadmap somewhere?). In lieu of this, you're saying that specific renderers may opt to have a specific syntax they look for when parsing MaterialX paramaters. So, for example, "allenh's hypothetical renderer" may allow me to set a MaterialX Shader Path to "<[texture]>", in which case I could store a primvar "<[texture]>" on my geometry and this could possibly work? I'm trying to understand what question to take back to ask SideFX, as I'm ultimately interested today in rendering in Karma. I understand that you're saying that a different solution may exist if I want to use Renderman. And, rereading your response: to be clear, I am trying to do this: Then read the string primvar "basecolor" in my MaterialX shader network. This string value is one I need to only set per-prim in USD...not as point or vertex data. Thanks! |
Hi @ahemberger! @rafalSFX raised this again this morning in the usd-materialx monthly working group, and I think we are all aligned on where we want to go, which is pretty much as you describe. We want to support the MaterialX-style primvar substitution, always, which would be Alas we don't have a date yet for when we'd start the Hydra work, but renderers that do perform their own substitutions at texture-lookup time should, I believe, be able to implement this already. |
... sorry, there is still potentially a missing piece even for "primvar-substituting renderers", which is that if Hydra is configured to be parsimonious about which primvars it consumes and presents to the renderer, there's not yet a way for the dependency implied by the above assetPath to be recognized. |
@spiffmon What about the |
Great issue to raise, @flord ! Unless people think it is vitally necessary (and there is no discussion of it in the MaterialX spec), it would be ideal for simplicity and efficiency if the substitutions do not need to be iterative. I.e.:
... so exactly as you propose in your comment: Is that reasonable? @jstone-lucasfilm , is this consistent with ILM's support for MaterialX? |
Apologies, I forgot to connect PR #2092 here @flord / @ahemberger. The next release of MaterialX 1.39 will have This token-substitution discussion may still be good to keep open, but the new shader should streamline primvar-driven-texture-path workflows in USD/MaterialX. |
Thanks for contributing this improvement, @crydalch, and it's now scheduled for inclusion in MaterialX v1.39.2! |
I am currently working on packaging USD assets for public release and I though it would be a good idea to use the MaterialX shaders instead of the Usd Preview Surface. I'm using Houdini 19 Solaris to assemble the asset and I'm testing with Karma and Arnold.
I came accross an issue that prevents me from using MaterialX entirely. In our USD pipeline, we create a USD layer for the texture department. This layer adds primvars to the assets, and these primvars contain the path to the textures. Later, when the shading department creates a material, they simply read these primvars and use them to drive the texture path parameter of the textures nodes. This workflow works well with Karma and Arnold when using their respective shaders as well as when using the USD shaders. I realized that we can not drive the filename parameter of the
MtlX Image
andMtlX Tiled Image
nodes with aMtlX USD Primvar Reader
node. I saw in the documentation that MaterialX supports filename substitution in those nodes, and that it supports a <geometry token> to useI tried different things but could not use this token to read a primvar on the geometry I'm using.
Here is why we want to use this workflow. By having the texture paths in a seperate layer than the shading, it allows us to completely decouple the two pipeline steps. When there are new versions of texture, no one need to update the shading since it reads directly from the texture layer. It also allows us to create texture variants independently from shading variants. Setting the texture variantSet only changes the paths read by the shaders. We can also share the same material on multiple meshes but each one has a different texture.
Just to be clear, I'm not necessarily after a solution to drive the path of a texture node from a shader, but mostly after a solution to use primvars to drive texture paths.
Thanks!
Francois Lord
RodeoFX
The text was updated successfully, but these errors were encountered: