Sign in to follow this  

How to enable supersampling in DirectX 11?

This topic is 659 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have googled about enabling supersampling in GPU and I have found that it can be done by using SV_SampleIndex as an pixel shader input. There is no difference after inserting the SV_SampleIndex as an input of the pixel shader. Is there anyway to check that the supersampling is enable or not in DirectX 11 and HLSL?

Share this post


Link to post
Share on other sites

@Steven: You have to have a multi-sampled resource to render into.  Once you have that, the actual rendering may or may not take advantage of the system value semantic that you mentioned (its up to you to decide if you need to access subsamples, or if you just let the rasterizer take care of that for you).  After all rendering has been done, you then have to resolve your multisampled resource to a normal one for presentation to a window.

Share this post


Link to post
Share on other sites

Thanks guys for your reply, but I think that rendering to a multi-sampled render target then resolving it is a MSAA rendering technique not a SSAA rendering. And using SV_SampleIndex for running pixel shader per sample instead of per pixel but I do not know how to check that the pixel shader is performed at sample frequency. I have search on the internet and they said that SSAA rendering is a two-pass rendering. First, we render to a larger render target (for example 2 times larger for both dimensions) then down sample it to the original size in the second pass. If we use a multi-sampled resource render target in the first pass, it is a combination of SSAA and MSAA, isn't it?

Edited by steven166

Share this post


Link to post
Share on other sites

Thanks guys for your reply, but I think that rendering to a multi-sampled render target then resolving it is a MSAA rendering technique not a SSAA rendering.

 

It becomes a SSAA technique once you render your objects into the multisampled target with SV_SampleIndex as a pixel shader input, forcing it to run per-sample (unlike MSAA where the it runs per-pixel).

Share this post


Link to post
Share on other sites

I have the same think and I render a full-screen quad and check it with the following simple pixel shader:

// 4 samples per pixel
float4 PS(VS_OUTPUT input, uint sampleIndex : SV_SAMPLEINDEX) : SV_TARGET
{
         if (sampleIndex % 2 == 0)
              return float4(1,0f, 0.0f, 0.0f, 1.0f);

         return float4(1.0f, 1.0f, 0.0f, 1.0f);
}

We have 4 sampes per pixel so we have red color at the 2nd and the 4rd samples and yellow color at the 1st and the 3rd samples. But the result is all red.

Share this post


Link to post
Share on other sites

Samples 0 and 2 will be red, samples 1 and 3 will be yellow. How do you resolve the multisampled render target to display it?

 

Edit: also I have no idea if semantics are case sensitive or not, but just to be sure I would use SV_SampleIndex.

Edited by Mona2000

Share this post


Link to post
Share on other sites

This topic is 659 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this