Sign in to follow this  

Font effects with D3D?

This topic is 4342 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there any way to do simple text effects other than color / style with D3D Font class? Something like a glow effect or drop shadow, obviously simpler than how photoshop would do it, but that basic idea.

Share this post


Link to post
Share on other sites
For a basic drop shadow, you could render your text twice, with a small offset. This will create a simple shadow (use black as the color for the first one, for example).

Also, if you want more complex effects, you can always render to a texture, and render that texture again using nearly any fullscreen effect (Bloom, for example) to create some very cool effects. This would be more complicated though, and in a dynamic text environment, maybe a bit slower, too.

Share this post


Link to post
Share on other sites
Quote:
Original post by sirob
For a basic drop shadow, you could render your text twice, with a small offset. This will create a simple shadow (use black as the color for the first one, for example).

Yea, I do this and I like it a lot.

Quote:
Also, if you want more complex effects, you can always render to a texture, and render that texture again using nearly any fullscreen effect (Bloom, for example) to create some very cool effects. This would be more complicated though, and in a dynamic text environment, maybe a bit slower, too.

Definitely - just check out the PostProcessing sample in the SDK. Those same exact shaders can be applied to text - all you have to do is draw it to a render target first. Also, check out the Nvidia SDK - they have both cool PP effects and cool text-based effects.

Share this post


Link to post
Share on other sites
Would it be especially difficult to do the pixel shader stuff with PS 1.4 rather than 2.0? I tried the PostProcess demo but it won't run (in hardware mode anyways) on this machine because it doesn't support 2.0. Unfortunately its a laptop so its not as simple as running to best buy to upgrade it.

So basically if i wanted black text with a red outline i would render the red font to a texture, apply the pixel shader, then just draw the black on top? The text I want to use this for doesn't change very often so it hopefully wouldn't slow things down too much, just render it once and keep the texture around.

Share this post


Link to post
Share on other sites
Quote:
Original post by llloyd
So basically if i wanted black text with a red outline i would render the red font to a texture, apply the pixel shader, then just draw the black on top? The text I want to use this for doesn't change very often so it hopefully wouldn't slow things down too much, just render it once and keep the texture around.

Hmm yea...due to your lack of hardware support, perhaps we can do this another way:

(1) Do it without any special shaders. I think that making the red font a point or two larger than the black font could give you an outline. So for example:

- Create 13pt font
- Create 12pt font

- Render 13pt in red
- Render 12pt in black, overtop of it

If you get it aligned right, it might give you that outline you are looking for.

(2) Use bitmap fonts, and use Photoshop or some tool with similar editing capabilities to make font with outlines. Here is a page on a little bitmap-based font engine on DrunkenHyena. There are a lot of resources out there on it, if you have any trouble.

Share this post


Link to post
Share on other sites

This topic is 4342 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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