1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #ifndef UNIVERSAL_DEPTH_ONLY_PASS_INCLUDED
- #define UNIVERSAL_DEPTH_ONLY_PASS_INCLUDED
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
- struct Attributes
- {
- float4 positionOS : POSITION;
- float4 tangentOS : TANGENT;
- float2 texcoord : TEXCOORD0;
- float3 normal : NORMAL;
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct Varyings
- {
- float4 positionCS : SV_POSITION;
- float2 uv : TEXCOORD1;
- float3 normalWS : TEXCOORD2;
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
- Varyings DepthNormalsVertex(Attributes input)
- {
- Varyings output = (Varyings)0;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
- output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
- output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
- VertexNormalInputs normalInput = GetVertexNormalInputs(input.normal, input.tangentOS);
- output.normalWS = NormalizeNormalPerVertex(normalInput.normalWS);
- return output;
- }
- float4 DepthNormalsFragment(Varyings input) : SV_TARGET
- {
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
- Alpha(SampleAlbedoAlpha(input.uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap)).a, _BaseColor, _Cutoff);
- return float4(PackNormalOctRectEncode(TransformWorldToViewDir(input.normalWS, true)), 0.0, 0.0);
- }
- #endif
|