🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

[BMFont] Dropshadow effect possible with Pixel Shader alone?

Started by
2 comments, last by ehmdjii 3 years ago

Hello,

I would like to add a dropshadow effects to my fonts. Now the obvious way is to render the glyphs with an offset in black before the actual glyphs are rendered. But as soon as transparency comes in the effect gets ugly because the whole shadow glyph can be seen through the actual glyph.

So I was wondering if there is a “trick” to get a dropshadow effect without this “double-painting"? Maybe something can be done in the pixelshader?

Thanks!

Advertisement

To do this properly you need to render the glyphs to a texture to form the text first, and then render that texture to the display while applying the transparency as desired.

Although a bit more complex than rendering the glyphs directly to the display this has a couple of additional benefits:

1. You will be able to apply more complex effects on the font that can handle cases where glyphs overlap without any problem (e.g. blurring)
2. You can get a performance benefit by keeping the texture with the text between frames so it doesn't have to be rendered anew each frame

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Thanks! Goode idea, ill get to the implementing right away!

This topic is closed to new replies.

Advertisement