About Store Forum Documentation Contact
Donations:
178$/mo



Post Reply 
how to draw 3D text?
Author Message
Antony Offline
Member

Post: #1
how to draw 3D text?
Hi,

Searched forum and looked through tutorials, but cannot see how to draw or render text 3D (not 2D). For example, text like a billboard.

Any help appreciated.
(This post was last modified: 03-08-2011 09:04 PM by Antony.)
03-08-2011 08:59 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #2
RE: how to draw 3D text?
The best option is to create it in a 3d program like 3D max/Blender etc. Or if its just a simple billboard i would texture it wink

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 03-09-2011 08:12 AM by Dynad.)
03-08-2011 09:13 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Antony Offline
Member

Post: #3
RE: how to draw 3D text?
Thanks, Dynad.

It's for numbers that change during the game on a scoreboard (3d plane). From what you are saying, texturing it might be easiest. To do that, do I make a plane, then assign a material, and use a font image which I update as score changes? I have planes with materials rendered to them, but when I looked at materials.h, I couldn't see how I can assign a font as the material image...
03-08-2011 09:23 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #4
RE: how to draw 3D text?
Well like you said its a scoreboard you got the numbers 0-9. If u make a texture for all numbers you can apply the material on the mesh.

small snippet:
PHP Code:
void setTexNumber(int n)
{
numberMat.reset();                                         // setup defaults
numberMat.base_0.require(S+"../data/Gfx/numbers/"+n+".gfx"); // set diffuse texture
numberMat.validate();       
}

mesh->parts[0].setMaterial(numberMat).draw(MatrixIdentity); 

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 03-09-2011 08:24 AM by Dynad.)
03-09-2011 08:23 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Antony Offline
Member

Post: #5
RE: how to draw 3D text?
Thanks for your help, Dynad.

As an alternative to multiple .gfx files, I used a single .gfx file with numbers 0-9 vertically (png created in photoshop), and update numbers by changing the UV coords dynamically with <MeshPart>.texMove(Vec2). For numbers with greater than one digit, I created different mesh parts and stacked them side by side. Somewhat cumbersome, especially when I have to add in comma's for thousands and decimal point, but it does work.

Although this works, do you or Esenthel think there might be an easier way to dynamically render words/short sentence text (not just a couple of digits) to a mesh surface? Because preparing each letter, upper case, lower case and symbols, each as .gfx files (or even the full alphabet as one large .gfx file and altering UV coords), creating a mesh part for every letter, then stacking each side by side with another letter, parsing the text to call functions for each letter(UV coords), and including kerning assuming proportional font...seems a lot of work, and I scratch my head and think I'd be reinventing the wheel?

I checked out the Font Make.cpp tutorial, but that describes how to make a .font file, which appears only to be of use to 2D text functions.
(This post was last modified: 03-10-2011 10:17 PM by Antony.)
03-10-2011 03:55 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #6
RE: how to draw 3D text?
EsenthelEngineSDK\Tutorials\Source\Advanced\2 - Animation, Physics, Rendering\Rendering\31 - Render To Texture.cpp
03-11-2011 08:19 AM
Find all posts by this user Quote this message in a reply
Post Reply