I have a shader in URP (I am NOT using shader graph!!) for instancing billboards (i.e. for grass or leaves). In the case of leaves, I want them to cast some sort of shadow however them being billboards makes that difficult.
I've attached screenshots that show how the leaves cast shadows when just applying the standard translations (object to world to h-clip) without billboarding, and one where they're transformed to be billboarding.
I'm wondering if transforming the geometry such that it's pointing in the direction of the scene's directional light would be better, but I can't even test that at the moment as I have no idea HOW to do that.
Here is my current vertex shader code in the shadow vertex pass.
float4x4 detailToWorld = _TerrainDetail[instanceID].TRS;
float3 scale = float3(length(detailToWorld[0].xyz), length(detailToWorld[1].xyz), length(detailToWorld[2].xyz));
float4 worldPos = mul(detailToWorld, float4(0.0,0.0,0.0,1.0));
//Apply vertex offset and scaling
float3 viewPos = TransformWorldToView(worldPos) + input.positionOS.xyz * float3(scale.x,scale.y,1.0);
//ToDo: use _LightDirection/_LightPosition to transform the geometry to face the directional light
float4 clipPos = TransformWViewToHClip(viewPos);
#if defined(_ALPHATEST_ON)
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
#endif
output.positionCS = clipPos;