Return to “Technical”

Freetype -> OpenGL - how? And what about postprocessing?

#1
This is another question probably best answered by Josh, but I'm interested in anybody's input if they have done this kind of thing before and understand the pros and cons of different methods.

Seeing as Freetype (I think?), given an input font, style options and a string of text, provides a set of vector outputs for you to do with as you will, I'm wondering what the story looks like in LT regarding the final output as glowy text on screen.

#1. Are the output vectors being translated into a 2D set of triangles and loaded into OpenGL and rendered with a single colour? Or do they get rendered to a texture first using the CPU? (Or the GPU?), with the resultant texture being loaded into OpenGL to be rendered onto a quad?

#2. And once that happens, where does that nice glow come from? Is everything being rendered by the GPU to a texture on the GPU, then having that texture rendered back onto the final scene, with a shader applying the glow to that texture?

#3. The nice grainy effect, along with the analog signal noise degradation that is applied periodically, is that just something applied to the whole scene after the fact? If so, I'm guessing this means that the whole scene is rendered to a texture so it can be post-processed and rendered out to the backbuffer as a texture on a quad?

Very curious about all of this, given that it's an area I've started learning. He who asks questions learns faster :)
I'm learning game programming and blogging about my progress: http://nathanridley.com

Re: Freetype -> OpenGL - how? And what about postprocessing?

#4
axefrog wrote:#1. Are the output vectors being translated into a 2D set of triangles and loaded into OpenGL and rendered with a single colour? Or do they get rendered to a texture first using the CPU? (Or the GPU?), with the resultant texture being loaded into OpenGL to be rendered onto a quad?

#2. And once that happens, where does that nice glow come from? Is everything being rendered by the GPU to a texture on the GPU, then having that texture rendered back onto the final scene, with a shader applying the glow to that texture?

#3. The nice grainy effect, along with the analog signal noise degradation that is applied periodically, is that just something applied to the whole scene after the fact? If so, I'm guessing this means that the whole scene is rendered to a texture so it can be post-processed and rendered out to the backbuffer as a texture on a quad?

Very curious about all of this, given that it's an area I've started learning. He who asks questions learns faster :)
Needed a break from code so...I'll answer a question about code instead :roll: :monkey:

1. FT outputs a bitmap (grayscale or monochrome), not vectors. Typically you then take that bitmap and copy it into one or more 'atlas' textures that live on the GPU. An 'atlas' just means you are putting many glyphs on the same texture (much more efficient than having a different, small texture for each glyph). In the case of LT engine I first compute a distance field, so the atlas is the glyph distance fields, not just the glyphs.

2. In the special case of rendering distance fields, we can get a really nice glow for free. For a distance field, 'glow' just means take your favorite falloff function and apply it to the field, e.g. exp(-distance). All of the UI elements are rendered as distance fields, so the UI glow is all computed in this manner (in the pixel shader). The 3D world render, on the other hand, uses traditional post-processing for glow.

3. Yes, this is a post-effect applied to the UI layer. What you see on-screen is the compositing of any number of UI layers, each of which is rendered to a texture and has post-effects applied before finally being composited onto the backbuffer. In the game, for example, there is one layer for the 3D rendered world and one layer for the UI.
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford

Online Now

Users browsing this forum: No registered users and 3 guests

cron