Quantcast
Channel: Questions in topic: "shader programming"
Viewing all articles
Browse latest Browse all 169

Is it possible to turn Depth Testing on/off for individual meshes sharing a material on a per-renderer basis?

$
0
0
I have a bunch of meshes, each with their own MeshRenderer, using a custom surface shader, and which are all sharing the same material. I would like to be able to turn Depth Testing on and off through a script at run time, but only for specific meshes at a time and without duplicating the material for each renderer. - I know that when you access MeshRenderer.material for the first time, a copy of the MeshRenderer.sharedMaterial is created. If I do something like meshRenderer.sharedMaterial.SetInt("_ZTest", value), all of the meshes have their ZTest value changed, where I would only want to change it for specific ones. - Is it possible to have the ZTest value be a [PerRendererData] that can be modified with a MaterialPropertyBlock? Are there any other solutions to this problem?

Viewing all articles
Browse latest Browse all 169

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>