Jump to content

  • Log In with Google      Sign In   
  • Create Account

Best way to render text with DirectX11


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
13 replies to this topic

#1 N.I.B.   Members   -  Reputation: 1213

Like
0Likes
Like

Posted 19 August 2014 - 11:46 PM

So, there's a bunch of methods for text rendering with DX11. The ones I know of are:

  1. Sprite rendering. Pretty straightforward and well-known. Only con I see is the dynamic VB calculation each draw.
  2. Use D2D. You get a simple, HW accelerated API, but on Win7 means another DX10.1 device, sharing the BB, synchronizing, which basically takes the simple API and wraps it with not so nice looking code. Not sure if it has real performance gain over sprites.
  3. Use GDI+ to render text directly to the back-buffer. I assume performance will be bad, though I haven't tried it.

 

In terms of performance and code complexity, which one is better?

Is there another option I'm unaware of?

 

(And MS, why did you leave D2D/D3D11 interop out of Win7!?!?)



Sponsor:

#2 tonemgub   Members   -  Reputation: 1164

Like
0Likes
Like

Posted 20 August 2014 - 12:27 AM


In terms of performance and code complexity, which one is better?

Is there another option I'm unaware of?


Sprite rendering. Pretty straightforward and well-known. Only con I see is the dynamic VB calculation each draw.


(And MS, why did you leave D2D/D3D11 interop out of Win7!?!?)

Because Windows 8.



#3 Vladimir128   Members   -  Reputation: 201

Like
0Likes
Like

Posted 20 August 2014 - 02:41 AM

Calculation of VB each draw is probably not really neccessary. Because you can add something like "dirty" flag, and calculate buffer only if text was changed



#4 Buckeye   Crossbones+   -  Reputation: 6398

Like
5Likes
Like

Posted 20 August 2014 - 06:58 AM

A sprite-batched text option is the DirectX Toolkit. The MakeFont utility supports creating font files from installed fonts.


Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.


#5 unbird   Crossbones+   -  Reputation: 6021

Like
4Likes
Like

Posted 20 August 2014 - 09:38 AM

Alternatively FW1FontWrapper by Erik Rufelt.

#6 N.I.B.   Members   -  Reputation: 1213

Like
0Likes
Like

Posted 20 August 2014 - 09:41 AM

Thanks for the answers guys. I already know about all those stuff, and my framework implements the sprite-batch approach.

 

I was just wondering if someone got the chance to try other approaches and share his experience with - in regards to performance and code complexity.



#7 JohnnyCode   Members   -  Reputation: 329

Like
0Likes
Like

Posted 20 August 2014 - 09:55 AM

 

 

I was just wondering if someone got the chance to try other approaches and share his experience with - in regards to performance and code complexity.

I render every glyph as a quad of 2 triangles, sampling glyph texture with no filtering, calibrating perfect fit as per pixel. If you happen to have a resolution of 8000x4000, you will see outputed glyph very small, needing binocular scaler. But- in a good quality. I cannot help myself in this manner. Vertex glyphs are off of me, nor vertex font definitions fractals



#8 Erik Rufelt   Crossbones+   -  Reputation: 3643

Like
2Likes
Like

Posted 20 August 2014 - 10:31 AM


(And MS, why did you leave D2D/D3D11 interop out of Win7!?!?)

 

Didn't they fix this in the platform update a year ago?

I'm reasonably sure... but Google doesn't give me any clear answer right now... 11.1 device (at any feature level).

 

 

You can combine sprite-sheets with signed distance fields for pretty good quality in magnified and 3D transformed text.

 

There was a thread recently which links to a pretty cool method: http://www.gamedev.net/topic/659230-font-rendering/



#9 MJP   Moderators   -  Reputation: 11790

Like
0Likes
Like

Posted 20 August 2014 - 06:38 PM

 


(And MS, why did you leave D2D/D3D11 interop out of Win7!?!?)

 

Didn't they fix this in the platform update a year ago?

I'm reasonably sure... but Google doesn't give me any clear answer right now... 11.1 device (at any feature level).

 

 

You can combine sprite-sheets with signed distance fields for pretty good quality in magnified and 3D transformed text.

 

There was a thread recently which links to a pretty cool method: http://www.gamedev.net/topic/659230-font-rendering/

 

 

Yes, I'm pretty sure that the Win7 platform update added D3D11 support for D2D and DirectWrite (although I haven't personally tried doing the interop).



#10 N.I.B.   Members   -  Reputation: 1213

Like
0Likes
Like

Posted 21 August 2014 - 12:36 AM

Yes, I'm pretty sure that the Win7 platform update added D3D11 support for D2D and DirectWrite (although I haven't personally tried doing the interop).


Great, I'll give it a try.

#11 BlackJoker   Members   -  Reputation: 559

Like
2Likes
Like

Posted 21 August 2014 - 08:55 AM

I am cofirm that Win 7 support D2D with D3D11 now, because I implement this feature in my engine more than a year ago.



#12 N.I.B.   Members   -  Reputation: 1213

Like
0Likes
Like

Posted 21 August 2014 - 09:31 AM

I am cofirm that Win 7 support D2D with D3D11 now, because I implement this feature in my engine more than a year ago.

Cool. Any performance impact vs. the sprites method?

#13 BlackJoker   Members   -  Reputation: 559

Like
0Likes
Like

Posted 22 August 2014 - 12:14 AM

 

I am cofirm that Win 7 support D2D with D3D11 now, because I implement this feature in my engine more than a year ago.

Cool. Any performance impact vs. the sprites method?

 

 

I didnt try sprite font as I thinhk this is unacceptable in 2014. But I cant see any performance problems.



#14 N.I.B.   Members   -  Reputation: 1213

Like
0Likes
Like

Posted 26 August 2014 - 02:39 AM

Well, after trying D2D, I like sprites better, mainly due to design issues caused by the D2D approach:

  • For each 3D render-target I want to render text into, I need a matching a D2D render target. Need to track this dependencies. Also, when do we create the D2D RT - on use? on create? When do we destroy?
  • This also complicates some events - device lost, window resize, etc.
  • To create/destroy those D2D RTs, I need a wrapper around the D2D object.

 

Not saying those issues can't be solved, but I think that design-wise - sprites are better, since they fit more naturally into the system.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS