#70267 Retopology Overlay #104599

Merged
Clément Foucault merged 30 commits from bonj/blender:retopology-overlay into main 2023-03-03 00:35:56 +01:00
1 changed files with 2 additions and 0 deletions
Showing only changes of commit 2e92bcdae6 - Show all commits

View File

@ -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

Maybe also add a note that offset is in viewspace. So positive values are closer to camera.

Maybe also add a note that offset is in viewspace. So positive values are closer to camera.
Review

Done, now each parameter has an explanation.

Done, now each parameter has an explanation.
/* 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

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].

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]`.
Review

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.

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;