Skip to content

Conversation

@superdump
Copy link

  • 'height' -> 'depth' as the texture has 0 as minimum depth and 1 as maximum depth.
  • Make the Vt used in parallax mapping point from the camera to the fragment to make the algorithm easier to understand as the ray points into the surface. Adjust the UV maths as appropriate to step forward instead of backward.
  • Parallax depth -> parallax depth scale to make it clearer that this scales the parallax depth effect.

…ctness

'height' -> 'depth' as the texture has 0 as minimum depth and 1 as maximum
depth.

Make the Vt used in parallax mapping point from the camera to the fragment to
make the algorithm easier to understand as the ray points into the surface.
Adjust the UV maths as appropriate to step forward instead of backward.
let layer_height = 1.0 / layer_count;
var delta_uv = depth * V.xy / V.z / layer_count;
let layer_depth = 1.0 / layer_count;
var delta_uv = depth_scale * layer_depth * Vt.xy * vec2(1.0, -1.0) / view_steepness;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiplying this by vec2(1.0, -1.0) is very surprising. I understand it's to avoid the -B, but in this case I think it should be explained. I know it's necessary, but I don't understand why.

@nicopap nicopap merged commit 14bd139 into nicopap:pbr-parallax-mapping Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants