Openggl Freetype Font Normals


habib15

Still Fresh
Joined
Mar 17, 2008
Messages
47
Hello all you Programming gurus,

I got my display engine to create texture mapped fonts from freetype libraries. Now I want to know if there is a good way to generate normal maps for these fonts on the fly. It has to be on the fly because I want to be able to make 3D looking text from any truetype font.

Any good ideas?

Thanks

Kevin
 
Hi!

I just registered only to reply ;)

If you have got your Font as a texture like that (http://cone3d.gamedev.net/cone3d/gfxsdl/tut4-2.gif), you could simply filter it with a gauss-filter. The result will be something like a grayscale bumpmap. I don't know the format of your normal maps, but you could easily calculate a normalmap from that bumpmap by some kind of a nabla-operator (derivatives of the bumpmap).
Thats it, smooth round-edged shiny fonts.

Gauss 3x3:

1 2 1
2 4 2 * 1/16
1 2 1

Gauss 5x5:

2 7 12 7 2
7 31 52 31 7
15 52 127 52 15 * 1/423
7 31 52 31 7
2 7 12 7 2

I would do it that way, don't know if would look nice.
 
what do you mean by '3d looking text'?

if that's plain bevelled look for the glyphs, then that should be simple - just treat your texure map as a hight map (say, based on luma) and compute local normals at each texel. from there on vanilla bump mapping should do.

if you mean actual 3d text (as in lofted), then no normal map can help you there, unless you're after a parallax mapping look (i personally am not a fan of that).

but if you have access to a GLSL platform, then you can use your glyphs map on a mesh for some displacement mapping - aka vertex texturing - should give you an actual 3d look, subject to your mesh density constrains.
 
QUOTE
just treat your texure map as a hight map

Like I said, I would make them a bit smooth. Bumpmaps with hard edges will look like crap.
 
darkblu said:
what do you mean by '3d looking text'?

if that's plain bevelled look for the glyphs, then that should be simple - just treat your texure map as a hight map (say, based on luma) and compute local normals at each texel. from there on vanilla bump mapping should do.

if you mean actual 3d text (as in lofted), then no normal map can help you there, unless you're after a parallax mapping look (i personally am not a fan of that).

but if you have access to a GLSL platform, then you can use your glyphs map on a mesh for some displacement mapping - aka vertex texturing - should give you an actual 3d look, subject to your mesh density constrains.
Wow I'm new to 3D concepts, I had to wiki almost everything in your post to make sure I new what you were talking about. :D

Basically I'm looking for an extruded text kinda look. I thought maybe I could fake it with normal mapping, but maybe not. I'm working on the TI mistral Omap board so it supports OGLES 2.0. (I finally got something to display.. but thats a different story)

That vertex texturing sounds kinda like what I want, but I'm a little confused on how I should texture the new mesh so the non font areas would be alpha out.
 
Last edited by a moderator:
QUOTE
That vertex texturing sounds kinda like what I want, but I'm a little confused on how I should texture the new mesh so the non font areas would be alpha out.


that should be simple - just re-use the same text/glyph texture in your fragment shader to mask out the non-glyph regions. basically, apply alpha-masking in the pixel phase.


Whynodd said:
Like I said, I would make them a bit smooth. Bumpmaps with hard edges will look like crap.
agreed. but i was trying to figure out OP's actual goal before getting into details about any of the techniques.
 
Last edited by a moderator:
Back
Top