您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
49 行
1.3 KiB
49 行
1.3 KiB
Shader "Hidden/LightweightPipeline/CopyDepth"
|
|
{
|
|
SubShader
|
|
{
|
|
Tags { "RenderType" = "Opaque" "RenderPipeline" = "LightiweightPipeline"}
|
|
|
|
Pass
|
|
{
|
|
ZTest Always ZWrite Off ColorMask 0
|
|
|
|
HLSLPROGRAM
|
|
// Required to compile gles 2.0 with standard srp library
|
|
#pragma prefer_hlslcc gles
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
#include "LWRP/ShaderLibrary/Core.hlsl"
|
|
|
|
TEXTURE2D(_CameraDepthTexture);
|
|
SAMPLER(sampler_CameraDepthTexture);
|
|
|
|
struct VertexInput
|
|
{
|
|
float4 vertex : POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
};
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 position : SV_POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
};
|
|
|
|
VertexOutput vert(VertexInput i)
|
|
{
|
|
VertexOutput o;
|
|
o.uv = i.uv;
|
|
o.position = TransformObjectToHClip(i.vertex.xyz);
|
|
return o;
|
|
}
|
|
|
|
float frag(VertexOutput i) : SV_Depth
|
|
{
|
|
return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, i.uv);
|
|
}
|
|
ENDHLSL
|
|
}
|
|
}
|
|
}
|