in traceScreenSpaceRay, i think dQ.z = 0, iterator Q.z += dQ.z is meaningless at all
- Dominant language
- C++
- Stars
- 20.5k
- Forks
- 2.3k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 74
Description
in shaders/src/surface_light_reflection.fs, line 60, function traceScreenSpaceRay
// Project into screen space
highp vec4 H0 = mulMat4x4Float3(uvFromViewMatrix, vsOrigin);
highp vec4 H1 = mulMat4x4Float3(uvFromViewMatrix, vsEndPoint);
// There are a lot of divisions by w that can be turned into multiplications at some minor
// precision loss...and we need to interpolate these 1/w values anyway.
//
// Because the caller was required to clip to the near plane, this homogeneous division
// (projecting from 4D to 2D) is guaranteed to succeed.
highp float k0 = 1.0 / H0.w;
highp float k1 = 1.0 / H1.w;
// Switch the original points to values that interpolate linearly in 2D
highp vec3 Q0 = vsOrigin * k0;
highp vec3 Q1 = vsEndPoint * k1;
// Screen-space endpoints
highp vec2 P0 = H0.xy * k0;
highp vec2 P1 = H1.xy * k1;
here, k0 = -1/vsOrigin.z, and Q0.z = -1, and Q1.z = -1 too.
// Track the derivatives of Q and k
highp vec3 dQ = (Q1 - Q0) * invdx;
highp float dk = (k1 - k0) * invdx;
so dQ.z = 0 too.
so line 150, in for loop iterator, what does Q.z += dQ.z do?
btw, github.com's reference in a new issues can't work now...
Contributor guide
Assessment
This issue has not been assessed yet.