Sign in to follow this  
voidless

quake 3 coordinate system

Recommended Posts

i'm working on quake3 bsp files as a study project. i've read specifications and it states that opposed to the standard right-handed coordinate system (as i know: x points right, z points towards the observer, and y point up), quake 3 has it like this: x points right y points towards the observer z points downwards now is there any reason to keep them this way in my program or should i convert them to y= z and z= -y for rendering purposes. is there any optimization in the quake3 engine that relies on this? thank you

Share this post


Link to post
Share on other sites
Some game engines (and Direct3D) uses that approach and as far as my limited understanding of 3d math goes, it's no different and just a matter of taste.

You're correct though in that the approach taken in BSP isn't what they teach you in school. Personally, I grew up with the left-handed coords system in Torque Game Engine and my 3D package before I started programming.

Share this post


Link to post
Share on other sites
As far as i can see, that is still a right handed coordinate system, and [b]contrary[b] to the DX way. The only difference between that system and the originally RHCS you describe is a +90 degree rotation on the local x vector.

so if bringing a q3 model into your "standard" RHCS, just apply a -90 x rotation, and you will be good to go.

Remember that the handedness of a system can be associated with a hand by aligning the x axis with your thumb, the y with your index, and the z with your middle finger. They don't have to point "Right,up,front, as long as their relationship to each other stays the same.

From the cross product we learn that cross(x,y) = z, as well cross(,z) = x and cross(z,x) = y. Which means that as long as the vectors x,y,z stay in that order, and the fingers: thumb, index, middle stay in their own order, any vector can be associated with any finger. (ie: x= middle, y=thumb, z=index)

edit: fixed.

[Edited by - Burnt_Fyr on December 28, 2009 8:01:16 PM]

Share this post


Link to post
Share on other sites
I am under the impression that Z is up rather than down (though the default OpenGL camera is by default looking down on Z), but anyways, I think the reason Quake uses that coordinate system has to do with historic reasons rather than any particular optimizations, back in the day OpenGL was the only hardware accelerated API, so it made sence in Quake II to use its coordinate system, Quake III builds upon Quake II and so on, so that's probably the reason why.

Share this post


Link to post
Share on other sites
I will say one thing about this though. I dont know if Q3 DOES do any optimizations to this effect, BUT:

If Z is up, then you have the 3d vector {x,y,z}, where {x,y} is the 2d vector describing your position on the floor, or your direction on the floor.
So, pardon the horrific code, but:
moveFloorPos( (Vector2d*)&someVector3d );
would then be perfectly valid code, in that it compiles and works as expected. Considering the quake engine started in C, that seems like a reasonable guess at the reasoning. I'm used to working with code that takes more pointers than refrences, and uses more overloads than templates. And we tend to do the cast ((Vector3d*)&someVector4d) all the time.

I'd personally prefer references, templates, and conversion operators/constructors.

Share this post


Link to post
Share on other sites
>>I am under the impression that Z is up (WRT the world space) rather than down
yes I though that too with quake3 (I could be wrong though)

x=right screen,
y=up screen,
z=out of screen, vertically upwards in world

>>(though the default OpenGL camera is by default looking down on Z)
no opengl space is righthanded, as described above

Share this post


Link to post
Share on other sites
I prefer the 'z' up, because
1: as KulSeran mentioned for floor, getting height-map polygon index, applying wind, etc. the 2d part of a vector can be used directly
2: we (I) learned physics using that coordinate system, so it's easier to implement/imagine what's happening. (Or easier to copy physics equations from my books)
3: 3ds Max has the same CS layout in its perspective view

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this