This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/draw/modes/shaders/armature_stick_frag.glsl
Clément Foucault 9a79178c2e Armature: Add back Stick bone draw type.
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.
2018-05-08 12:18:35 +02:00

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;
}