Page MenuHome

Wireframe overlay clipping issues
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Linux-4.15.0-72-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: Quadro GP100/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.50

Blender Version
Broken: version: 2.82 (sub 6), branch: master, commit date: 2019-12-18 12:31, hash: rB409d3f48809c
Worked: 2.81

Short description of error
The wireframe drawing as an overlay is not negatively influenced by the clip start in the viewport.
When in Orthographic view the clipping of the wireframes will stay consistent but may be not ideal.
In past versions of Blender the wireframe clipping stayed consistent no matter the clip end/start settings.

Revisions and Commits

Related Objects

Mentioned Here
P1198 T72547

Event Timeline

Philipp Oeser (lichtwerk) lowered the priority of this task from 90 to 80.Dec 19 2019, 10:40 AM

@Jeroen Bakker (jbakker): will you take care of this?

@Philipp Oeser (lichtwerk), Yes I asked Julien to create this issue and assign it to me IRL.

Jeroen Bakker (jbakker) lowered the priority of this task from 80 to High.Dec 20 2019, 2:31 PM

Seems like when in orthographic mode the gl_position.z is negative.
Perspective mode

Orthographic mode

Seems like the vertex shader is shifting the lines a bit to the camera. but in case for orthographic this shift moves the lines to the other side of the camera making render on top of other lines.
I suppose that the wireframe_vert.glsl needs to be adjusted for this.

1diff --git a/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl b/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl
2index 21f8bcf1791..a124721362c 100644
3--- a/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl
4+++ b/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl
5@@ -120,7 +120,9 @@ void main()
6 gl_Position.xy += wofs.xy * sizeViewportInv.xy * gl_Position.w;
7
8 /* Push the vertex towards the camera. Helps a bit. */
9- gl_Position.z -= facing_ratio * curvature * 1e-4;
10+ if (is_persp) {
11+ gl_Position.z -= facing_ratio * curvature * 1e-4;
12+ }
13
14 /* Convert to screen position [0..sizeVp]. */
15 edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy;

helps but we might want to do a better curvation. Assigning to @Clément Foucault (fclem) if he has other ideas how to solve this?