Shader "Unlit/NewUnlitShader" { Properties { _MainTex ("Texture", 2DArray) = "white" {} } SubShader { Tags { "RenderType"="Opaque" } LOD 100 Pass { HLSLPROGRAM #pragma vertex vert #pragma fragment frag // make fog work #pragma multi_compile_fog #pragma require 2darray #include "LWRP/ShaderLibrary/Core.hlsl" struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; }; struct v2f { float3 uv : TEXCOORD0; //UNITY_FOG_COORDS(1) float4 vertex : SV_POSITION; }; TEXTURE2D_ARRAY(_MainTex); SAMPLER(sampler_MainTex); float4 _MainTex_ST; v2f vert (appdata v) { v2f o; o.vertex = TransformObjectToHClip(v.vertex); o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex); o.uv.z = 0; //UNITY_TRANSFER_FOG(o,o.vertex); return o; } half4 frag (v2f i) : SV_Target { // sample the texture half4 col = SAMPLE_TEXTURE2D_ARRAY(_MainTex, sampler_MainTex, i.uv.xy, 0); // apply fog //UNITY_APPLY_FOG(i.fogCoord, col); return col; } ENDHLSL } } }