Jump to content
  • Advertisement
Sign in to follow this  
Happy SDE

DX11 Blending texture to backbuffer

This topic is 639 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 everyone!

 

I have a full-screen texture with UI.

I need to blend it to backbuffer.

 

UI texture and Backbuffer have the same resolution, sample count, and format.

 

The only solution came to my mind is do it over full-screen quad with shaders.

 

Is there a better way to do the job?

 

Thanks in advance.

 

PS: I use DX11

Edited by Happy SDE

Share this post


Link to post
Share on other sites
Advertisement

So, like a HUD?

 

Couple thoughts come to mind. You can put the HUD element in NDC space by omitting any transformations in your shader, or, better yet, you could just use a orthographic projection matrix for the HUD elements, render the HUD last while also disabling the Z-Buffer.

 

Marcus Hansen

Share this post


Link to post
Share on other sites

So, like a HUD?

 

Couple thoughts come to mind. You can put the HUD element in NDC space by omitting any transformations in your shader, or, better yet, you could just use a orthographic projection matrix for the HUD elements, render the HUD last while also disabling the Z-Buffer.

I want to render all HUD elements in separate fullscreen texture.

After that I need to blend it with backbuffer.

 

I took the idea from here: DOOM (2016) - Graphics Study (User Interface section)

 

So I wonder, is there some shortcut method to blend 2 textures with the same size, format, and sample count in Direct3D?

Edited by Happy SDE

Share this post


Link to post
Share on other sites

Oh, I see like post-processing.

 

hmmm (there might be a better way to do it), in your pixel shader you could do something like this:

Where color1 would be your backbuffer, and color2 the offscreen texture for your HUD.

color1 = colorMapOne.Sample(sampler, texel.texCoord);
color2 = colorMapTwo.Sample(sampler, texel.texCoord);

blendColor = color1 * color2 * 2.0;

Marcus Hansen

Edited by markypooch

Share this post


Link to post
Share on other sites

So I wonder, is there some shortcut method to blend 2 textures with the same size, format, and sample count in Direct3D?

 

 

Nope. ID3D11DeviceContext::CopyResource comes closest but doesn't allow multi-sampled resources nor blending. So rendering a full-screen quad/triangle and blending it is.

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!