The actual code is a bit convoluted but allows good and "pseudo efficient" drawing. (pseudo efficient because rendering instances with that amount of vertices is really inneficient. We should go full procedural but need to have bufferTexture implemented first) But drawing speed is not a bottleneck here and it's already a million time less crappy than the old (2.79) immediate mode method. Instead of drawing actual wires with different width we render a triangle fan batch (containing 3 fans: bone, head, tail) which is then oriented in screen space to the bone direction. We then interpolate a float value accross vertices giving us a nice blend factor to blend the colors and gives us really smooth interpolation inside the bone. The outside edge still being geometry will be antialiased by MSAA if enabled.
14 lines
264 B
GLSL
14 lines
264 B
GLSL
|
|
noperspective in float colorFac;
|
|
flat in vec4 finalWireColor;
|
|
flat in vec4 finalInnerColor;
|
|
|
|
out vec4 fragColor;
|
|
|
|
void main()
|
|
{
|
|
float fac = smoothstep(1.0, 0.2, colorFac);
|
|
fragColor.rgb = mix(finalInnerColor.rgb, finalWireColor.rgb, fac);
|
|
fragColor.a = 1.0;
|
|
}
|