Release v0.9.6
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
Shader "Hidden/NimbleFox/DepthToGrayscale"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
ZTest Always
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_MainTex);
|
||||
|
||||
float _DepthRangeNear;
|
||||
float _DepthRangeFar;
|
||||
|
||||
fixed4 frag(v2f_img i) : SV_Target
|
||||
{
|
||||
float rawDepth = SAMPLE_DEPTH_TEXTURE(_MainTex, i.uv);
|
||||
float linearDepth = LinearEyeDepth(rawDepth);
|
||||
float normalizedDepth = saturate((linearDepth - _DepthRangeNear) / max(0.0001, _DepthRangeFar - _DepthRangeNear));
|
||||
float grayscale = 1.0 - normalizedDepth;
|
||||
return fixed4(grayscale, grayscale, grayscale, 1.0);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
||||
Reference in New Issue
Block a user