MultiSwitchParameter for materials.

Hi! Not sure if this question should be in “Rendering” section, but it’s about materials, so…
Is there any kind of MultiSwitchParameter? StaticSwitchParameter works fine for two inputs, but what to do if I need more ones? (4-8 inputs)? The only way I know is stairs-like compilation of few StaticSwitchParameters, but it’s not enough flexible and has bad usability in Material Instance interface.

You have the right idea, you need to chain them up to get multiple combinations.

The one exception to this rule is ‘component mask parameters’ which let you choose between 4 scalar options. So you could append any 4 scalars and pass them to a component mask input and use that to choose 1-4, but obviously it will not be very intuitive.

Thanks, Ryan! Unfortunately, I need to switch between Texture Objects, so ComponentMaskParameters doesn’t fit my needs.

There is a Texture Object parameter. You can let users plug in whatever texture they want.

I know about it, but it’s another story. I have a complex Master material with four material layers. Layers can mix through simple overlay, mask and/or vertex paint. Artist can chose how much layers he need for some asset. Every mat. layer have it’s own set of textures (color, roughness, metallicity, emissive etc.) and parameters -tiling, uv channel. Master material can have only 13 texture samplers (12 if DBuffer decals are enabled). With MultiSwitchParameter I would be able to share textures between layers if needed. For example, layer 0 can have unique color, normal texture from layer 3 and roughness from layer 2. For other asset layer 0 can have fully unique set of textures, but layers 1-3 can have the same roughness texture. It’s all about flexibility of Master material.

If it’s so complex, maybe you do most of your texture mixing in sub materials, render those to CanvasRenderTarget2Ds, and pass them as texture object parameters to your master material. This will also be less expensive than lots of texture samplers in a single material if you don’t have to update the CanvasRenderTarget2Ds every frame. Some of the graphs in this postshould give you an idea of how to do that.

Wow, thanks a lot. I’ll take a look on it, it’s a completely new way for me.