[Bf-blender-cvs] [f3ea8cd6087] master: Overlay: Wireframe: Make facing ratio offset depends on gl_Position.w

Clément Foucault noreply at git.blender.org
Tue Mar 24 17:54:34 CET 2020


Commit: f3ea8cd60876e499b664e12eec24d163136c04ba
Author: Clément Foucault
Date:   Tue Mar 24 17:50:17 2020 +0100
Branches: master
https://developer.blender.org/rBf3ea8cd60876e499b664e12eec24d163136c04ba

Overlay: Wireframe: Make facing ratio offset depends on gl_Position.w

This makes the offset dependent of the actual near and far clip distances.

===================================================================

M	source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl

===================================================================

diff --git a/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl b/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl
index 1abac302cda..001c128e4ac 100644
--- a/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl
+++ b/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl
@@ -122,7 +122,7 @@ void main()
   gl_Position.xy += wofs.xy * sizeViewportInv.xy * gl_Position.w;
 
   /* Push the vertex towards the camera. Helps a bit. */
-  gl_Position.z -= facing_ratio * curvature * 4.0e-5;
+  gl_Position.z -= facing_ratio * curvature * 1.0e-5 * gl_Position.w;
 
   /* Convert to screen position [0..sizeVp]. */
   edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy;



More information about the Bf-blender-cvs mailing list