Blender V4.3
overlay_antialiasing.cc File Reference
#include "DRW_render.hh"
#include "ED_screen.hh"
#include "overlay_private.hh"

Go to the source code of this file.

Functions

void OVERLAY_antialiasing_init (OVERLAY_Data *vedata)
 
void OVERLAY_antialiasing_cache_init (OVERLAY_Data *vedata)
 
void OVERLAY_antialiasing_cache_finish (OVERLAY_Data *vedata)
 
void OVERLAY_antialiasing_start (OVERLAY_Data *vedata)
 
void OVERLAY_xray_depth_copy (OVERLAY_Data *vedata)
 
void OVERLAY_xray_depth_infront_copy (OVERLAY_Data *vedata)
 
void OVERLAY_xray_fade_draw (OVERLAY_Data *vedata)
 
void OVERLAY_antialiasing_end (OVERLAY_Data *vedata)
 

Detailed Description

Overlay antialiasing:

Most of the overlays are wires which causes a lot of flickering in motions due to aliasing problems.

Our goal is to have a technique that works with single sample per pixel to avoid extra cost of managing MSAA or additional texture buffers and jitters.

To solve this we use a simple and effective post-process AA. The technique goes like this:

  • During wireframe rendering, we output the line color, the line direction and the distance from the line for the pixel center.
  • Then, in a post process pass, for each pixels we gather all lines in a search area that could cover (even partially) the center pixel. We compute the coverage of each line and do a sorted alpha compositing of them.

This technique has one major shortcoming compared to MSAA:

  • It handles (initial) partial visibility poorly (because of single sample). This makes overlapping / crossing wires a bit too thin at their intersection. Wireframe meshes overlaid over solid meshes can have half of the edge missing due to z-fighting (this has workaround). Another manifestation of this, is flickering of really dense wireframe if using small line thickness (also has workaround).

The pros of this approach are many:

  • Works without geometry shader.
  • Can inflate line thickness.
  • Coverage is very close to perfect and can even be filtered (Blackman-Harris, gaussian).
  • Wires can "bleed" / overlap non-line objects since the filter is in screen-space.
  • Only uses one additional lightweight full-screen buffer (compared to MSAA/SMAA).
  • No convergence time (compared to TAA).

Definition in file overlay_antialiasing.cc.

Function Documentation

◆ OVERLAY_antialiasing_cache_finish()

◆ OVERLAY_antialiasing_cache_init()

◆ OVERLAY_antialiasing_end()

◆ OVERLAY_antialiasing_init()

◆ OVERLAY_antialiasing_start()

◆ OVERLAY_xray_depth_copy()

◆ OVERLAY_xray_depth_infront_copy()

◆ OVERLAY_xray_fade_draw()