I'm writing this post because is not really clear to me how to make MSAA working in an HDR workflow.
Till now, I've just used post processing antialiasing like SMAA and FXAA.
Since now I'm adding support to VR, I need to replace those two techniques with MSAA.
In addition, SMAA can be combined with MSAA (to obtain what is called SMAA 2x) so even in a non VR context I can get benefits.
Before starting with questions, let me explain how my render chain is made.
At the beginning, there is a local float16 render target texture in which I render all the scene objects.
Code: Select all
compositor_node Common/Generator
{
texture render_target target_width target_height PF_FLOAT16_RGBA depth_texture depth_format PF_D32_FLOAT_X24_S8_UINT depth_pool 1
out 0 render_target
}
- Clear
- Render opaque objects
- Draw skybox (as full screen quad)
- Render transparent objects
Code: Select all
compositor_node Common/Splitter
{
in 0 render_target
texture render_target_clone target_width target_height PF_FLOAT16_RGBA depth_texture depth_format PF_D32_FLOAT_X24_S8_UINT depth_pool 2
texture render_target_depth target_width target_height PF_D32_FLOAT_X24_S8_UINT depth_pool 1
texture render_target_clone_depth target_width target_height PF_D32_FLOAT_X24_S8_UINT depth_pool 2
target render_target_clone
{
pass depth_copy
{
alias_on_copy_failure true
in render_target_depth
out render_target_clone_depth
}
}
out 0 render_target
out 1 render_target_clone
}
This is a very standard way to proceed and it means that the render target which acts as input for a post processing node becomes the output of the subsequent one (and viceversa for the other render target).
The post processing effects I have are:
- Bloom
- Eye adaptation
- Tone mapping
- Color grading
- SMAA
- FXAA
Code: Select all
compositor_node Common/Compositor
{
in 0 render_target
in 1 render_target_window
target render_target_window
{
pass render_quad
{
material Common/Quad
input 0 render_target
}
}
}
- I have to mark the texture in Common/Generator as explicit_resolve.
- Somewhere, in the post processing chain, I have to put a resolve pass (after the color grading I guess).
This is both for performance boost (avoid to resolve at every pass) and to don't have unexpected jaggies (see here).
- I've read about default and custom resolve pass, what's the difference?
The former is directly handled by the GPU driver while the latter is a sort of custom shader, is it correct? - The post processing node which come before the resolve pass have to deal with a multisampled texture (Texture2DMS in HLSL), what does it means?
Do I have to the apply the effect on every sample of the Texture2DMS texture?
Can you point me to an example that shows it? - Is it doable to have a single implementation of post processing effects which works with every level of MSAA (1x, 2x, 4x and so on...)?
- After the render target texture has been resolved, I shouldn't need to use multisampled textures anymore.
Does it make sense to enable MSAA just for the texture in Common/Generator and disable it for render window?
Is MSAA bugged in 2.1 branch?
Is the time to switch branch finally come (scary!)?