123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- Shader "Imagine/ARShadowURP"
- {
- Properties
- {
- _ShadowIntensity ("Intensity", Range (0, 1)) = 0.75
- }
-
- SubShader
- {
- PackageRequirements
- {
- "com.unity.render-pipelines.universal": "12.1.6"
- }
- Tags
- {
- "RenderPipeline"="UniversalPipeline"
- "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"
- }
-
- Pass
- {
- Name "ForwardLit"
- Tags { "LightMode" = "UniversalForward" }
-
- //Blend DstColor Zero, Zero One
- Blend SrcAlpha OneMinusSrcAlpha
- Cull Back
- //ZTest LEqual
- //ZWrite Off
-
- HLSLPROGRAM
- #pragma vertex vert
- #pragma fragment frag
-
- //#pragma prefer_hlslcc gles
- //#pragma exclude_renderers d3d11_9x
- //#pragma target 2.0
-
- #pragma multi_compile _ _MAIN_LIGHT_SHADOWS
- #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
- #pragma multi_compile _ _SHADOWS_SOFT
- #pragma multi_compile_fog
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
-
- CBUFFER_START(UnityPerMaterial)
- float _ShadowIntensity;
- CBUFFER_END
-
- struct Attributes
- {
- float4 positionOS : POSITION;
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
-
- struct Varyings
- {
- float4 positionCS : SV_POSITION;
- float3 positionWS : TEXCOORD0;
- float fogCoord : TEXCOORD1;
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
-
- Varyings vert (Attributes input)
- {
- Varyings output = (Varyings)0;
-
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_TRANSFER_INSTANCE_ID(input, output);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
-
- VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
- output.positionCS = vertexInput.positionCS;
- output.positionWS = vertexInput.positionWS;
- output.fogCoord = ComputeFogFactor(vertexInput.positionCS.z);
-
- return output;
- }
-
- half4 frag (Varyings input) : SV_Target
- {
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
-
- half4 color = half4(1,1,1,1);
-
- VertexPositionInputs vertexInput = (VertexPositionInputs)0;
- vertexInput.positionWS = input.positionWS;
-
- float4 shadowCoord = GetShadowCoord(vertexInput);
- half shadowAttenutation = MainLightRealtimeShadow(shadowCoord);
- return half4(0,0,0, (1-shadowAttenutation) * _ShadowIntensity);
- }
-
- ENDHLSL
- }
- }
- }
|