Blender Git Commit Log

Git Commits -> Revision 8c2a6f9

Revision 8c2a6f9 by Clément Foucault (master)
May 2, 2018, 18:49 (GMT)
Armature: "Raytrace" bones endpoint spheres.

Here is how it works:
We render a high poly disc that we orient & scale towards the camera so that
it covers the same pixel of the sphere it's supposed to represent.

Then the pixel shader raytrace the sphere (effectively starting from
the poly disc depth) and outputs the depth to gl_FragDepth.

This approach has many benefit:
- high quality obviously: per pixel accurate depth!
- compatible with MSAA: since the sphere horizon is delimited by polygons,
we get the coverage computed by the rasterizer. However we still gets
aliasing if the sphere intersect directly other meshes.
- virtually no overdraw: there is no backface to shade but we still get
overdraw because by little triangle [gpus rasterize pixel by groups of 4].
- allows early depth test: since the poly disc is set at the nearest depth
we can output, we can use GL_ARB_conservative_depth to enable early depth
test and discard pixels that are already behind geometry.
- can draw outline pretty easily without geometry shader.

Commit Details:

Full Hash: 8c2a6f957ada6cca4b870c094979f9c3e6d43fa7
Parent Commit: a56561d
Lines Changed: +380, -1

3 Added Paths:

/source/blender/draw/modes/shaders/armature_sphere_frag.glsl (+74, -0) (View)
/source/blender/draw/modes/shaders/armature_sphere_outline_vert.glsl (+102, -0) (View)
/source/blender/draw/modes/shaders/armature_sphere_vert.glsl (+79, -0) (View)

5 Modified Paths:

/source/blender/draw/CMakeLists.txt (+3, -0) (Diff)
/source/blender/draw/intern/draw_armature.c (+9, -1) (Diff)
/source/blender/draw/intern/draw_cache.c (+65, -0) (Diff)
/source/blender/draw/intern/draw_common.c (+46, -0) (Diff)
/source/blender/draw/intern/draw_common.h (+2, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021