Hi, I’m trying to shade my geometry shader and I’m having issues getting the shadows to display correctly. It seems like they’re in the wrong space, but I used TransformObjectToWorld so I think it should be correct…
This is my frag function:
/* ==============================================================
FRAG
===============================================================*/
float4 Frag (g2f input) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(input);
float4 col;
float4 shadowCoord = TransformWorldToShadowCoord(input.positionWS);
Light mainLight = GetMainLight(shadowCoord);
float shadowValue = SampleScreenSpaceShadowmap(shadowCoord);
float4 lightValue = float4(mainLight.color, 1.0);
col = lerp(
UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _BottomColor),
UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _TopColor),
input.uv.y
);
return col * lightValue * shadowValue;
}
And this is the result:
Anyone have any ideas?

