Anomaly - speedy lines on screen

Started by
3 comments, last by brekehan 14 years, 11 months ago
If I rotate my camera somewhat speedily, I am noticing what looks like scan lines on the whiter parts of my scene. It happens very quickly, they buzz across, up or down. Little black lines or feint r,g, or b colored lines. My scene consists of A background sphere, split into 4 parts, all uniformly scaled out 999 units. Each part is textured seperatly, with nebulas on a black background, because I wanted to get as much detail as possible and use big textures for each part. I then have another sphere, scaled out to 998, which is textured with stars and alpha where there are no stars. I've then got a high poly space ship at the origin. I then did a lens flare (or part of one) last, which contains an occlusion query at scaled to 990.0 Z, and 100 pix wide. It renders an alpha blended glow quad in 2D at 0.0 Don't know if those details add anything. Anyone have any ideas on what could cause this?
Advertisement
I would imagine you're seeing "tearing" as a result of not locking your Present() calls to the refresh rate of the display.

Essentially what you're seeing is a hybrid of two frames of image - the newer one above and the older one below. You probably get it a lot of the time, but its most obvious with fast moving objects/cameras that change position significantly between two adjacent frames.

What is your presentation interval? Try setting it to ONE and see if the problem goes away.


hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Quote:Original post by jollyjeffers
I would imagine you're seeing "tearing" as a result of not locking your Present() calls to the refresh rate of the display.

Essentially what you're seeing is a hybrid of two frames of image - the newer one above and the older one below. You probably get it a lot of the time, but its most obvious with fast moving objects/cameras that change position significantly between two adjacent frames.

What is your presentation interval? Try setting it to ONE and see if the problem goes away.

hth
Jack



I don't have a presentation interval set anywhere that I know of. It's probably another DX9 thing not applicable to DX10? I dide a search and only got DX9 references.

When I created my swapchain it asked for the refresh rate of the display and I set it according to the enumeration that was chosen. So, hopefully those match correctly...

