#70267 Retopology Overlay #104599
|
@ -263,6 +263,8 @@ vec3 point_world_to_view(vec3 p)
|
|||
float get_homogenous_z_offset(float vs_z, float hs_w, float vs_offset)
|
||||
{
|
||||
if (ProjectionMatrix[3][3] == 0.0) {
|
||||
bonj marked this conversation as resolved
|
||||
/* Clamp offset to half of Z to avoid floating point precision errors. */
|
||||
vs_offset = min(vs_offset, vs_z * -0.5);
|
||||
/* From "Projection Matrix Tricks" by Eric Lengyel:
|
||||
bonj marked this conversation as resolved
Clément Foucault
commented
Remove the negative sign here and everywhere Remove the negative sign here and everywhere `get_homogenous_z_offset` is called.
The negative sign in the equation from the slide is inside `ProjectionMatrix[3][2]`.
Jorijn de Graaf
commented
Done and done. Done and done.
I negated it because then you can subtract from the Z, which is what other offsets in the shader do, but yeah it was unnecessary so now they just use += for this.
|
||||
* http://www.terathon.com/gdc07_lengyel.pdf (p. 24 Depth Modification) */
|
||||
return ProjectionMatrix[3][2] * (vs_offset / (vs_z * (vs_z + vs_offset))) * hs_w;
|
||||
|
|
Loading…
Reference in New Issue
Maybe also add a note that offset is in viewspace. So positive values are closer to camera.
Done, now each parameter has an explanation.