As I zoom out of my scene there seems to be a problem with the Z-buffer precision, see attached picture (the zig-zag lines / should be straight).
However, how can I fix this?
Printable View
As I zoom out of my scene there seems to be a problem with the Z-buffer precision, see attached picture (the zig-zag lines / should be straight).
However, how can I fix this?
This should help:VB Code:
'Check device supports hardware acceleration... On Error Resume Next D3D.GetDeviceCaps D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Caps If Err.Number = D3DERR_NOTAVAILABLE Then 'Device type "D3DDEVTYPE_HAL" not available, ie no Hardware acceleration MsgBox "Hardware acceleration not supported!", vbCritical Initialise = False Exit Function Else 'Supports Hardware Acceleration... On Error GoTo ErrHandler 'Restore the error handler because we had changed it to "Resume Next" remember If D3D.CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DispMode.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D32) = D3D_OK Then 'We can use a 32 bit Z-Buffer D3DWindow.AutoDepthStencilFormat = D3DFMT_D32 Else 'Could not support a 32 bit Z-Buffer, try a 24 bit Z-Buffer... If D3D.CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DispMode.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D24X8) = D3D_OK Then 'We can use a 24 bit Z-Buffer D3DWindow.AutoDepthStencilFormat = D3DFMT_D24X8 Else 'Could not support a 24 bit Z-Buffer, try a 16 bit Z-Buffer... If D3D.CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DispMode.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D16) = D3D_OK Then 'We can use a 16 bit Z-Buffer D3DWindow.AutoDepthStencilFormat = D3DFMT_D16 Else MsgBox "Could not find a supported format for a Z-Buffer!", vbCritical Initialise = False Exit Function End If End If End If End If
What depth of Z Buffer are you already using? This should get the biggest it can work with (hopefully ;)). I have seen this problem occurr before when I was using a 16bit one.
Thanks, but I'm already looking for the biggest possible Z-buffer which is D3DFMT_16 on my laptop.
I hoped there was a way to optimize the precision of the Z-buffer since my game world is nearly flat and I do exactly know in which distance I need a tighter Z-buffer...
Which formats are you checking? My old PC Supported D32 but my new one didn't so I had to add it to check for DM24X8 which does work on my new one. There might be another one that would work on your laptop?
I haven't heard of anything like you mentioned by changing the position of the precission before.
I'm checking those:
VB Code:
'Find best Z-buffer If CheckDepthBufferFormat(D3DFMT_D32) Then DepthBufferFormat = D3DFMT_D32 ElseIf CheckDepthBufferFormat(D3DFMT_D24S8) Then DepthBufferFormat = D3DFMT_D24S8 ElseIf CheckDepthBufferFormat(D3DFMT_D24X4S4) Then DepthBufferFormat = D3DFMT_D24X4S4 ElseIf CheckDepthBufferFormat(D3DFMT_D24X8) Then DepthBufferFormat = D3DFMT_D24X8 ElseIf CheckDepthBufferFormat(D3DFMT_D16) Then DepthBufferFormat = D3DFMT_D16 ElseIf CheckDepthBufferFormat(D3DFMT_D15S1) Then DepthBufferFormat = D3DFMT_D15S1 End If
But that's not the point. If there's no other way it's ok since the graphics card is quite old. I was just trying to optimize existing things ;)
Thanks anyways.