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>
This commit is contained in:
parent
9d1df6ec32
commit
2542cb591d
3 changed files with 70 additions and 1 deletions
14
packages/ludic.render3d/shaders/outline.frag
Normal file
14
packages/ludic.render3d/shaders/outline.frag
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue