//45是监控范围为0-45m,*15/255是将这段0-45的深度值映射到颜色的后4位上(后4位0-15)
o.depth=float2(saturate(distance(worldPos,_WorldSpaceCameraPos)/45)*15/255,1);
float depth=tex2D(_Texture, screenUV).a*256.f*3;//a通道的深度值 0-45
//45是监控范围为0-45m,*15/255是将这段0-45的深度值映射到颜色的后4位上(后4位0-15)
o.depth=float2(saturate(distance(worldPos,_WorldSpaceCameraPos)/45)*15/255,1);
float depth=tex2D(_Texture, screenUV).a*256.f*3;//a通道的深度值 0-45
转载于:https://www.cnblogs.com/luxishi/p/8406227.html