Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / 3D Theory & Graphics / left hand Coordinate Systems to right hand ? Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

April 28, 2005, 06:11 AM

I need a simple way to make .fx shaders work with 3ds max 7, one of the main problem is that max use right hand, while d3d and the shader expect left hand. I changed the cullmode already to CW from CCW wich is np. Now for tangentspace bumpmapping u have to switch the tangent and binormal.

I just wonder is there a more general way to convert? I mainly would like to keep all my shader code and simply change some input matrixes or vectors and not the real code. Is there a way to modify the inputs for the shader's and use the same code for left and right hand?


April 28, 2005, 09:20 AM

Just think about what a change in coordinate system really is. Imagine, or draw, a right handed coordinate system. Now flip the x-axis. What does this do to the coordinates? All x-components are negated. What happens when you swap x and y-axis? X and y-components are swapped.

So all you have to do is draw the two coordinate systems and look at how the coordiantes are transformed from the one space to the other. Most probably it's a y/z swap and y negation. This can be expressed in a 'base' matrix:

[1 0 0]
[0 0 -1]
[0 1 0]

Depending on where the original coordinates are defined, you have to multiply your model or camera matrix with this base matrix. Beware of pre/post-multiplication and row/column-major matrix format.

This thread contains 2 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.