Need Advice on using 3D Text in DX11

Started by
3 comments, last by GfxProgrammer 3 years, 3 months ago

Hi-

I am in the process of building a 3D chart, and hit a brick wall with text. I have been using Gnuplot for guidance, and when rendering a 3D chart with the axis labels its not clear to me if that uses 3D text or not. I have assumed it does, and I found this article from NeHe: https://nehe.gamedev.net/tutorial/outline_fonts/15004/.

I went through the code it looks like openGL supports fonts a lot differently to DX. I have a 2D font atlas file and load it up and map each char to a quad. It is kinda working, but the text is not clear and its too large. I have scaled the quads to be much smaller, but its tricky for me to know what to do next - how to calculate a location on an axis for example, once scaled.

I was thinking that I need to create some quads, texture map the font image on to it, and then position these quads on each axis. I also discovered the concept of billboarding, which sounds like something I would need to do so the text is always readable.

An alternative seems to be to have 2D text, and just find a way to plot it at the right location and scale depending on where the model is on the screen. But this seems a lot more complicated though I have not explored this deeply yet.

Would appreciate some guidance/tips from anyone who might be able to advise me. I have been stuck on this for a good while now; need some help.

Thank you,

sp.

Advertisement

seen this?:

https://learnopengl.com/In-Practice/Text-Rendering

enjoy ?

No! Thank you so much for this!

sp.

Hi-

I wanted to come back to this. I am struggling to get any examples working in DX11 of FreeType (examples in DX9 I found on stackoverflow). Before I start again with what I am doing, trying to get FreeType working, I want to ask the following question. Below is an image I created in gnuplot. I am creating a similar 3D chart - I have my chart working - but I am now trying to add the axis labels.

My approach and thinking is:

  1. Load a FreeType font data into memory
  2. Create the textures to hold each character in memory
  3. Create subsequent texture as a map of chars and put into a vertex buffer with a shader
  4. Figure out how to put the text into the view using billboarding

I dont know if this is the right approach. I originally thought that I could somehow workout how to map fro 3d space to 2d space, and then just simply write text out in 2d - I have got myself confused at this point; not sure which approach is correct.

Would welcome some advice on this.

Thanks,

sp.

This topic is closed to new replies.

Advertisement