Disable textures in an instanced material?

how can i disable the texture parameter in my instance material? i tried to set them to none but there r still being rendered on an object I don’t need

Annotation 2021-08-16 233450

Did you try to clear them?


Yes that’s how i set them to none. But they’re still being rendered on my mesh, and it makes it look weird.

from the picture you posted, you still have 2 textures selected…

Are we sure we’re looking at the correct material-instance?

Can you share a pic of the cleared instance-settings and what you see in game?

by default there are 5 textures applied in the master material.

however my mesh only has 2 textures, a base color and a roughness map, so I don’t need the other 3.

but it seems like the only way to override the parameter is to set another texture, otherwise it will render whatever texture that was set in the master material, which isn’t gonna work.

as u can see disabling or enabling those tesxture has no effect

how do I get rid of them?

guys could someone help me with this i don’t know much about materials…

It looks like you want a material without AO, metal, and normal maps? The better way to do that would be make a separate master material without those, then swap to that material. Just removing the AO, normal, and metal on a material that expects them will probably cause anomalies …

but isn’t that inefficient? also in this case it’s gonna be more complicated bcuz i also have an emissive parameter in my master material which I want to use for some of my mesh’s in the game, so I also have to duplicate those.

also can I use an if statement or some kind of switch in my master material to determine if the material instance wants to use a certain texture or not?

Just having the texture-sampler there even w/o the texture might cost you overhead. As well in this case, no idea how/if the missing maps are somehow used in other places; materials can get funky.

You should pick ‘a look’ for you game/project where you know your pipeline is going to be basecolor, rough, normal, etc; whatever maps you intend to use. Make a master material around those expectations and grow from there.

As far as the emissive, you can use a static-switch parameter to turn code-paths on/off but realize when you do so you are compiling a new material, even though u might toggle the switch in the instance.

Regarding emissive, it might be worth it to keep it in there for every mesh, and use a 0-value when you don’t want to add anything? Depends on how much it costs but if it’s cheap on instruction count, it might make your material(s) less complex/differentiated.

oh i already figured out the switch for the emissive, it’s the textures that i’m struggling with. why can’t we just disable the textures by overriding it so that it doesn’t render in the instance material? from my understanding in programming the child class should be able to override anything in the parent class if it doesn’t need it, idk why that doesn’t apply here…

The code loads the sampler b/c it is there, it just doesn’t happen to sample anything in this use-case… Parking spot still takes space even though you don’t put a car there…

if you want it off-off, you have to use a static-switch parameter. This, for example, turns my displacement on/off. You would do the same thing with the texture-sampler:

hey i did the same setup as u gave me in this picture, and it kinda worked but there’s still one more problem which is when i switch the parameter to false it feeds the 0 value to the input which can be problematic for roughness and metallic values, isn’t there a way to leave the false value empty so that it feeds nothing to the input like there was nothing plugged in in the first place?

Annotation 2021-08-18 213928

as u can see it looks really metallic

You don’t have to feed 0 at all, it’s a gate for a true/false path. Whatever is hooked into true is what will be compiled when it’s true; it will be like the false-path doesn’t even exist. Vice-versa if you set the node to false. Zero is already the ‘empty-path’ and yes you need to put something into both the true and false inputs. Just how the node works. :-/

In that case, you can put a 1 instead of a 0 for roughness? This will make it ‘fully-rough’ (for which there is actually a checkbox on the left for that if you want).

The upshot here being the switch would give you the option to pick one or the other and not have to pay for BOTH paths, like you might in a LERP or an IF statement. The switch is static so it’s evaluated at compile-time. Each switch basically gives you two possibilities to a given material: eg 2 possible materials, so be careful how you add them.

You CAN, however, use multiple copies of the switch to handle multiple paths…Like if your snow on/off did something with the base-color in one part, then the roughness (or whatever) in a different path, you could put logic in each of those for (un)snowed stuff and turn snow (as a concept/layer) on/off. It’s not the number of a specific switch as it is the number of DIFFERENT switches you have.

What I might recommend is use the R, G, or B channel from the base-color and multiply that by a value to put into the false-path. In this case, you can use a texture for roughness if you want, otherwise you can still get a texturey/varied roughness value across the object by re-using a texture-sampler. This is done ALL the time as you already sampled the basecolor you can reuse that sample for other math (set shader to shared:wrap).

It might look something like this? I used Metal in my example but you ought to get the idea

When the switch is false, I reuse the R channel from the basecolor as a texture-sample to base my metal value off of vs just a uniform 0, 1, etc across the entire thing. Otherwise, with it to true, I use a distinct texture sample.

Honestly, unless the material really needs it, if it’s for the ground, or something organic like bark, moss, muck, etc, I tend to reuse channels greatly; you would almost never notice unless you really look, otherwise, you just can’t, as it works well enough.