Jump to content
  • Advertisement
Sign in to follow this  
prachiRocks

Overlaying text/image on a 2D image using Direct3D

This topic is 2528 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

Hi,

My aim is to overlay text/image on a 2D image using Direct3D.

Any pointers on how to achieve this?
Can it be done with the help of Sprites?

[Note: I am a newbie...]

Thanks in advance!

:)

Share this post


Link to post
Share on other sites
Advertisement
You need to create a reusable post effect system that can render to and from dynamic textures. You simply render a quad with any number of textures without any 3D transformations and let the HLSL shader do the computation you need. Then you can create many powerful 2D effects by sampling the input textures with offsets.

Share this post


Link to post
Share on other sites
Hi Dawoodoz,

Thanks for your reply.
Can you be a little more specific as to which shaders i should be using for this image overlay?That would be great!

Regards,
Prachi


You need to create a reusable post effect system that can render to and from dynamic textures. You simply render a quad with any number of textures without any 3D transformations and let the HLSL shader do the computation you need. Then you can create many powerful 2D effects by sampling the input textures with offsets.

Share this post


Link to post
Share on other sites
For small overlays, you should place the quad where you want to draw and use alphafiltering by returning an alpha value from the pixel shader.

For large overlays, place the quad over the entire screen and sample the background to allow blur, turbulence and much other. By using 2 color buffers per image, you can have the same image as both output and input by reading from the newest buffer and writing to the oldest buffer.

I use a vertex shader that only return the position to the pixel shader and let the game programmer define the pixel shader outside of the graphics engine. Just divide the screen space position with the dimensions in pixels from your constant buffer to get the default UV coordinates.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!