Jump to content
  • Advertisement
Sign in to follow this  
Konklaw

supersampling implementation

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

I am stuck at last stage of supersampling implementation. That mean I render scene with 4x bigger (2x width * 2x height) size to separate render target. At the next step I should downsample this image and get it on screen, and that is problem.
I understand that I can use texture from render target for drawing it on full screen, but this way requires vertex buffer and render technique. This way looks no good and I try to use ResolveSubResource to copy big texture (from render target) to smaller texture of swap chain (swap chain has 1x size) and call Present.

I use this code:

g_pImmediateContext->Draw( 3, 0 );

ID3D11Texture2D* pBackBuffer = nullptr;
auto hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), reinterpret_cast<void**>( &pBackBuffer ) );
if( FAILED( hr ) )
    throw 1;

g_pImmediateContext->ResolveSubresource(bb, 0, pBackBuffer, 0, DXGI_FORMAT_R8G8B8A8_UNORM);
pBackBuffer->Release();

// Present the information rendered to the back buffer to the front buffer (the screen)
g_pSwapChain->Present( 0, 0 );

but seems it is not working.

Is this way of downsampling (copying of texture) correct, or there is some commonly agreed way?

Share this post


Link to post
Share on other sites
Advertisement

I have always done this by rendering a screen quad and then applying a linear filter to the sampler. The idea may not look very good but it is possibly the best way you can do it since StretchRect is not more on the graphics api.

 

For more info about take a look at this link:

http://www.gamedev.net/topic/658361-stretchrect-in-dx11/

 

Hope it helps smile.png

Edited by #Include Graphics

Share this post


Link to post
Share on other sites

Thanks for the reply and reference.
This step of supersampling implementation seems pretty basic, but I can't find any clear example.
I am still not sure, but I have become more confident. It looks like that drawing of screen quad is the only solution.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!