Mega Search
23.2 Million


Sign Up

Make a donation  
Why left-handed coordinates  
News Group: microsoft.public.win32.programmer.directx.graphics

I've been wondering for a long time why D3D chose left-
handed coordinates and row-major matrix, which are just 
the opposite of OpenGL. I feel a bit uncomfortable with 
it. One reason is that I learned math in right-handed 
coordinates. 

Row-major matrix concatenation takes effect from left to 
right, while column-major matrix and quaternion 
concatenation take effect from right to left. So I think 
it's better to follow the same rule.

Also, in D3D's doc, it says column-major matrix is more 
efficient for shaders.

So, could any one tell me why D3D made that choice?

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 10-Nov-2003, at 8:50 PM EST
From: qrli
 
Re: Why left-handed coordinates  
News Group: microsoft.public.win32.programmer.directx.graphics
Left handed coordinate systems offer arguably the most logical 
coordinate system - X is right, Y is up and Z goes into the screen.  But 
doesn't D3D support both types anyway?

Row-major matrices also have nice memory layout properties: the X, Y and 
Z rows are the three axes of the coordinate system, and the W row is the 
origin of the coordinate system.

All can be recast as vectors, which makes them easier to manipulate, and 
can improve performance on SIMD processors.

Column major matrices are better in vertex shaders because a 3x4 matrix 
can be stored in 3 constant registers, and the vertex shader language 
supports dp4, allowing matrix multiplies to take only 3 instructions.

-Wade

qrli wrote:

> I've been wondering for a long time why D3D chose left-
> handed coordinates and row-major matrix, which are just 
> the opposite of OpenGL. I feel a bit uncomfortable with 
> it. One reason is that I learned math in right-handed 
> coordinates. 
> 
> Row-major matrix concatenation takes effect from left to 
> right, while column-major matrix and quaternion 
> concatenation take effect from right to left. So I think 
> it's better to follow the same rule.
> 
> Also, in D3D's doc, it says column-major matrix is more 
> efficient for shaders.
> 
> So, could any one tell me why D3D made that choice?


Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 15-Nov-2003, at 9:33 AM EST
From: Wade Brainerd
 
Re: Why left-handed coordinates  
News Group: microsoft.public.win32.programmer.directx.graphics
Really good points. Thanks!

>-----Original Message-----
>Left handed coordinate systems offer arguably the most 
logical 
>coordinate system - X is right, Y is up and Z goes into 
the screen.  But 
>doesn't D3D support both types anyway?
>
>Row-major matrices also have nice memory layout 
properties: the X, Y and 
>Z rows are the three axes of the coordinate system, and 
the W row is the 
>origin of the coordinate system.
>
>All can be recast as vectors, which makes them easier to 
manipulate, and 
>can improve performance on SIMD processors.
>
>Column major matrices are better in vertex shaders 
because a 3x4 matrix 
>can be stored in 3 constant registers, and the vertex 
shader language 
>supports dp4, allowing matrix multiplies to take only 3 
instructions.
>
>-Wade
>
>qrli wrote:
>
>> I've been wondering for a long time why D3D chose left-
>> handed coordinates and row-major matrix, which are 
just 
>> the opposite of OpenGL. I feel a bit uncomfortable 
with 
>> it. One reason is that I learned math in right-handed 
>> coordinates. 
>> 
>> Row-major matrix concatenation takes effect from left 
to 
>> right, while column-major matrix and quaternion 
>> concatenation take effect from right to left. So I 
think 
>> it's better to follow the same rule.
>> 
>> Also, in D3D's doc, it says column-major matrix is 
more 
>> efficient for shaders.
>> 
>> So, could any one tell me why D3D made that choice?
>
>.
>

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 16-Nov-2003, at 7:44 PM EST
From: qrli
 
Re: Why left-handed coordinates  
News Group: microsoft.public.win32.programmer.directx.graphics
> >> I've been wondering for a long time why D3D chose left-
> >> handed coordinates and row-major matrix, which are
> just
> >> the opposite of OpenGL. I feel a bit uncomfortable
> with
> >> it. One reason is that I learned math in right-handed
> >> coordinates.
> >>
> >> So, could any one tell me why D3D made that choice?

The original D3D code came from RenderMorphics and the book that they used
as their reference,  "Principles of Interactive Computer Graphics" by Newman
and Sproull, uses left handed coordinates.

Stephen



Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 18-Nov-2003, at 2:50 AM EST
From: Stephen Coy
 
Re: Why left-handed coordinates  
News Group: microsoft.public.win32.programmer.directx.graphics
> The original D3D code came from RenderMorphics and the book that they used
> as their reference,  "Principles of Interactive Computer Graphics" by
Newman
> and Sproull, uses left handed coordinates.

LOL, that sounds a little 'urban legend'-ish ;).

    WTH



Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 18-Nov-2003, at 10:04 AM EST
From: WTH
 
Re: Why left-handed coordinates  
News Group: microsoft.public.win32.programmer.directx.graphics
[Please do not mail me a copy of your followup]

"WTH"  spake the secret code
 thusly:

>> The original D3D code came from RenderMorphics and the book that they used
>> as their reference,  "Principles of Interactive Computer Graphics" by
>Newman
>> and Sproull, uses left handed coordinates.
>
>LOL, that sounds a little 'urban legend'-ish ;).

However it sounds, the RenderMorphics part is definately true.  There
are many computer graphics texts that use a left-handed coordinate
system for viewing, etc., although the one I always think of is Foley
and van Dam.
-- 
"The Direct3D Graphics Pipeline"-- code samples, sample chapter, FAQ:
          
	    Pilgrimage: Utah's annual demoparty
               

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 18-Nov-2003, at 10:15 AM EST
From: Rich [Microsoft Direct3D MVP]
 
Re: Why left-handed coordinates  
News Group: microsoft.public.win32.programmer.directx.graphics
"WTH"  wrote in message
news:vrkd85h0smg374@corp.supernews.com...
> > The original D3D code came from RenderMorphics and the book that they
used
> > as their reference,  "Principles of Interactive Computer Graphics" by
> Newman
> > and Sproull, uses left handed coordinates.
>
> LOL, that sounds a little 'urban legend'-ish ;).

Actually it's totally true.  I was on the D3D team at Microsoft when we took
over the D3D codebase between DX3 and DX5.  Having a copy of Newman and
Sproull around really helped with understanding the code because a lot of
the (one letter) variable names came straight out of the book's equations.
Now if I could just figure out who walked off with my copy of the book...

Stephen




Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 19-Nov-2003, at 7:08 AM EST
From: Stephen Coy