View Full Version : Render Text to texture


j_dexx
07 July 2006, 12:07 AM
Greetings. I've been expermenting with HLSL shaders, writing and testing them primarily with Nvidia's Fx Composer. My question is, does anyone have any idea how render text (a string of characters) to a texture? i'm not looking for a step-by-step guide, but any advice or thoughts would be appreciated.

I know how to do it in directx, and have looked at the example in the directx sdk, but i want to do it entirely within a shader. after searching around a bit, i have't found any info, so as far as i know, it may not even be possible..

Creating and applying textures to objects is no problem, its just the process of rendering text to an image.

dlarsson
07 July 2006, 03:00 PM
Rendering text in a shader is a quite difficult problem.
Take a look at http://research.microsoft.com/~cloop/LoopBlinn05.pdf (http://research.microsoft.com/%7Ecloop/LoopBlinn05.pdf) if you want to get some inspiration on this topic.

Nema
08 August 2006, 08:01 PM
probable one thing for such a shader would be to make a texture with all letters prerendered, and use it as a sampler in your shader.
but then, you would actually want to display text (words), and the only hack to pass strings to a shader would again be to abuse a texture (where different pixelcolors represent different letters). transforming strings to such a lookuptexture might be more difficult that just rendering the letters directly using D3DFont...

dlarsson
08 August 2006, 08:36 AM
Another interesting paper on this subject was published on siggraph last week.
Check out the paper "Perfect Spatial Hashing" on http://research.microsoft.com/~hoppe/ .
It shows a way of efficiently pack sparse data into textures and it shows some nice text renderings where it has packed vector data into the texture to render text.

CGTalk Moderation
08 August 2006, 08:36 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.


1