Skip to content

Commit

Permalink
Merge pull request #3 from doodlum/VR_water
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse authored Feb 29, 2024
2 parents 971a143 + 8b115a7 commit 60e13c1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions package/Shaders/Water.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,10 @@ PS_OUTPUT main(PS_INPUT input)
DynamicResolutionParams1.xy * (DynamicResolutionParams2.xy * input.HPosition.xy));
float2 depthOffset =
DynamicResolutionParams2.xy * input.HPosition.xy * VPOSOffset.xy + VPOSOffset.zw;
float depthMul = length(float3((depthOffset * 2 - 1) * depth / ProjData.xy, depth));

float3 viewPosition = mul(CameraView[eyeIndex], float4(input.WPosition.xyz, 1)).xyz;
float2 screenUV = ViewToUV(viewPosition, true, eyeIndex);
float depthMul = length(float3((screenUV * 2 - 1) * depth / ProjData.xy, depth));

float3 depthAdjustedViewDirection = -viewDirection * depthMul;
float viewSurfaceAngle = dot(depthAdjustedViewDirection, ReflectPlane[eyeIndex].xyz);

Expand Down

0 comments on commit 60e13c1

Please sign in to comment.