We now use a more pleasant and efficient way to display enveloppe bones and their radius. For this we use a capsule geometry that is displaced (in the vertex shader) to a signed distance field that represents the bone shape. The bone distance radius are now drawn in 3D using a "pseudo-fresnel" effect. This gives a better understanding of what is inside the radius of influence. When capsules are not needed, we switch to default raytraced points. The capsules are not distorded by the bone's matrix (same as their actual influence radius) and are correctly displayed even with complex scaled parents hierarchy.
16 lines
256 B
GLSL
16 lines
256 B
GLSL
|
|
flat in vec4 finalColor;
|
|
in vec3 normalView;
|
|
|
|
out vec4 fragColor;
|
|
|
|
void main()
|
|
{
|
|
float n = normalize(normalView).z;
|
|
n = gl_FrontFacing ? n : -n;
|
|
n = clamp(n, 0.0, 1.0);
|
|
n = gl_FrontFacing ? n : 1.0 - n;
|
|
fragColor = finalColor;
|
|
fragColor.rgb *= n;
|
|
}
|