Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Custom/DepthHighlighter"
- {
- Properties {
- _MainTex ("Base (RGB)", 2D) = "white" {}
- _trgDepth ("target depth", float) = 1
- _replacingColor ("replacting color", Color) = (0,1,0,0)
- }
- SubShader {
- Tags { "RenderType"="Opaque" }
- LOD 200
- CGPROGRAM
- #pragma exclude_renderers gles
- #pragma surface surf Lambert
- sampler2D _MainTex;
- sampler2D _CameraDepthTexture;
- float _trgDepth;
- float4 _replacingColor;
- struct Input
- {
- float2 uv_MainTex;
- float4 screenPos;
- };
- void surf (Input IN, inout SurfaceOutput o)
- {
- half4 c = tex2D (_MainTex, IN.uv_MainTex);
- float aa = tex2D (_CameraDepthTexture, IN.uv_MainTex).g;
- if(aa > _trgDepth)
- {
- o.Albedo = c.rgb;
- }
- else
- {
- o.Albedo = _replacingColor.rgb;
- }
- //o.Alpha = c.a;
- }
- ENDCG
- }
- FallBack "Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment