Skip to main content
GameDev.net gamedev.net
🔒 Locked

Weird artefact when rendering with D3D11

Started by PhilipMR Dec 1, 2019 at 4:52 PM 7 replies 6.7k views
Original Post
PhilipMR
PhilipMR

Hi!

I'm rendering an animated 3d skeletal mesh using Direct3D11, but I keep seeing a mysterious artefact when doing so. It seems as though the viewport is sliced into a grid of wide, short tiles, that don't synchronize correctly when there's motion (from either the skeleton animation itself, or the camera moving).

I've attached a short clip of the artefact in the attachment. It's a bit subtle, but if you focus on the chest/belly area of the character (especially near the end of the video), you can see it clearly.

Has anyone else experienced this? Or know what might be causing the problem?
Thanks a lot!



PhilipMR
PhilipMR

Seems like it, I use the following parameters for creating the swap chain:

DXGI_SWAP_CHAIN_DESC SwapChainDesc;
SwapChainDesc.BufferDesc.Width                   = BufferWidth;
SwapChainDesc.BufferDesc.Height                  = BufferHeight;
SwapChainDesc.BufferDesc.RefreshRate.Numerator   = 1;
SwapChainDesc.BufferDesc.RefreshRate.Denominator = 60;
SwapChainDesc.BufferDesc.Format                  = DXGI_FORMAT_R8G8B8A8_UNORM;
SwapChainDesc.BufferDesc.ScanlineOrdering        = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
SwapChainDesc.BufferDesc.Scaling                 = DXGI_MODE_SCALING_UNSPECIFIED;
SwapChainDesc.SampleDesc.Count                   = 4;
SwapChainDesc.SampleDesc.Quality                 = 0;
SwapChainDesc.BufferUsage                        = DXGI_USAGE_RENDER_TARGET_OUTPUT;
SwapChainDesc.BufferCount                        = 1;
SwapChainDesc.OutputWindow                       = WindowHandle;
SwapChainDesc.Windowed                           = true;
SwapChainDesc.SwapEffect                         = DXGI_SWAP_EFFECT_DISCARD;
SwapChainDesc.Flags                              = 0;

And I don't do anything special with the Present call, I have VSync enabled so it's really just this:

SwapChain->Present(1, 0);

Does any of this seem out of the ordinary to you? (I tried using different SwapEffects too like SEQUENTIAL, but to no avail. Also setting the SwapEffect to either FLIP_DISCARD or FLIP_SEQUENTIAL makes the D3D11CreateDeviceAndSwapChain call fail).

SoldierOfLight
SoldierOfLight

This has nothing to do with swapchain tearing. You wouldn't be able to record swapchain tearing in a video unless you physically recorded your screen.

PhilipMR
PhilipMR

That's a good point, although besides this there's nothing I do w.r.t. vsync, multisampling, or other effects that would affect the entire frame buffer.

vinterberg
vinterberg

Wondering if what you're seeing is a result of viewport scaling?
Maybe your viewport is scaled by a few pixels because of wrongly-calculated window size?

Edit: a resolution of 1280x696 seems "off"..?

.:vinterberg:.  
Endurion
Endurion

Your video hoster likes to display a VPN ad. Not nice.

My guess is also on a mismatching resolution, client size vs. swap chain size.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>
PhilipMR
PhilipMR
vinterberg said:

Wondering if what you're seeing is a result of viewport scaling?
Maybe your viewport is scaled by a few pixels because of wrongly-calculated window size?

Edit: a resolution of 1280x696 seems "off"..?

This was indeed the case, and after adjusting the size the artifact is gone! Thank you!!
More specifically, I thought I would get the proper size for my window by doing this:

RECT WindowRect = {0};
WindowRect.right  = 1280;
WindowRect.bottom = 720;
AdjustWindowRect(&WindowRect, WS_OVERLAPPEDWINDOW | WS_VISIBLE, false);    
HWND WindowHandle = CreateWindow(WindowClass.lpszClassName,
                                 "Game Window",
                                 WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                                 CW_USEDEFAULT,
                                 CW_USEDEFAULT,
                                 WindowRect.right,
                                 WindowRect.bottom,
                                 nullptr,
                                 nullptr,
                                 Instance,
                                 nullptr);

But as it turns out, after calling the AdjustWindowRect function, the WindowRect's left and top are no longer 0, so the width and height that I should pass to the CreateWindow function should be WindowRect.right-WindowRect.left and WindowRect.bottom-WindowRect.top respectively.

Endurion said:

Your video hoster likes to display a VPN ad. Not nice.

My guess is also on a mismatching resolution, client size vs. swap chain size.

My apologies, I noticed this but didn't really care that much as I just wanted to get my video up and running. This was the first hit I found on google that hosts for free. Is there any particular host you'd recommend I use in the future?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.