Pass { Name "Sprite Lit" Tags { "LightMode" = "Universal2D" } ${Tags} ${Blending} ${Culling} ZWrite Off HLSLPROGRAM // Required to compile gles 2.0 with standard srp library #pragma prefer_hlslcc gles #pragma exclude_renderers d3d11_9x #pragma target 2.0 #pragma vertex vert #pragma fragment frag #pragma multi_compile _ ETC1_EXTERNAL_ALPHA #pragma multi_compile USE_SHAPE_LIGHT_TYPE_0 __ #pragma multi_compile USE_SHAPE_LIGHT_TYPE_1 __ #pragma multi_compile USE_SHAPE_LIGHT_TYPE_2 __ #pragma multi_compile USE_SHAPE_LIGHT_TYPE_3 __ ${Defines} #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl" #if ETC1_EXTERNAL_ALPHA TEXTURE2D(_AlphaTex); SAMPLER(sampler_AlphaTex); float _EnableAlphaTexture; #endif #if USE_SHAPE_LIGHT_TYPE_0 SHAPE_LIGHT(0) #endif #if USE_SHAPE_LIGHT_TYPE_1 SHAPE_LIGHT(1) #endif #if USE_SHAPE_LIGHT_TYPE_2 SHAPE_LIGHT(2) #endif #if USE_SHAPE_LIGHT_TYPE_3 SHAPE_LIGHT(3) #endif #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/CombinedShapeLightShared.hlsl" ${Graph} struct GraphVertexOutput { float4 positionCS : POSITION; half2 lightingUV : TEXCOORD0; ${VertexOutputStruct} }; GraphVertexOutput vert (GraphVertexInput v) { GraphVertexOutput o = (GraphVertexOutput)0; ${VertexShader} VertexDescriptionInputs vdi = (VertexDescriptionInputs)0; ${VertexShaderDescriptionInputs} VertexDescription vd = PopulateVertexData(vdi); v.vertex.xyz = vd.Position; VertexColor = v.color; o.positionCS = TransformObjectToHClip(v.vertex.xyz); float4 clipVertex = o.positionCS / o.positionCS.w; o.lightingUV = ComputeScreenPos(clipVertex).xy; ${VertexShaderOutputs} return o; } half4 frag (GraphVertexOutput IN) : SV_Target { ${PixelShader} SurfaceDescriptionInputs surfaceInput = (SurfaceDescriptionInputs)0; ${PixelShaderSurfaceInputs} SurfaceDescription surf = PopulateSurfaceData(surfaceInput); #if ETC1_EXTERNAL_ALPHA float4 alpha = SAMPLE_TEXTURE2D(_AlphaTex, sampler_AlphaTex, IN.uv0.xy); surf.Color.a = lerp (surf.Color.a, alpha.r, _EnableAlphaTexture); #endif surf.Color *= IN.VertexColor; return CombinedShapeLightShared(surf.Color, surf.Mask, IN.lightingUV); } ENDHLSL }