Here is my init snippet
   // SNIP   ShowWindow(m_hwnd, SW_SHOW);   // Create a DXGI Factory   if( FAILED(CreateDXGIFactory(__uuidof(IDXGIFactory),(void**)(&m_dxgiFactory))) )   {      exception.m_msg = "Failed to create DXGI factory";      throw exception;   }   // Let DXGI manage alt-enter transitions from full screen to windowed and back   if( FAILED(m_dxgiFactory->MakeWindowAssociation(m_hwnd, 0)) )   {      exception.m_msg = "Failed to make window association with DXGI";      throw exception;   }   // Create a D3D device   try   {      m_displayModeEnumerator.CreateDevice(m_displayMode.m_adapterIndex, m_device);   }   catch(BaseException & e)   {      throw e;   }   // Create the swap chain   DXGI_SWAP_CHAIN_DESC swapChainDesc;   ZeroMemory(&swapChainDesc, sizeof(swapChainDesc));      swapChainDesc.BufferCount                         = 2;   swapChainDesc.BufferDesc.Format                   = DXGI_FORMAT_R8G8B8A8_UNORM;   swapChainDesc.BufferDesc.RefreshRate.Numerator    = m_displayMode.m_refreshRate.m_numerator;   swapChainDesc.BufferDesc.RefreshRate.Denominator  = m_displayMode.m_refreshRate.m_denominator;   swapChainDesc.BufferUsage                         = DXGI_USAGE_RENDER_TARGET_OUTPUT;   swapChainDesc.OutputWindow                        = m_hwnd;   swapChainDesc.SwapEffect                          = DXGI_SWAP_EFFECT_DISCARD;   swapChainDesc.SampleDesc.Count                    = m_displayMode.m_multisamplingCount;   swapChainDesc.SampleDesc.Quality                  = m_displayMode.m_multisamplingQuality;   if( m_displayMode.m_fullscreen )   {      swapChainDesc.BufferDesc.Width   = m_displayMode.m_resolutionFullscreen.m_width;      swapChainDesc.BufferDesc.Height  = m_displayMode.m_resolutionFullscreen.m_height;      swapChainDesc.Flags              = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;      swapChainDesc.Windowed           = false;   }   else   {      swapChainDesc.BufferDesc.Width   = m_displayMode.m_resolutionWindowed.m_width;      swapChainDesc.BufferDesc.Height  = m_displayMode.m_resolutionWindowed.m_height;      swapChainDesc.Flags              = 0;      swapChainDesc.Windowed           = true;   }   if( FAILED(m_dxgiFactory->CreateSwapChain(m_device.get(), &swapChainDesc, &m_swapChain)) )   {      throw BaseException("Failed to create swapchain",            "void GFXApplication::Init(HINSTANCE instance, const DisplayMode & displayMode)",            "GFXApplication.cpp");   }   // Setup the viewport   D3D10_VIEWPORT viewport;   viewport.MinDepth = 0.0f;   viewport.MaxDepth = 1.0f;   viewport.TopLeftX = 0;   viewport.TopLeftY = 0;   if( m_displayMode.m_fullscreen )   {      viewport.Width    = m_displayMode.m_resolutionFullscreen.m_width;      viewport.Height   = m_displayMode.m_resolutionFullscreen.m_height;   }   else   {      viewport.Width    = m_displayMode.m_resolutionWindowed.m_width;      viewport.Height   = m_displayMode.m_resolutionWindowed.m_height;   }   m_device->RSSetViewports(1, &viewport);   // Setup a scissor rectangle   D3D10_RECT scissor;   scissor.left   = 0;   scissor.top    = 0;   if( m_displayMode.m_fullscreen )   {      scissor.right    = m_displayMode.m_resolutionFullscreen.m_width;      scissor.bottom   = m_displayMode.m_resolutionFullscreen.m_height;   }   else   {      scissor.right    = m_displayMode.m_resolutionFullscreen.m_width;      scissor.bottom   = m_displayMode.m_resolutionFullscreen.m_height;   }   m_device->RSSetScissorRects(1, &scissor);   // Create the depth stencil state   D3D10_DEPTH_STENCILOP_DESC depthStencilOpDesc;      depthStencilOpDesc.StencilFailOp      = D3D10_STENCIL_OP_KEEP;   depthStencilOpDesc.StencilDepthFailOp = D3D10_STENCIL_OP_KEEP;   depthStencilOpDesc.StencilPassOp      = D3D10_STENCIL_OP_KEEP;   depthStencilOpDesc.StencilFunc        = D3D10_COMPARISON_ALWAYS;   D3D10_DEPTH_STENCIL_DESC   depthStencilDesc;   depthStencilDesc.DepthEnable      = TRUE;   depthStencilDesc.DepthWriteMask   = D3D10_DEPTH_WRITE_MASK_ALL;   depthStencilDesc.DepthFunc        = D3D10_COMPARISON_LESS;   depthStencilDesc.StencilEnable    = FALSE;   depthStencilDesc.StencilReadMask  = D3D10_DEFAULT_STENCIL_READ_MASK;   depthStencilDesc.StencilWriteMask = D3D10_DEFAULT_STENCIL_WRITE_MASK;   depthStencilDesc.FrontFace        = depthStencilOpDesc;   depthStencilDesc.BackFace         = depthStencilOpDesc;   if( FAILED(m_device->CreateDepthStencilState(&depthStencilDesc, &m_depthStencilState)) )   {      exception.m_msg = "Failed to create D3D depth stencil state";      throw exception;   }   m_device->OMSetDepthStencilState(m_depthStencilState, 0);   // Set rasterizer state   D3D10_RASTERIZER_DESC rasterizerDesc;   rasterizerDesc.FillMode              = D3D10_FILL_SOLID;   rasterizerDesc.CullMode              = D3D10_CULL_BACK;   rasterizerDesc.FrontCounterClockwise = FALSE;   rasterizerDesc.DepthBias             = 0;   rasterizerDesc.DepthBiasClamp        = 0.0f;   rasterizerDesc.SlopeScaledDepthBias  = 0.0f;   rasterizerDesc.DepthClipEnable       = TRUE;   rasterizerDesc.ScissorEnable         = TRUE;   rasterizerDesc.AntialiasedLineEnable = FALSE;   if( m_displayMode.m_multisamplingCount > 1 )   {      rasterizerDesc.MultisampleEnable = TRUE;   }   else   {      rasterizerDesc.MultisampleEnable = FALSE;   }   if( FAILED(m_device->CreateRasterizerState(&rasterizerDesc, &m_rasterizerState)) )   {      exception.m_msg = "Failed to create rasterizer state";      throw exception;   }   m_device->RSSetState(m_rasterizerState);   // Let the rest of the DX initialization occur in HandleSizeChanges()   m_ignoreSizeChange = false;      GetClientRect(m_hwnd, &windowBounds);   try   {      HandleSizeChange(windowBounds.right - windowBounds.left, windowBounds.bottom - windowBounds.top);   }   catch(BaseException & e)   {      throw e;   }


DisplayMode is just a class I made that contains a selected enumeration obtained from DXGI for the monitor.
At init (as you already have it):
swapChainDesc.BufferDesc.RefreshRate.Denominator=1;
swapChainDesc.BufferDesc.RefreshRate.Numerator=60;

At frame render:
m_swapChain->Present(1,0);

The 1 enables vSync
Quote:Original post by n3Xus
At frame render:
m_swapChain->Present(1,0);

The 1 enables vSync


That just did wonders! Thanks!

This topic is closed to new replies.

Advertisement