Game Development Community

Outer glow anyone

by J. Donavan Stanley · in Torque Game Engine · 05/30/2003 (2:19 am) · 9 replies

My design calls for selected objects in the game to show an outer glow type of effect, where the model is surrounded by a halo of a given color. However, as many of you know, I'm fairly clueless about OpenGL programming. Has anyone implemented someting like this before, or read about and implementation. If so can you point me to a website or book?

#1
05/30/2003 (5:30 am)
Do you mean a silhouette, or a shell over the model? It's hard to tell from your description.
#2
05/30/2003 (5:38 am)
I think he means like the objects in DS, when you mouse over they have that red outline. I think it is done with ShadowStencil (is that the correct term?)

-Ron
#3
05/30/2003 (5:42 am)
I have no idea what DS is, but I don't think the stencil buffer would be very appropriate for an outline effect.

EDIT: Bah, I take that back, some people apparently do use the stencil buffer for outlining. Still seems silly to me, though.
#4
05/30/2003 (6:39 am)
im using it to represent a scratch n win :)


you would easily get the effect of an outline using the stencil buffer,
but I would prolly try some blending tricks first.
#5
05/30/2003 (6:43 am)
DS = Dungeon Siege

-Ron
#6
05/30/2003 (6:56 am)
If we're talking about outlining, I'd use the backfacing trick for it instead. Set up a second vertex buffer, but push the vertexs out along their normals slightly. Render the first mesh, then the second with backface culling set to cull front faces instead of back faces.

If you have support for vertex programs on the client, you won't even need the second vertex buffer!

That way you don't have to require a hardware accelerated stencil buffer for the effect.

The stencil buffer technique (for comparison) involves rendering your model with stencil writes turned on, then rendering it again in lines mode with the linethickness set to twice the width of the outline that you would like. I don't like that one because it relies on the stencil buffer and lines sometimes aren't accelerated very well in OpenGL drivers.
#8
05/30/2003 (12:14 pm)
@Ron: That first example seems to be exactly the effect I was looking for, I'll try and pop it into torque later.

Edit: Well my first attempt at plugging it in had no effect. I really need to sit down and figure out GL rendering sometime.
#9
06/14/2003 (8:36 am)
Hmmm... seems like my cartoon outlining could handle this for you :) just gotta change some color3f or color4f thingies to be red/blue/green or whatever you want