On 26/10/2017 at 05:17, xxxxxxxx wrote:
in general Riccardo's answer is correct. But we figured out, one will be missing a few corner cases with this approach.
There are some shaders which support sub-shaders, but for historic and/or architectural reasons these do not insert their sub-shaders into the shader tree of a material.
For these you will need to do a separate traversal starting with the shader(s) from their parameters.
Here are the shaders, their IDs and shader parameters:
Colorizer (ID: Xcolorizer from xslacolorizer.h, parameter SLA_COLORIZER_TEXTURE)
MoGraph MultiShader (ID: 1019397, parameters MGMULTISHADER_LAYER_LINK (first shader, next ones follow by +1) and MGMULTISHADER_LAYERCOUNT (number of shaders) from xmg_multi.h)
Sketch&Toon Art Shader (ID: 1012161, parameters ARTSHADER_TEXTURE, ARTSHADER_SHADOW_TEXTURE and ARTSHADER_BACKFACE_TEXTURE from xartshader.h)
Sketch&Toon Hatch Shader (ID: 1012166, parameter HATCHINGSHADER_TEXTURE from xhatchingshader.h)
Sketch&Toon Spots Shader (ID: 1012160, parameter SPOTSHADER_GAP_TEXTURE from xspotshader.h)
You might consider to browse the descriptions of shaders for shader links to end up with a generic implementation. But then be extra careful you don't end in an endless loop, with shaders which do insert sub-shaders intro the tree (e.g. layer shader).