DX11 Render Quality

Started by
16 comments, last by GfxProgrammer 3 years, 3 months ago

Hi-

If you look at the enclosed image, I have used the very basic settings to get two triangles rendered as a rectangle. But if you look at the diagonal, its extremely jagged. These are the settings I used to set up the rasterizer state:

    D3D11_RASTERIZER_DESC rd;
   rd.FillMode = D3D11_FILL_SOLID;
   rd.CullMode = D3D11_CULL_NONE;
   rd.FrontCounterClockwise = false;
   rd.DepthClipEnable = true;
   rd.ScissorEnable = true;
   rd.AntialiasedLineEnable = true;    // enable anti-aliased lines
   rd.MultisampleEnable = true;
   rd.DepthBias = 0;
   rd.DepthBiasClamp = 0.0f;
   rd.SlopeScaledDepthBias = 0.0f;

This doesnt seem to be working but I am stuck on what else to play with.

Any advice?

Thanks,

sp.

Advertisement

Could you provide a reference image or describe what you think should look different?

Hi-

Thanks for the question. I guess I am thinking that the line through the middle between the two colors, is smooth and clean - it looks low-quality and jagged to me?

Thanks,

sp

What is the resolution of the render target? Maybe try using MSAA?

GfxProgrammer said:

Hi-

If you look at the enclosed image, I have used the very basic settings to get two triangles rendered as a rectangle. But if you look at the diagonal, its extremely jagged. These are the settings I used to set up the rasterizer state:

    D3D11_RASTERIZER_DESC rd;
   rd.FillMode = D3D11_FILL_SOLID;
   rd.CullMode = D3D11_CULL_NONE;
   rd.FrontCounterClockwise = false;
   rd.DepthClipEnable = true;
   rd.ScissorEnable = true;
   rd.AntialiasedLineEnable = true;    // enable anti-aliased lines
   rd.MultisampleEnable = true;
   rd.DepthBias = 0;
   rd.DepthBiasClamp = 0.0f;
   rd.SlopeScaledDepthBias = 0.0f;

This doesnt seem to be working but I am stuck on what else to play with.

Any advice?

Thanks,

sp.

To quote MSDN: “AntialiasedLineEnable: Specifies whether to enable line antialiasing; only applies if doing line drawing and MultisampleEnable is FALSE.”
You have both MultisampleEnable set to true, and you are drawing triangles, and not lines. You have to setup MSAA to have antialiasing on geometry edges, or use some post processing AA solution that is capable of getting (mostly) rid of other kinds of aliasing too, not just geometric.

That is geometric aliasing and will be present is some way shape or form in 3D rendering. If you haven't taken the correct steps to mitigate aliasing, ex. making sure your antialiasing states are setup, then you will end up with the image you displayed above. With that said, you are never going to completely get rid of aliasing and the image you posted above is the about the worse case scenario.

If the four verticies of the triangles are identical, he should not see the jagged middle line even if aliasing of edges is off.

I beg to differ as its not only about having the same edges. The 2 triangles being rasterized have contrasting colors and depending on how the samples are selected for the fragment being rasterized, the final blend can produce the result you see above.

The standard way to fix this is to use MSAA (multisample anti aliasing). You render into a render target which has SampleDesc.Count = 2, 4, or 8. After that you will need to resolve into a texture which has SampleDesc.Count = 1 with ID3D11DeviceContext::ResolveSubresource(). There are also a lot more anti aliasing techniques: FXAA, MLAA, Temporal Antialiasing, supersampling, etc..

It seems there are duplicated verticies for each triangle with same attribute for color per triangle, and the two triangles differ in this triple attribute that does not interpolate. Does rasterised pixel fall just as true/false for individual triangle or are weighted, as it should be, since color output is a subject to MIPMAP bilinear filtering at the very least?

This topic is closed to new replies.

Advertisement