Viewport Project: Wireframes for Blender 2.8
Open, NormalPublic

Description

Wireframes for Blender 2.8

  1. Requirements:
    1. solve the issue T44505
    2. minimize passes: desirable 1
    3. several types of edge highlighting (with styles and colors); also, it should be possible to make no edge.
    4. support polygons with number of vertices > 3

Useful links:

nVidia implementation:
http://developer.download.nvidia.com/SDK/10/direct3d/Source/SolidWireframe/Doc/SolidWireframe.pdf

From the technique's original authors:
http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/4884/pdf/imm4884.pdf
http://www.imm.dtu.dk/~janba/Wireframe/Siggraph06.pdf

Easy wireframe display with barycentric coordinates
http://codeflow.org/entries/2012/aug/02/easy-wireframe-display-with-barycentric-coordinates/

Open questions:

  1. How can we highlight the edge (specify edge style, including no style)? We should somehow map vertex attributes to the edge. To solve this issue we should refuse the use of indexed geometry?
  2. Should we have a different approach to draw quads? Or just triangle case is sufficient?
  3. What changes for the mesh types are required?
  4. There are two points from the original authors of method.
    • The method does not support indexed geometry
    • Primitive/geometry shaders alleviate this!

Geometry shaders alleviate this only if we make simple wireframe with a one single style and with tessellated polygons. For general case it is still needs attributes per triangle (not indexed geometry on CPU side).

Details

Type
Design

To clarify the scope of this design task:

Wireframes overlaid / combined with surface rendering. Whether that surface is a solid color or full material shader. Rendering wireframes by themselves is much easier and does not suffer from issue #1.

I have an idea for applying this technique to n-gons (not just triangle meshes). From the GPU's perspective we're always rendering triangles but they're prepared and sent by the application to make the result look like a bordered arbitrary polygon. Will post once this has a working prototype -- or report that it didn't actually work :)

Totally forgot we had a task open for this! I implemented a solution and presented early results at the 2016 Blender Conference:
discussion of problem and demo of solution

My implementation solves requirements A, B and D. All face edges are treated the same, so C is not done.

Blender's internal Mesh types are unchanged. We generate a GPU Batch from the Mesh the first time an object is drawn, and cache that for later drawing.

@Clément Foucault (fclem) extended this work for the new Clay and Eevee viewport.

I think an acceptable solution to C is to generate a separate draw batch of a subset/list of edges. One pass per line style so we could:

  1. draw object surface
  2. draw object edges
  3. draw "special" edges (UV seams, sharp edges, etc.) in another color & thickness

The new technique uses the exact same depth values per pass, so the final color depends only on the order we draw.

Any more thoughts @Alexander Romanov (a.romanov)?

@Mike Erwin (merwin) special edges are already supported in the same pass. We have a flag attrib that is used to store some infos for these colors. Look at the relevant shader in the draw module.

@Mike Erwin (merwin): I have nothing to add. I think that new wireframes are awesome ))

{F1064379}On the attached image we see the distance on wireframe just like the link on the youtube presentation. I think it works. How would this method of wireframe would be called? (distance wireframe?).