Highlighting outline of object

Basically the title. 2 ways I think can be used to approach this: 1. overlapping a duplicate of the object to the object with a texture mostly transparent but the outline 2. changing texture of the object.

I’m leaning towards #1 because there would be one object highlighted at a time and object being highlighted will be changed in quick succession. Also all the object will have the same outline.


Are the objects in question three-dimensional? And if so, is the player able to see them from multiple angles?

If so, I know of three good options offhand:

The first option is to simply use the “CommonFilters” module, which includes a “Cartoon Ink” shader.

The second option is to duplicate the object, scale it up a bit (or better yet, expand its vertices in the direction of their normals), then render it inside out (by flipping its “winding order”, likely done by applying a CullFaceAttrib.). You may want to colourise it somewhat in one way or another, depending on your purposes–for a black outline, simply setting its colour-scale to zero (aside from the alpha-value) should do it in most cases, I think.

The third option is to use a custom shader. There are a few ways that such a feature might be implemented in a shader; one method is shown in the “advanced” “cartoon-shader” sample-application, I believe.