When writing custom URP shader I stumbled onto a problem with sampling reflection probe using SAMPLE_TEXTURECUBE_LOD() macro. Function flattens the mesh along local X-axis when shader is compatible with SRP Batcher:
Function works as intended if when SRP batching is incompatible:
Here is the shader I used for testing, I remove CBUFFER_START and CBUFFER_END lines to break to SRP Batcher compatibility.
Shader "Unlit/sh_urp_template"
{
Properties
{
_test ("test", Float) = 1
}
SubShader
{
Tags { "RenderType"="Opaque" "LightMode" = "UniversalForward"}
LOD 100
Pass
{
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f
{
float3 normal : NORMAL;
float4 vertex : SV_POSITION;
};
CBUFFER_START(UnityPerMaterial)
float _test;
CBUFFER_END
v2f vert (appdata v)
{
v2f o;
o.normal = mul( UNITY_MATRIX_M, float4( v.normal, 0.0 ) ).xyz;
o.vertex = TransformObjectToHClip(v.vertex.xyz);
return o;
}
half4 frag (v2f i) : SV_Target
{
half4 refl = SAMPLE_TEXTURECUBE_LOD(unity_SpecCube0,samplerunity_SpecCube0, i.normal, 0);
return refl*_test;
}
ENDHLSL
}
}
}




