Shader instances?

if you put a bsdf inside a group that has no inputs, just the bsdf output, and then make multiple groups, would the shader be calculated once, or would it be calculated for each group?

I can appreciate it would need to be recalculated if the BSDF’s parameters were different, but they’re forced to be the same by the nature of groups if no parameters are wired to the groups interface. In this case I’m hoping they’re treated as shader instances?

It’s not clear to me what kind of setup you are referring to exactly. Multiple instances of a group in one material, and all of them have the same input parameters? And what it would mean for something to be treated as a “shader instance”? With the typical definition of that term, the point is to give different parameters to each instance.

Cycles tries to automatically deduplicate shader nodes, so I guess it will do what you want.

1 Like

Oh excellent, that’s great news.

Yes I have a shader which has around 40 identical tranparent bsdf’s (all parameters identical). So I just wanted to check that if I put a single transparent bsdf inside a group with no wired inputs, and then duplicated the group 40 times instead of having 40 unique transparent bsdf’s, that cycles would calculate the transparent bsdf once instead of 40 times.

I also have a lot of light path nodes. Do they automatically calculate once per material, or should I group those too?

Cycles expands all node groups, and then performs optimizations like node deduplication. It does not matter if a node is in a group or not.


It’s so I don’t have to have an abundance of wires. Instead just duplicate the bsdf and place it elserwhere in the graph whilst only using a single calculation for them all (so as not to duplicate identical work that’s already been done.)

Awesome. thanks, that’s great.

Sorry, do you know if EEVEE also has node deduplication? Wanting to make sure a complex shader is as performant in both engines as possible.

Eevee does not have it.

1 Like