Drop Shadows

Started by
3 comments, last by spiffgq 21 years, 2 months ago
My font engine is working rather well. But there is still one feature that I would like to add but I''m not sure of the best way to about it: drop shadows. The text looks too flat and doesn''t contrast well where there are lots of colors on the screen. What would be the best way to implement drop shadows? The methods I can think of are adding another polygon slightly offset from the polygon with the font (and then a 4th polygon for the drop shadow''s alpha mask) or somehow render it into the font texture. The latter seems like it would be more efficient, but I have no idea how to do that or if it can even be done. Ideas? Thanks for your help. (BTW: if it is relevant I’m using OpenGL).
SpiffGQ
Advertisement
Yeah do the later...

If your font map is split up in little suqres and you off set the texture coords... Then make your font texture larger to have more free slots, or if you have more free slots ad the fiont with drop shadow... and if you using tgas you can probably get a nice blended drop shadow....
quote:Original post by ANSI2000
Yeah do the later...

If your font map is split up in little suqres and you off set the texture coords... Then make your font texture larger to have more free slots, or if you have more free slots ad the fiont with drop shadow... and if you using tgas you can probably get a nice blended drop shadow....


The texture is generated during runtime, so I''m not using TGA files. The problem with the latter method (that I can foresee) is trying to color the letter. For example, how would I tell OpenGL to color one part of a texture using the current color and another part to texture black (for the shadow)?
SpiffGQ
Teh drop shadow is black so it wont show that color much...

You give the color of your font by using color on the vertices and then using blending, so the font inherits the color of the polygon... So the dark the pixel is the lesss you will see of that color though...

So create your font with FS, add the drop shadow, then creta an alpha maps also so you give the drop shadow nice soft edges, when it blends...

The other way will just double up on you polys... So unless you have a very heavy scene the method we discussed would be better... Also with having a precreated texture for your fonts allows for more flexebility in look and feel you can do alot more. Like for instance say you have a racing game, you cam make your fonts checkered or if you have a Mech Game you can make the font metalic with screws on the edges etc...
Another method.
As you create your font at runtime, Are you just using a system font? or actually creating the image?
In either case, you can first create your image of text all black, slightly offset (size of the drop shadow) then, once you''re text has been generated, generate AGAIN, using white text, and no offset. you have to make sure that you keep the alpha channel for BOTH of the font''s though.

Check out the FAKK2 SDK tools. They have a font creator tool in there.

Hope that helps.
~Main

==
Colt "MainRoach" McAnlis
Programmer
www.badheat.com/sinewave
==Colt "MainRoach" McAnlisGraphics Engineer - http://mainroach.blogspot.com

This topic is closed to new replies.

Advertisement