Properties
{
[HDR]_color("Color", Color) = {1,1,1,1}
_baseMap("BaseMap", 2D) = "white"{}
}
Tags{"Queue"="Transparent""RenderType"="Transparent" "RenderPipeline"="UniversalPipeline"}
Varyings vert(Attributes v)
{
o.positionOS = v.positionOS;
o.positionWS = TransformObjectToWorld(v.positionOS.xyz);
o.positionVS = TransformWorldToView(o.positionWS);
o.positionCS = TransformViewToHClip(o.positionVS);
o.uv = v.uv;
return o;
}
half4 frag(Varyings i) : SV_Target
{
half2 screenUV = i.positionCS.xy / _screenParams.xy;
half4 DepthMap = SAMPLE_TEXTURE2D(_cameraDepthTexture,sampler_cameraDepthTexture, screenUV);
half4 DepthZ = LinearEyeDepth(DepthMap, _ZBufferParams);
float4 depthVS = 1;
depthVS.xy = i.positionVS.xy * DepthZ / -i.positionVS.z;
depthVS.z = DepthZ;
float3 depthWS = mul(unity_CameraToWorld, depthVS);
float3 depthOS = mul(unity_WorldToObject, float4(depthWS, 1));
float2 uv = depthOS.xy + 0.5
half4 baseMap = SAMPLE_TEXTURE2D(_baseMap, sampler_baseMap, uv) * _color;
}