Eevee: Wireframe: Increase precision a bit

Take the full derivative and compute its length instead of using fwidth.
This commit is contained in:
Clément Foucault 2018-11-06 20:52:06 +01:00
parent c3a0af736a
commit 1fe561e662
1 changed files with 4 additions and 1 deletions

View File

@ -1445,7 +1445,10 @@ void node_wireframe_screenspace(float size, vec2 barycentric, out float fac)
barys.z = 1.0 - barycentric.x - barycentric.y;
size *= (1.0 / 3.0);
vec3 deltas = fwidth(barys);
vec3 dx = dFdx(barys);
vec3 dy = dFdy(barys);
vec3 deltas = sqrt(dx * dx + dy * dy);
vec3 s = step(-deltas * size, -barys);
fac = max(s.x, max(s.y, s.z));