diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-12-07 07:03:01 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-12-07 07:33:53 +0300 |
commit | e929cad7067875bb2f1815a01daae32e441f99b7 (patch) | |
tree | e20a4173feb9ebef5b217f4234a6f7d9866a3d6b /source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl | |
parent | 9f5a27c5be0a0f6a9f36360e618dcf5254ae689e (diff) |
DRW: Rework wireframe overlay implementation
The shader is way simpler and run way faster on lower end hardware
(2x faster on intel HD5000) but did not notice any improvement on AMD Vega.
This also adds a few changes to the way the wireframes are drawn:
- the slider is more linearly progressive.
- optimize display shows all wires and progressively decrease "inner" wires
intensity. This is subject to change in the future.
- text/surface/metaballs support is pretty rough. More work needs to be done.
This remove the optimization introduced in f1975a46390a5bf85bb7012375f9bc1e761fc516.
This also removes the GPU side "sharpness" calculation which means that
animated meshes with wireframe display will update slower.
The CPU sharpness calculation has still room for optimization. Also
it is not excluded that GPU calculation can be added back as a
separate preprocessing pass (saving the computation result [compute or
feedback]).
The goal here was to have more speed for static objects and remove
the dependency of having buffer textures with triangle count. This is
preparation work for multithreading the whole DRW manager.
Diffstat (limited to 'source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl')
-rw-r--r-- | source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl b/source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl index 69af4858a48..cefd4eab2e3 100644 --- a/source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl +++ b/source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl @@ -1,18 +1,12 @@ -#ifndef SELECT_EDGES uniform vec3 wireColor; uniform vec3 rimColor; in float facing; in vec3 barycentric; - -# ifdef LIGHT_EDGES flat in vec3 edgeSharpness; -# endif out vec4 fragColor; -#endif -float min_v3(vec3 v) { return min(v.x, min(v.y, v.z)); } float max_v3(vec3 v) { return max(v.x, max(v.y, v.z)); } /* In pixels */ @@ -25,7 +19,6 @@ const float rim_alpha = 0.75; void main() { -#ifndef SELECT_EDGES vec3 dx = dFdx(barycentric); vec3 dy = dFdy(barycentric); vec3 d = vec3( @@ -35,11 +28,7 @@ void main() ); vec3 dist_to_edge = barycentric / d; -# ifdef LIGHT_EDGES vec3 fac = abs(dist_to_edge); -# else - float fac = min_v3(abs(dist_to_edge)); -# endif fac = smoothstep(wireSize + wire_smooth, wireSize, fac); @@ -48,10 +37,5 @@ void main() vec3 final_front_col = mix(rimColor, wireColor, 0.05); fragColor = mix(vec4(rimColor, rim_alpha), vec4(final_front_col, front_alpha), facing_clamped); -# ifdef LIGHT_EDGES fragColor.a *= max_v3(fac * edgeSharpness); -# else - fragColor.a *= fac; -# endif -#endif } |