Viewport: edge drawing artefacts (hidden edges are partially visible) #66008

Closed
opened 2019-06-22 00:46:39 +02:00 by artem ivanov · 7 comments

System Information
Operating system: Windows 10
Graphics card: GeForce GTX 1070

Blender Version
Broken: version: 2.80, branch: master, commit date: 2019-06-19 18:29, hash: d30f72dfd8

Short description of error
About 1.5-2px of the hidden edges are drawn in the viewport under certain angles (see screenshots below).
This artefact is more noticeable if "viewport rendered" with 400% scale (properties -> output panel -> dimensions -> %).
Interface resolution scale and viewport anti-aliasing settings have no effect on this issue.
This bug is not specific to the attached .blend and can be reproduced on my side with pretty much any geometry.

With default View -> Focal Length = 50mm it is slightly noticeable, but with Focal Length = 250mm it is clearly visible.

image.png image.png image.png image.png image.png edge_draw_bug.blend

**System Information** Operating system: Windows 10 Graphics card: GeForce GTX 1070 **Blender Version** Broken: version: 2.80, branch: master, commit date: 2019-06-19 18:29, hash: `d30f72dfd8` **Short description of error** About 1.5-2px of the hidden edges are drawn in the viewport under certain angles (see screenshots below). This artefact is more noticeable if "viewport rendered" with 400% scale (properties -> output panel -> dimensions -> %). Interface resolution scale and viewport anti-aliasing settings have no effect on this issue. This bug is not specific to the attached .blend and can be reproduced on my side with pretty much any geometry. With default View -> Focal Length = 50mm it is slightly noticeable, but with Focal Length = 250mm it is clearly visible. ![image.png](https://archive.blender.org/developer/F7443533/image.png) ![image.png](https://archive.blender.org/developer/F7443590/image.png) ![image.png](https://archive.blender.org/developer/F7443592/image.png) ![image.png](https://archive.blender.org/developer/F7443257/image.png) ![image.png](https://archive.blender.org/developer/F7443266/image.png) [edge_draw_bug.blend](https://archive.blender.org/developer/F7443602/edge_draw_bug.blend)
Author

Added subscriber: @ixd

Added subscriber: @ixd
Author

Possible fix: tweaking zoffset value for edges. But there is a tradeoff: the lower the zoffset, the higher the zfighting.
But on the screenshot below (Focal Len 250mm) zfighting artifacts of zoffset = 0.51f is almost the same as with the default 1.0.
image.png

With zoffset <= 0.6f and View -> Focal Length = 50 (default) edge artifacts are disappeared for me. Edit: this works only for 90+deg lines. Smaller angles (more complex geometry) require smaller zoffset values => more zfighting.

P1010: #66008: possible fix

diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c
index eca60c291fe..d6b6f2ca7f9 100644
--- a/source/blender/draw/modes/edit_mesh_mode.c
+++ b/source/blender/draw/modes/edit_mesh_mode.c
@@ -332,7 +332,7 @@ static void EDIT_MESH_engine_init(void *vedata)
     /* Create view with depth offset */
     stl->g_data->view_faces = (DRWView *)DRW_view_default_get();
     stl->g_data->view_faces_cage = DRW_view_create_with_zoffset(draw_ctx->rv3d, 0.5f);
-    stl->g_data->view_edges = DRW_view_create_with_zoffset(draw_ctx->rv3d, 1.0f);
+    stl->g_data->view_edges = DRW_view_create_with_zoffset(draw_ctx->rv3d, 0.6f);
     stl->g_data->view_verts = DRW_view_create_with_zoffset(draw_ctx->rv3d, 1.5f);
   }
 }

zfighting was tested with this file:
edge_draw_bug_ztest.blend

Edit: Added another case: small angles
image.png

Possible fix: tweaking zoffset value for edges. But there is a tradeoff: the lower the zoffset, the higher the zfighting. But on the screenshot below (Focal Len 250mm) zfighting artifacts of `zoffset = 0.51f` is almost the same as with the default 1.0. ![image.png](https://archive.blender.org/developer/F7443916/image.png) With `zoffset <= 0.6f` and View -> Focal Length = 50 (default) edge artifacts are disappeared for me. *Edit: this works only for 90+deg lines. Smaller angles (more complex geometry) require smaller zoffset values => more zfighting.* [P1010: #66008: possible fix](https://archive.blender.org/developer/P1010.txt) ```diff diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c index eca60c291fe..d6b6f2ca7f9 100644 --- a/source/blender/draw/modes/edit_mesh_mode.c +++ b/source/blender/draw/modes/edit_mesh_mode.c @@ -332,7 +332,7 @@ static void EDIT_MESH_engine_init(void *vedata) /* Create view with depth offset */ stl->g_data->view_faces = (DRWView *)DRW_view_default_get(); stl->g_data->view_faces_cage = DRW_view_create_with_zoffset(draw_ctx->rv3d, 0.5f); - stl->g_data->view_edges = DRW_view_create_with_zoffset(draw_ctx->rv3d, 1.0f); + stl->g_data->view_edges = DRW_view_create_with_zoffset(draw_ctx->rv3d, 0.6f); stl->g_data->view_verts = DRW_view_create_with_zoffset(draw_ctx->rv3d, 1.5f); } } ``` zfighting was tested with this file: [edge_draw_bug_ztest.blend](https://archive.blender.org/developer/F7443925/edge_draw_bug_ztest.blend) *Edit: Added another case: small angles* ![image.png](https://archive.blender.org/developer/F7445506/image.png)

Added subscribers: @fclem, @ZedDB

Added subscribers: @fclem, @ZedDB
Clément Foucault was assigned by Sebastian Parborg 2019-06-24 11:33:54 +02:00

@fclem any input on this?

@fclem any input on this?

The issue was present in 2.79. But the issue seems to have double in proportion. I don't know why exactly because we use the same function for the bias.

The issue was present in 2.79. But the issue seems to have double in proportion. I don't know why exactly because we use the same function for the bias.

This issue was referenced by 7767e080a0

This issue was referenced by 7767e080a03174d0538444a82d3d7baf72d7b843

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#66008
No description provided.