AA and SlimDX

Started by
2 comments, last by riuthamus 11 years, 10 months ago
Attempting to find documention on how to implement this with dx11 and slimdx. Any leads would be much appreciated. We are using deffered rendering, not sure if that helps or not.


gallery_1_371_14881.jpg
Advertisement
There're many ways to implement AA in a deferred rendering pipeline, here is one: FXAA
Implementing MSAA in a deferred renderer is fairly complicated, and the details will vary depending how exactly your renderer is set up. For instance you'll have to do things if you use a traditional deferred rendering setup vs. light prepass vs. tiled deferred rendering in a compute shader. For the first case, some simple steps are as follows:

  1. Create your G-Buffer render targets + depth buffer + light accumulation target with MSAA, which you do by creating the Texture2D with a sample count > 1
  2. Render the G-Buffer as you normally would
  3. For your lighting pass pixel shader, run it at per-sample frequency by taking SV_SampleIndex. If you declare your G-Buffer + depth textures as Texture2DMS, you can use the SampleIndex to access the appropriate subsample from the G-Buffer + depth buffer and apply lighting to it.
  4. When you're done rendering to it, resolve the light accumulation target to a non-MSAA texture using ResolveSubresource.

This will work, but will have poor performance. Usually step 3 is optimized by either using a stencil mask or branching to only access all subsamples for pixel where you really need it (usually at triangle edges, or at depth/normal discontinuities). If you're applying lighting in a compute shader that also opens up additional possibilities for optimization.

As an alternative, post-process AA techniques (like FXAA, which was already mentioned) can be applied regardless of your rendering technique. However they have their own set of limitations.
We have a dynamic lighting system that we are trying to get to work with some shadow mapping. Would any of these be affected by that?

This topic is closed to new replies.

Advertisement