Dark Bit Factory & Gravity
PROGRAMMING => General coding questions => Topic started by: Raizor on June 24, 2011
-
I'm looking into a nice way to handle text in an an OpenGL intro/demo. I was wondering how the 3D text in something like the video below is done. Do you think this is a bitmap font that is converted into 3D objects or just some fancy 'render to texture' effect to make it look 3D?:
[youtube]http://www.youtube.com/watch?v=0bZbQH_1sj8[/youtube]
I'm referring mainly to the sine wave text that appears that looks something like a flag effect.
My plan for handling text is just to have a standard bitmap font (like the old Amiga ones) and a lookup list with the character sizes and positions. Is this still a sensible way to do things in this day and age? :)
Thanks for looking,
Raizor
-
I did love to help but I don't know much about Open Gl :(
sine wave text that appears that looks something like a flag effect.
Yes, it is Flag Effect :)
That 3D Text(that spin round in 3D) is somethings I would like to do in BlitzMax of Open Gl but it isnt easy to do.
-
Each letter is made using a textured quad, to see it, run the intro and press F3 and it will switch to debug mode.
-
Each letter is made using a textured quad, to see it, run the intro and press F3 and it will switch to debug mode.
Perfect rbz, thanks :)
-
I've been looking at this some more and trying to figure out how the blending for the char depth is done. Each textured quad is rendered seversl times behind the main quad to give the char depth. What I can't figure out is how the layed rear quads are drawn.
I've been playing around myself trying to mimic the effect but can't get the layered quads not to over saturate. It looks to me like it's using additive blending, but when I try this (using various GL_ONE blending modes) the layers get brighter and brighter as they're overlayed. I've also tried using depth test and sorting but still can't get my head around how it's done. How is the colour intesity limited?
If anyone can shed any light on this, I'd be most grateful.
-
Meaby try "screen" blending if it's available?
It gives a similarish effect to additive blending but less pronounced, not sure what it does exactly...
Using transparancy and/or darker colors can help to prevent additive blending becomming to bright to quickly as well.
I think you can get a long way using only transparancy though, it looks like only the front/top slice is drawn at full opacity.
I hope this makes sense for OpenGl as I'm not familair with it. :-\
-
Thanks Kirl.
I think the solution is something specifc to OpenGL, some kind of setting or mode that I'm not aware of or maybe some technique I haven't thought of.
-
The font is most probably a 1bit bitmap stored in a rgba texture, so all pixels are either (FF,FF,FF,FF) or (0,0,0,0).
This way you can control the color and the level of opacity separately (eg using glColor4f).
The blend mode is set to (GL_ONE, GL_ONE_MINUS_SRC_ALPHA).
The front layer seems to be drawn with almost full opacity (alpha=1) and the rear ones with lower alpha (0.5 or less) and darker color.
This way you're always attenuating the background and the colors never saturate.
If you set alpha to 0 you're back at additive blending (used to make the characters flash).
Keep in mind that you'll have to draw the layers back to front to make the blending work.
-
Hellfire, you're a star! Thank you :)
I already have my blend function set to GL_ONE / GL_ONE_MINUS_SRC_ALPHA but was specifying RGB values in the glColor4f call that were too high. If I take them down to around 0.05f, it works great.
K++