开发者

D3D9 Render to Texture with Multisampling

开发者 https://www.devze.com 2023-03-25 09:49 出处:网络
I want to render to a texture using multisampling, then render that to the back b开发者_如何转开发uffer using a textured quad (passing it through a pixel shader.) Everything works fine without multisa

I want to render to a texture using multisampling, then render that to the back b开发者_如何转开发uffer using a textured quad (passing it through a pixel shader.) Everything works fine without multisampling but I just can't figure out how to set it up to use multisampling.

I tried CreateDepthStencilSurface() but I don't really know what to do with that surface, or if tat's even what I should be doing.

Please help.

PS - I'm using DX9, Win32 and C++


You can't, not directly anyway. Here is the regular workaround:

  1. Create a multisample render target using IDirect3DDevice9::CreateRenderTarget
  2. Create a simple texture
  3. Render to your multisample render target
  4. Use IDirect3DDevice9::StretchRect to blit your multisampled content into one of the surfaces of your texture
  5. Now proceed to use that texture as planned.


-Create a RenderTarget and DepthStencilSurface - these must have the same multisampling options set (same SampleDescription)

-Set the DepthStencilSurface as your DepthStencilView

-DepthStencilSurface must have at least as much resolution as the RenderTarget

-Highest SampleDescription-setting most card's support as of today is 8 Samples and Quality 32

-To blit the RenderTarget use StretchRect on DX9 and ResolveSubresource on DX10 an DX11

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号