Skip to content

Commit

Permalink
fix: Issue doodlum#124 VR grass culling
Browse files Browse the repository at this point in the history
VR grass cull distance was calculated per eye, resulting in different
cull distances for each eye.
This meant, that grass might be visible in the left eye, while culled in
the right eye.
This is a potential fix, calculating the cull distance based on the
first eye.
  • Loading branch information
thorwin99 committed Oct 9, 2023
1 parent e9d7032 commit d695289
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion features/Grass Lighting/Shaders/RunGrass.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ VS_OUTPUT main(VS_INPUT input)
float3 diffuseMultiplier = input.InstanceData1.www * input.Color.xyz * saturate(dirLightAngle.xxx);
# endif // VR
float perInstanceFade = dot(cb8[(asuint(cb7[0].x) >> 2)].xyzw, M_IdentityMatrix[(asint(cb7[0].x) & 3)].xyzw);
float distanceFade = 1 - saturate((length(projSpacePosition.xyz) - AlphaParam1) / AlphaParam2);
float distanceFade = 1 - saturate((length(mul(WorldViewProj[0], msPosition).xyz) - AlphaParam1) / AlphaParam2);

// Note: input.Color.w is used for wind speed
vsout.VertexColor.xyz = input.Color.xyz * input.InstanceData1.www;
Expand Down

0 comments on commit d695289

Please sign in to comment.