Incorporating multisample anti-aliasing

One of the problems with classic deferred rendering is that to support the built-in hardware anti-aliasing, we must implement some extra shader code to correctly sample from the MSAA G-Buffer. More recent improvements in Direct3D have made this problem easy to solve by using the SV_SampleIndex and SV_Coverage pixel shader system-value semantics to run the shader for each sample and to determine which samples are covered by the current fragment.

Getting ready

It is necessary that all render targets are created with multisampling enabled. This includes the render targets of the G-Buffer, the depth buffer, and also the light accumulation buffer of the light renderer. Our implementations of the GBuffer and LightRenderer ...

Get Direct3D Rendering Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.