Uploaded October 2025 | Updated November 2026, 3 hours ago
Using the depth buffer, Unity can draw objects with the correct per-pixel ordering. We can also access the _CameraDepthTexture, a special texture which contains depth information, to create effects such as silhouettes, or we can change the ZTest to something else like Greater to create an x-ray effect.
------------------------------------------------------------------------
๐ Download the project on GitHub: github.com/daniel-ilett/shaders-hlsl-basics
๐ฐ Read this tutorial in article format instead: danielilett.com/2026-01-02-tut10-04-depth
------------------------------------------------------------------------
โจ Snapshot Shaders 2 has you covered for all your post processing needs: assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/snapshot-shaders-2-for-urp-331908?aid=1101lfDLn
โจ Grab Retro Shaders Pro, my PSX and N64 shader asset pack, here: assetstore.unity.com/packages/vfx/shaders/retro-shaders-pro-for-urp-287937?aid=1101lfDLn
๐ Get a copy of my shader book here: link.springer.com/book/10.1007/978-1-4842-8652-4
------------------------------------------------------------------------
๐ฌ Join the Discord: discord.gg/tPQEUwPpb3
โ Or throw me a one-off coffee on Ko-fi: ko-fi.com/danielilett
------------------------------------------------------------------------
Using the depth buffer, Unity can draw objects with the correct per-pixel ordering. We can also access the _CameraDepthTexture, a special texture which contains depth information, to create effects such as silhouettes, or we can change the ZTest to something else like Greater to create an x-ray effect.
------------------------------------------------------------------------
๐ Download the project on GitHub: github.com/daniel-ilett/shaders-hlsl-basics
๐ฐ Read this tutorial in article format instead: danielilett.com/2026-01-02-tut10-04-depth
------------------------------------------------------------------------
โจ Snapshot Shaders 2 has you covered for all your post processing needs: assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/snapshot-shaders-2-for-urp-331908?aid=1101lfDLn
โจ Grab Retro Shaders Pro, my PSX and N64 shader asset pack, here: assetstore.unity.com/packages/vfx/shaders/retro-shaders-pro-for-urp-287937?aid=1101lfDLn
๐ Get a copy of my shader book here: link.springer.com/book/10.1007/978-1-4842-8652-4
------------------------------------------------------------------------
๐ฌ Join the Discord: discord.gg/tPQEUwPpb3
โ Or throw me a one-off coffee on Ko-fi: ko-fi.com/danielilett
------------------------------------------------------------------------










