Hello .
What is special about DX 10.1 and further that enable us to have MSAA in a deferred shading pipeline ?
Does it enable us to have hardware MSAA ?
How should this be done ?
Thanks in advance
Hello .
What is special about DX 10.1 and further that enable us to have MSAA in a deferred shading pipeline ?
Does it enable us to have hardware MSAA ?
How should this be done ?
Thanks in advance
You piqued my interest and I found this article.
It sounds like 10.1 you have the ability to access the AA'ed samples, so you can reconstruct your values based on the knowledge of whether you're on an edge or not within your geometry. From a cursory look it seems to work when constructing depth samples, but I don't know how well it would work with the other parameters of a deferred shading pipeline like normals, since you would have an averaged sample, but they seemed to have gotten it to work. I'd love to know how that works if someone smarter than me understands it.
. 22 Racing Series .
Thanks . How can I acsess to samples and not pixels ? I mean what is the syntax for doing this ?
When you create your render target and depth stencil view - you must make sure the samples are the same and can be made for that format. In my deferred shading I use 8x MSAA. In your question how do you access the samples? I got the deferred shading from Rastertek and sadly it's down for now :(
Maybe a sniplette will help or an basic idea:
ID3D11_Texture2D_Desc texDesc;
//... fill in the required texture2D for the render target you're creating.
texDesc.format = DXGI_FORMAT_R32G32B32A32_FLOAT;
texDesc.Samples.Count = 8;
texDesc.Samples.Quality = 32;
... - Normally how you'll create the texture2D.
... create new Texture2D Description for depth Stencil View - just same as above BUT.
depthTexDesc.format = DXGI_FORMAT_D24_UNORM_S8_UINT;
depthTexDesc.Bindflags = D3D11_BIND_DEPTH_STENCIL;
-- Create the depth stencil view with the newly created depth stencil 2D Texture.
If you want to test to see if that format supports or what quality that format supports you can use ID3D11Device::CheckMultiSampleQualityLevels upon directx device creation
Thanks but I meant in shader , Look at this please :
cbuffer Constants
{
float2 PixelSize;
}
// For MSAA-4x
float4 PixelShader(float2 uv):SV_TARGET0
{
if(edge)
{
float2 SampleSize = PixelSize*0.5f;
float3 col1 = DoShading(uv+float2(SampleSize .x,0));
float3 col2 = DoShading(uv+float2(-SampleSize .x,0));
float3 col3 = DoShading(uv+float2(0,SampleSize .y));
float3 col4 = DoShading(uv+float2(0,-SampleSize .y));
return float4( (col1+col2+col3+col4)/4 ,1);
}
else
{
return float4( DoShading(uv),1 );
}
}
Is this how should I do the job ?
What if it was MSAA-8x ? How should I take the samples?
. 22 Racing Series .
You may want to take a look at this presentation, although it's a little older and some of the advice is out-of-date for the most recent GPU's. This one also talks about MSAA + deferred rendering. This presentation and sample code demonstrates a more "modern" way of handing deferred rendering and MSAA using a compute shader, so you should definitely have a look at that as well.