I am trying to implement deferred shading but I ran into one issue. But first, some background details.
All the buffers:
- SwapChain; R8G8B8A8_UNORM
- Depth Stencil; R32_TYPELESS
- Color Buffer; R8G8B8A8_UNORM
- Depth Buffer (linear); R32_FLOAT
- Normals Buffer; R8G8B8A8_UNORM (accuracy might be low, but it doesn't matter at this point)
Rendering loop:
- I use ID3D11DeviceContext::OMSetRenderTargets() to set #3, #4, #5 as render targets and #2 as depth stencil.
- Draw all geometry: unshaded color goes into #3, normals into #5, vertex shader outputs transformedPosition.z, pixel shader divides it by far plane to normalize it.
- Using ID3D11DeviceContext::OMSetRenderTargets() setting #1 as render target, no depth stencil
- #3 and #5 are set as shader resources
- Performing phong shading
However, I'd also like to have FXAA (or any other post-process antialiasing), however it'll require #1 as input, where do I output then?
It seems wrong to output into #3 and then copy back to #1. How can this be solved?
Thank you in advance.