Archived

This topic is now archived and is closed to further replies.

Smegboy

3d objects back to front.

Recommended Posts

We have developed a number of pieces of software which use direct-x. There seems to be a problem on some machines where they display the 3d graphics back to front? Does anyone know what may be causing this?

Share this post


Link to post
Share on other sites
If you really mean "Inside Out" - what have you set the CULLMODE renderstate to ? - if you haven''t set it, thats the problem - *never* rely on the default values for renderstates some drivers set them to other defaults, some don''t reset the values which previous applications may have set etc...

If you mean some polygons/objects aren''t correctly Z sorted, (imagine a character rotating in Y, its legs sometimes overlap in the wrong way with Z problems) then its probably a problem with your depth buffer or projection matrix:

- If you''re using W buffer, some cards don''t do it - check the caps.

- The hardware may have to use 16bit depth buffers (old 3Dfx hardware or windowed mode nVidia hardware running on a 16bit desktop) - you might not have enough precision for the depth range you''re trying to use...

- ...related to that is if the distance between the near and far clipping planes in your projection matrix is too high - people often set zfar to stupidly high and impractical values - move one or both so theyre closer. (Space in a Z buffer isn''t linear, something like 80% of the precision is in the 20% near the camera - trying to make the range really big makes the problem worse)

- See above regarding using defaults - don''t do it - set all the states which affect you to suitable defaults when your app starts.

- Beware trying "tricks" with the Z buffer - including:
+ Clearing sub-rectangles (doesn''t work on some H/W)
+ Locking the Z buffer (some chips don''t actually have them!!)
+ Using a big quad to clear the screen+depth buffer...
+ ...Using half the range to avoid clears
+ ...etc...

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites