Community
Arnold General Rendering Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Do multiple AiMixShader's get merged?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
zenop
452 Views, 4 Replies

Do multiple AiMixShader's get merged?

When mixing multiple aistandardsurface shaders through the aimixshader nodes, do they get merged to a single shader at shading time? Can anyone shed some light on the optimisations arnold uses behind the hood?

Labels (4)
4 REPLIES 4
Message 2 of 5
Stephen.Blair
in reply to: zenop

The shaders are not merged, but closures have an efficient mix op, so the returned BSDFs are mixed after. Plus things like diffuse BSDFs are cached so they aren't evaluated multiple times in the same shader network. That's roughly how it works.



// Stephen Blair
// Arnold Renderer Support
Message 3 of 5
zenop
in reply to: zenop

Sweet, that's ideal. I haven't had the time to test the speed results yet - but would you guess be that the internal closure mixing would make a custom merging tool obsolete? Since everything is slider based I was thinking of writing something that merges mix shaders into a single surface shader.

Message 4 of 5
Mike_Farnsworth
in reply to: zenop

I wouldn't bother with a custom merging tool. In the future, we're fairly likely to convert many (if not nearly all) built-in shaders to OSL, and so even the multiple-node overhead will for the most part go away at that point. You already get most of the benefits of closures being combined already with mix_shader.

Note that you can combine C++ and OSL shaders in the same shader network, no problem; but when there are larger groups of OSL nodes together they will optimize among themselves and be more efficient. As we move more to OSL shaders, you'll automatically get this benefit.

Message 5 of 5
zenop
in reply to: Mike_Farnsworth

That's brilliant Mike, the ideal case scenario. Cheers for the explanation.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report