"Wrapping" a principled shader into a Digital Asset

   849   3   0
User Avatar
Member
19 posts
Joined: Oct. 2014
Offline
Hi,

Super beginner question here: How do I “wrap” a Principled shader into a simpler digital asset that only exposes a few of the parameters?

I'm collapsing it into a subnetwork, then “promoting” the parameters I want, but it seems to break the material.

<edit>I think the problem is that when I turn it into a subnetwork, I can't drag the subnetwork directly onto an object, or select it as a “valid” material anymore. Is there a way to flag a subnetwork's output as a a valid material?

This is the digital asset's interface (param names are a little different than default Principled shader names):

This is what the asset looks like inside:

Explanation: I'm using a custom 3D engine with a PBR shader that uses a few of the same parameters as the Principled shader (with different names). I wanted to take advantage that Houdini already does a good job of displaying the parameters I need (roughness, metalness, etc) in the viewer, so I'm going to use that shader and export my materials' needed parameters to a .json file using a python script from Houdini.

However, when I collapse a Principled shader into a subnetwork so that I can convert it into a reusable digital asset, it instantly stops working! How do I get around that?

Please notice that properly understanding shader networks is well beyond my scope right now, I just wanted to reuse an existing shader and simplify its interface without building my own shader from scratch.

Any help appreciated.
Thanks!
Edited by Ethernaut - Jan. 5, 2018 18:52:55

Attachments:
Screen Shot 2018-01-05 at 1.54.09 PM.png (83.3 KB)
Screen Shot 2018-01-05 at 2.13.09 PM.png (34.8 KB)

User Avatar
Member
172 posts
Joined: March 2015
Offline
Hi, you need to enable the material flag. It's usually on by default for most materials but for some it isn't. Creating the sub net has probably disabled it. I've attached a screenshot circling the Material Flag.

Rob

Attachments:
Material_Flag.jpg (103.6 KB)

User Avatar
Member
2097 posts
Joined: Sept. 2011
Offline
Subnet nodes are not materials in 16+ (mat context). Use material builder nodes instead. There is an option to ‘collapse into material’ under the same menu where collapse into subnet is. This will create a node with a special collect node that allows individual shaders to be bundled together.

Something to keep in mind with wrapping a material in another material in this way, is that geometry attributes can no longer be automatically bound to shader parameters that only exist on the inner material. To ‘tunnel’ them through, promote the parameter from the inner material to the outer one with a parameter node. The ‘uv’ attribute will have this done automatically by the ‘collapse’ script.

Render properties also have to be manually managed when embedding a material that bundled render properties, as the principled shader does. For now, the only render property that is automatically propagated is the ‘vm_displacebound’ property.
User Avatar
Member
18 posts
Joined: April 2006
Offline
jsmack
For now, the only render property that is automatically propagated is the ‘vm_displacebound’ property.

I have noticed that this has an expression (the exact same expression) in the vm_displacebound field, but it references parms that are on the original shader. So essentially, it appears that the properties node does nothing. There must be a reason for SideFX to create this node, but it escapes me. Can I just delete it, or do I need to reference the original vm_displacebound?

Thanks
Josh
  • Quick Links