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

Question about RH coordinate system

Started by polygonsheep Dec 1, 2002 at 5:25 PM 3 replies 600+ views
Original Post
polygonsheep
polygonsheep
Hi, I just recently started messing around with DX8 and I''m using the .X exporter with Maya. When I create a scene in Maya and display it in my graphics engine (as a D3DMesh) all the geometry is fliped about the ZY plane. I get the same thing when loading tiny.x into my program. The word "Microsoft" on her shirt is backwards. This is the same result as loading tiny.x into the OptimizedMesh example. However if you load tiny.x into the SkinnedMesh example the shirt displays properly. I assume it''s because SkinnedMesh is using a RH coordinate system? However, I have been unsuccessful at converting my program to RH. Any suggestions? Since the tiny.x file looks different in each example program, maybe SkinnedMesh is loading the file differently or rearranging the vertices? Basically, I''m just interested in getting the geometry I see in Maya to match what''s in my program. Should I convert my program to RH (if so, how?) or change the .X extractor to arrange the vertices differently? Thanks!
polygonsheep
polygonsheep
Hmmm, ok, so I just changed all my LH functions to RH and set D3DRS_CULLMODE to D3DCULL_CW instead of D3DCULL_CCW. Now everything displays properly. Is that all I needed to do to convert to a right handed system?

BTW, why is the default left-handed for DirectX? I know of no other APIs, programs, or school classes that use a left handed system. MS just wants to be "special"?
deepdene
deepdene
quote:
Original post by polygonsheep
Hmmm, ok, so I just changed all my LH functions to RH and set D3DRS_CULLMODE to D3DCULL_CW instead of D3DCULL_CCW. Now everything displays properly. Is that all I needed to do to convert to a right handed system?

BTW, why is the default left-handed for DirectX? I know of no other APIs, programs, or school classes that use a left handed system. MS just wants to be "special"?


I believe it has to do with OpenGL using the RH system, and DX trying to make itself imcompatible as much as possible with it (to help make sure everyone keeps with their systems), same thing behind the win32 libraries etc.
reillyhead
reillyhead
the left handed system does make a bit of sense when you consider how it applies to screen coordinates. i.e. the x runs across the screen, y up and down and the z into the screen.

that said tho, coming from an engineering backgroud i tend to prefer a right handed system with the base reference frame rotated so that the z axis represents ''up''.

if you want to keep the LH system, i also remember that to convert from 3dsmax to directx friendly one needs to swap the z and y coordinates as they are being loaded. (i cant remember if, or which, coordinates need to be ''negatived'', or whether culling order is reversed; easy to play with tho.
Renus
Renus
You may also want to consider that when rendering in hardware, some drivers are lazy implemented and prefer a LH system. I started using RH, but some drivers (like my gf3) need then negative fog values and things like that, so if you have the choice, use LH.

- thomas
thomas

Topic Locked

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

Sign in to reply to this topic.