Sign in to follow this  
bobbyn

[.net] Dynamic rotating text in Managed DirectX

Recommended Posts

Hi, seems I have found a problem that was not discussed entirely. I want to add text to my application, but I want to display in in world space not in screen coordinates. I have tried a few things, but they didnt really work out. 1. I used a sprite with the Font.DrawText method and applied the SpriteFlags.ObjectSpace. As I understand, this should produce a texture and display the sprite with it. It works like it should, but the sprite is so extremly big that I need to shrink it again which messes up my world transformations. 2. I rendered the text directly to a texture using SetRenderTarget and put it on some polygons. This also worked, but again something with the size was wrong so the text looks blurry. What is wrong? Daniel

Share this post


Link to post
Share on other sites
Quote:
1. I used a sprite with the Font.DrawText method and applied the SpriteFlags.ObjectSpace. As I understand, this should produce a texture and display the sprite with it. It works like it should, but the sprite is so extremly big that I need to shrink it again which messes up my world transformations.


From what I can tell, you understood it correctly [smile] Is it such a big deal to set up a seperate matrix for the sprite's world transform though? You could keep the original world matrix around and just use someScaleMatrix * worldMatrix to set on the sprite.

Quote:
2. I rendered the text directly to a texture using SetRenderTarget and put it on some polygons. This also worked, but again something with the size was wrong so the text looks blurry.


This would be the approach I'd pick, so you have all your world objects textured as usual and don't need to consider objects with text as a special case. However, you'll indeed run into *some* issues with the texts readability, I'm afraid there's no cure-all way around that. Some things to check would be:


  1. First off, isn't the texture entirely to big for the game object you're putting it on? A huge texture with a page-long text on a distant signpost is bound to look blurry, no matter how you set up everything else.

  2. Do you (re)generate MIP levels on the texture after the render-to-texture pass? These offline generated MIP levels can often make distant textures actually look more detailed.

  3. Are you using a square texture? If not, setting up anisotropic texture filtering (or using a square texture if possible) might help.

  4. Have you looked at the texture itself (in PIX or by saving it to file) to make sure it looks as expected? I've had some weirdness with antialiassing fonts that would make it look horrible.


Hopefully any of these suggestions will prove useful. If not, posting a screenshot might give us a bit more insight in exactly how blurred it looks and where it might be coming from.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this