Why does adding nodes for roughness remove color attributes?

   1769   6   0
User Avatar
Member
340 posts
Joined: June 2017
Offline
In Rohan Dalvi's procedural texturing tutorial, unlike most other tutorials I've seen, he uses an Attribute VOP to affect UV's, displacement, and color. He just places a principled shader on his objects and lets the attribute VOP control the rendered look. However, if one connects anything to the roughness channel of the principled shader, it removes all color given by the attribute VOP. Even connecting a simple constant to the displacement channel of the principled shader does the same. Why is this? Attached is a simple Houdini file showing the scene and rendered view. If one disconnects the nodes connected to the roughness channel, it will render displacement and color correctly.
Edited by Island - Feb. 17, 2022 12:21:01

Attachments:
NoRoughness.jpg (145.2 KB)
RoughnessAdd.jpg (486.0 KB)
Planet.hiplc (581.2 KB)
NoRoughRender.jpg (319.9 KB)

User Avatar
Member
7755 posts
Joined: Sept. 2011
Online
Island
Why is this? Attached is a simple Houdini file showing the scene and rendered view. If one disconnects the nodes connected to the roughness channel, it will render displacement and color correctly.

Binds don't tunnel through nested shader calls. The principled shader uses a bind to pick up point color. Whenever a node is connected to any input on the principled shader, it creates a new shader that calls the principled shader like a function call. Any binds and parameters on the principled shader need to be passed as arguments to the shader call. Binds don't automatically do that unless also connected to input nodes. Since the bind for color isn't exposed as an input, it's not possible to connect. However, the basecolor input is exposed. To recreate the basecolor's texture and point color composition, use a surface color node connected to the base color input on the principled shader.
User Avatar
Member
340 posts
Joined: June 2017
Offline
Thanks for the thoughts. Leaving out any binds, just connecting a constant to the roughness channel causes the color to break. It would be easy to set the whole thing up in the material network, but the tutorial uses Attribute VOPs instead. It looks like one can do either color/displacement/etc. through Attribute VOPS or through the material network but not both. Using a principled shader itself is not a problem, but perhaps it is the VEX code that gets generated with any connected inputs. I'm not sure why point color would be deleted because generally a principled shader will allow point color unless this is turned off.
User Avatar
Member
7755 posts
Joined: Sept. 2011
Online
Island
Leaving out any binds, just connecting a constant to the roughness channel causes the color to break.

The binds are in the principled shader, not outside of it.

Island
It would be easy to set the whole thing up in the material network, but the tutorial uses Attribute VOPs instead. It looks like one can do either color/displacement/etc. through Attribute VOPS or through the material network but not both

I'm not sure how any aspect of the material would be done with an attribute vop. Do you mean using vops to set point color?

Island
Using a principled shader itself is not a problem, but perhaps it is the VEX code that gets generated with any connected inputs.

Yes, look at the code. you can see 'principledshader' called like a function, with parameters and connections passed as args. You'll notice it's missing one for 'Cd'. So the principled shader is unaware that point color exists at all. The point color needs to be bound in the outer most shader, and then passed to the called shader as I explained in my first post.
User Avatar
Member
8538 posts
Joined: July 2007
Offline
Island
Leaving out any binds, j
You are not leaving out any binds, they are already inside of the shader you are connecting to

By connecting you are forcing another matrrial wrapper to be auto generated but that will not tunnel through the binds as mentioned

So you may be better off wrapping it in material builder yourself anyway and bind what you need
You will notice that there is many more issues with floating material networks like broken animation or textures using $F etc
Those work only on material builder nodes until you connect something to it

It's not ideal how things work and definitely not transparent to users especially since it's so easy to break things
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
340 posts
Joined: June 2017
Offline
I wonder why the tutorial was centered around use of the Attribute VOP. It is certainly easier to do it using a material network, remembering to use rest position and UV coordinates nodes. Before this tutorial, I've used the Attribute VOP for modeling, not shading.
User Avatar
Member
8538 posts
Joined: July 2007
Offline
It may be a personal preference

Doing stuff like this in sops can be used for prototyping as you see direct feedback in viewport and can also inspect data in various ways quickly

If the computed values are sufficient for shading then it's convenient to just bind them in the shader
Or sometimes it's lots of utility data that you want to use in the shader not necessarily the final pattern

So you can have one shader and infinite number of Geos with variations

If you need per pixel or per shading sample detail they of course such operations should be done in shader
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links