question

Adrian Meyer avatar image
Adrian Meyer asked ·

Shader Optimisation Questions

Hi,

I have some questions regarding Shader Optimisation in Arnold for complex Shaders.

(in my case I have a kind of UberShader with around 400 Nodes in HtoA, packed as an HDA)


1. A lot of the nodes ar actually mostly not actively used, but are "switch options" to allow different features of the Shader to be enabled form the HDA UI.
I used a lot of switch nodes in the hope, that everything in the switch inputs that is not the active input, is not computed, and thus performance neutral.
Is this the case, or do nodes in a Shader onnly not get computed if their node connections are actually disconnected?

2. Furthermore, if there is an option to say, blend in another texture with a mix node, I used a switch after the mix node to make sure when the mix node is set to 0 or 1, only the then only active input gets computed. Is this necessary, or is arnold smart enough to omit shader graphs before a mix node when set to full 0 or 1 (and in blend mode). Same question for MixRGBA and MixShader.

3. Material Layering. When having a complex layered Material with different properties in different parts of the object (blended with masks)... It's mostly possible to achieve the look and different shading properties with a single Arnold Standard Shader, but then with complex layered inputs, so lots of MixRGBA Nodes, Color Correct Nodes etc.
The other option is to make seperate Standard Surface Shaders with little less complex inputs and then using a MixShader or LayerShader Node at the end.

Here again, what generally tends to more effcient? I guess it also has to to a little bit of how smart the MixShader and LayerShader Nodes are, so the topic above. Does it mean, when layering Standard Surfaces, that they are basically all fully computed for each Shading Point, even if the blend value might be 0 or 1 in some areas.

4. Costly Nodes. Is there some source to get some insides of how "costly" different Arnold Shader nodes are? I heard that for instance the Noise Shader is very expensive (makes sense).
When dealing with things like Occlusion, Curvature or Noise, I suppose it is always more efficient to have "prebaked" geometry user data attribs when possible instead of using the procedural nodes, with cost of heavier geo and probably more memory cunsumption?

Would be really usefull to get a better understanding of these things for really heavy scenes.

Hopefully usefull for many people.


Thanks a lot!


Adrian

arnoldshadershtoaoptimisationcore
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Adrian Meyer avatar image
Adrian Meyer answered ·

Anyone else any thoughts on this?

Would be great.

Thanks

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Mads Drøschler avatar image
Mads Drøschler answered ·

Not a reply to any of your questions directly, but have you evaluated the OSL initiative?

You can drop a ton of nodes since you can pack multiple features and make preset feature groups, quite easily, reducing your large node hirachy to a fraction while still having a switchboard connected.


In theory, we can pack all your nodes into 1, provided the underlaying mechanisms are supported in OSL atm.

3 comments Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Sounds interesting.

Could you elaborate a bit more, not yet familiar with OSL and Arnold. (Though I know how to code (-; )

Sounds like there is some kind of Auto Converter that takes Arnold / HtoA Shader Nodes and Builds Auto OSL Code from that or semething?

0 Likes 0 · ·

I don't think there is an auto converter in the host.

But you would want to start typing up stuff instead, I would say.
It's C type external functions defines includes.


Example of noodle converted to a single node below.

The noodle is basic functions, add, multiply, take a fraction of a float value

float fract( float x )
{
x-floor(x);
}

where a mix would be

float Mix_Amount = some_value;
float Mixer = mix(a,b,Mix_Amount);

0 Likes 0 · ·
cc.png (1.0 MiB)

Also, you can host procedural home written noises in some type of general master shader, or have many, integrate a triplanar map directly, complex volumetric stuff.

0 Likes 0 · ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Welcome to the Arnold Answers community.

This is the place for Arnold renderer users everywhere to ask and answer rendering questions, and share knowledge about using Arnold, Arnold plugins, workflows and developing tools with Arnold.

If you are a new user to Arnold Answers, please first check out our FAQ and User Guide for more information.

When posting questions, please be sure to select the appropriate Space for your Arnold plugin and include the plugin version you are using.

Please include images, scene and log files whenever possible as this helps the community answer your questions.

Instructions for generating full verbosity log files are available for MtoA, MaxtoA, C4DtoA, HtoA, KtoA, and Kick.

If you are looking for Arnold Documentation and Support please visit the Arnold Support site.

To try Arnold please visit the Arnold Trial page.

Bottom No panel present for this section.