Material switch based on mesh LOD?

Hey all,

Is there a way to use a switch (sort of like the Quality Switch) so turn a shader function on and off based on the LOD?

For example, I have a world-aligned panning normal texture simulating water running down surfaces - it’s not SUPER expensive by itself, but when combined with some other things I imagine it can get quite spicy.

Rather than create separate “lite” versions of EVERY material and material instance and tie them to the LODs, is there a way to simply turn off a part of the shader based on the LOD of the mesh it is on? ie. at mesh LOD 0 the water running is applied and LOD >1 it is turned off.

Any suggestions would be greatly appreciated!

I don’t know of any specific nodes or checkboxes for LODs, but in theory, this sounds like something you could do with pixel depth if you knew which pixel depths corresponded to which LODs.

The Pixel Depth node measures the current distance from the camera to the pixel. You would have to manually find out the exact range for the LODs for it though. …It might not be worth the effort.

Hi, AFAIK there are no automatic switches in the material that work per lod. But you can use static switch parameters in your material to be able to turn things off in material instances and then create material instances for the lods and turn things off there that you don’t need. So this ends up in as many material instances as lods were you want to turn different things off.

That’s an interesting idea, so basically;

If pixel depth < cutoff point, do the water thing
If pixel depth > cutoff point, no water thing

Although I’m not sure if the shader would be running ‘in the background’ when not visible… I might do some profiling and see if it makes a difference!

Yeah that’s what I figured I’d need to do. The only reason I’m trying to avoid it is to save me an entire day of implementing it per Material Instance rather than something I can chuck on the Master Material.