ludic/packages/ludic.render3d/shaders/outline.frag
Orkuncakilkaya 2542cb591d feat(render3d): a rim outline around a highlighted actor
An actor gains `outline` (metres of rim) and `ocol` (its colour). The pass draws
the model a second time with its vertices pushed out along their normals and its
front faces culled, so only the far side of the swollen shell survives - a
silhouette exactly `outline` metres wide. It is depth-tested against the scene,
so anything standing in front of the actor hides the rim too.

skin.vert grows an OUTLINE path for the push; outline.frag is the flat-colour
fragment shader it pairs with.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 16:15:12 +03:00

14 lines
423 B
GLSL

// the inverted-hull shell (skin.vert with OUTLINE): a flat colour, no shading. Cut-out
// meshes still need their shape, so the alpha test comes along.
uniform vec3 u_outline_col;
out vec4 o_color;
#ifdef ALPHA_TEST
in vec2 v_uv;
uniform sampler2D u_diff;
void main() {
if (texture(u_diff, v_uv).a < 0.45) discard;
o_color = vec4(u_outline_col, 1.0);
}
#else
void main() { o_color = vec4(u_outline_col, 1.0); }
#endif