Objects superposing itself to other objects

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Ishtm
Posts: 37
Joined: Mon May 09, 2005 8:03 pm

Objects superposing itself to other objects

Post by Ishtm »

this problem is very common on some video cards for example when a polygon is parallel to other and they are very close. I can solve it changing the buffer in CD3D9Driver.cpp

code line 270:
if (!StencilBuffer)
present.AutoDepthStencilFormat = D3DFMT_D16;
to:
if (!StencilBuffer)
present.AutoDepthStencilFormat = D3DFMT_D32;

and it works fine, unfortunately in some video cards the method
device->getVideoModeList() causes an exception.
pfo
Posts: 370
Joined: Mon Aug 29, 2005 10:54 pm
Location: http://web.utk.edu/~pfox1

Post by pfo »

Someone mentioned on the forum somewhere that if you take the camera's far value and divide it by the near value, if the quotient isn't within a certain range (2000 I believe?), then objects closer to the camera far plane will experience z-buffering artifacts. I was having a similar problem and took their advice and voila, z-buffering problems gone. I think setting the AutoDepthStencilFormat to 32 bits increases your z-buffer size, eliminating some artifacts, but doublecheck your camera values.

No idea why getVideoModeList might crash
Ishtm
Posts: 37
Joined: Mon May 09, 2005 8:03 pm

Post by Ishtm »

Thanks, I will try it.
Post Reply