Depth Shader/Depth Pass/Z-Depth

Hi all,

I’m trying to locate a shader that would create an depth render effect used in animation and compositing software. Ideally the effect’s range can be independant of camera distance. Needs to run on iOS. I’m not a coder myself. Any pointers much appreciated.

Thank you.

Unity has the rendering of such a texture built in. You can set a flag on you camera to have the texture generated. Unity - Scripting API: DepthTextureMode

GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth;

You can then use _CameraDepthTexture in your shader to transform the depth rendered in whatever way you want.

Hi there, thank you for the quick response. Unfortunately I’m not a coder, so don’t know how to make the awesomeness of the above one line integrate with camera and shaders. Is there a tutorial you could point me towards? It’s a very popular effect in visual fx - is there a possibility of getting this to an ‘example’ or tutorial page of Unity5. Thank you.