MakeMateriaAttribute error in Material Function

Version: 4.12.1

I want to use a switch in a material function with MakeMaterialAttributes but I have an error and I doesn’t understand why. The error is too generic.

Error [SM5] (Node MakeMaterialAttributes) Error on property BaseColor

If I remove the switch, I don’t have any error.

The workflow is the same in both screenshot, it should work with both graph.

Actually it doesn’t seem to possible to use a Texture Object with a Switch

Hey mbleblanc,

This is actually intended as you are not allowed to cast between non-numeric types. I have provided a test image just for clarification as well.

Static Switch with Texture Objects

Unless you are on a tight budget or are worried about the number of texture samples used, you can still use the Switch node with regular Texture Samples.

Static Switch with Texture Samples

Let me know if you have further questions or need additional assistance.

Cheers,

Let me know if you have further questions or need additional assistance.

So it’s not possible to do that in a material function? I want to have a debug flag to disable a texture in a material function.

Ok I switch to texture sample, it’s ok since it’s only for debug purpose.
Thanks!

No, the math will not be accepted for the material function either. The same rules apply. Is there a reason you cannot use a texture sample?