Difference between revisions of "Coordinate Systems"

From Verge3D Wiki
Jump to navigationJump to search
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Rendering]]
In this article you will find info on coordinate systems used in different flavors of Verge3D.
In this article you will find info on coordinate systems used in different flavors of Verge3D.


== Verge3D ==
== Verge3D ==


In Verge3D we use '''right-handed''' coordinate system with the '''Y axis''' pointing in the '''up''' direction. If we place the camera so X axis points '''right''', then the Z axis will point '''forward''' (to the viewer).
In Verge3D we use '''right-handed''' coordinate system with the '''Y axis''' pointing in the '''up''' direction. If you place the camera so X axis points '''right''', then the Z axis will point '''forward''' (to the viewer).


[[File:y_up_axis.png|640px]]
[[File:y_up_axis.png|640px]]
Line 11: Line 12:
[[File:right_handed_rotation.png|640px]]
[[File:right_handed_rotation.png|640px]]


So, it does not matter which Verge3D flavor you use: Verge3D for Blender, 3ds Max, or Maya. In all these the coordinate system is the same - Y-up.
So, it does not matter which Verge3D flavor you use: for Blender, 3ds Max, or Maya. In all these cases the ''internal'' coordinate system would be the same Y-up.


== Blender ==
== Blender ==
Line 23: Line 24:
There is one exception to this - if you're going to use JavaScript to script your apps (but not Puzzles, see below), you need to convert object coordinates from Z-up to Y-up system:
There is one exception to this - if you're going to use JavaScript to script your apps (but not Puzzles, see below), you need to convert object coordinates from Z-up to Y-up system:


  X (Blender) -> X (Verge3D)
  X (Blender) X (Verge3D)
  Y (Blender) -> -Z (Verge3D)
  Y (Blender) -Z (Verge3D)
  Z (Blender) -> Y (Verge3D)
  Z (Blender) Y (Verge3D)


  Compare screenshots above to see why Y becomes -Z.
  Compare screenshots above to see why Y becomes -Z.
Line 35: Line 36:
[[File:z_up_axis.png|640px]]
[[File:z_up_axis.png|640px]]


Now it's time for history lesson. Both Blender and 3ds Max use coordinate system which were common in early 90's. This convention is typical in architecture - you start modelling from the floor plan which uses X/Y coordinates and then extrude upwards (or downwards).
Now it's time for a history lesson. Both Blender and 3ds Max use coordinate system which were common in early 90's. This convention is typical in architecture you start modelling from the floor plan which uses X/Y coordinates and then extrude upwards (or downwards).
 
On the other hand, Maya, most game engines, graphics APIs, and of course Verge3D use another approach: your screen is a plain with X/Y coordinates while Z is the scene depth.
On the other hand, Maya, most game engines, graphics APIs, and of course Verge3D use different approach. The screen becomes a 2D plane which uses X/Y coordinates to position flat images, while Z coordinate adds depth to the scene. That's why the buffer that stores pixel depth is called Z-buffer and the issue with limited depth precision is called [[Z-fighting]].


== Maya ==
== Maya ==
Line 55: Line 56:
[[File:puzzles_axis.png]]
[[File:puzzles_axis.png]]


In case if you load scenes made in different modelling suites (for example if you run [https://www.soft8soft.com/product/verge3d-ultimate-web-interactive-suite/ Verge3D Ultimate]), we use the coordinate system of the scene which is loaded first.
In case if you load scenes made in different modelling suites (for example, if you run [https://www.soft8soft.com/product/verge3d-ultimate-web-interactive-suite/ Verge3D Ultimate]), we use the coordinate system of the scene which is loaded first.


== Coordinate System Conventions ==
== Coordinate System Conventions ==
Below you can find the comparison table of coordinate systems used in Verge3D and other 3D engines or tools:


{| class="wikitable sortable"
{| class="wikitable sortable"
Line 67: Line 70:
| Blender || Z-up || right-handed ||  
| Blender || Z-up || right-handed ||  
|-
|-
| Bullet/Ammo.js || Y-up || right-handed ||  
| Bullet/Ammo.js || Y-up || right-handed || same as in Verge3D
|-
|-
| Cinema4D || Y-up || left-handed ||  
| Cinema4D || Y-up || left-handed ||  
Line 73: Line 76:
| DirectX || Y-up || left-handed ||  
| DirectX || Y-up || left-handed ||  
|-
|-
| Houdini || Y-up || right-handed ||  
| Houdini || Y-up || right-handed || same as in Verge3D
|-
|-
| Maya || Y-up || right-handed || configurable to Z-up right-handed
| Maya || Y-up || right-handed || same as in Verge3D, configurable to Z-up right-handed
|-
|-
| OpenGL/WebGL/glTF || Y-up || right-handed ||  
| OpenGL/WebGL/glTF || Y-up || right-handed || same as in Verge3D
|-
| Three.js || Y-up || right-handed || same as in Verge3D
|-
|-
| Unity || Y-up || left-handed ||
| Unity || Y-up || left-handed ||
Line 87: Line 92:
| WebGPU || Y-up || left-handed ||  
| WebGPU || Y-up || left-handed ||  
|}
|}
== See also ==
* [http://wiki.polycount.com/wiki/Normal_Map_Technical_Details Normal Map Technical Details] - overview of normal mapping techniques and differences between modelling suites.

Latest revision as of 19:40, 28 May 2023

In this article you will find info on coordinate systems used in different flavors of Verge3D.

Verge3D

In Verge3D we use right-handed coordinate system with the Y axis pointing in the up direction. If you place the camera so X axis points right, then the Z axis will point forward (to the viewer).

Y up axis.png

Right-handed means when you place an imaginary screw perpendicular to both X and Y and then rotate X axis to Y axis, the screw goes in the direction of Z axis.

Right handed rotation.png

So, it does not matter which Verge3D flavor you use: for Blender, 3ds Max, or Maya. In all these cases the internal coordinate system would be the same — Y-up.

Blender

Blender uses right-handed coordinate system with Z axis pointing in the up direction.

Z up axis.png

This convention is different from Verge3D, however in most cases you don't need to worry about it. When you export you scene from Blender to glTF, we automatically convert all coordinates by swapping Y/Z axes. Basically, you animate and move your objects in Blender, and these movements are handled by Verge3D properly.

There is one exception to this - if you're going to use JavaScript to script your apps (but not Puzzles, see below), you need to convert object coordinates from Z-up to Y-up system:

X (Blender) →  X (Verge3D)
Y (Blender) → -Z (Verge3D)
Z (Blender) →  Y (Verge3D)
Compare screenshots above to see why Y becomes -Z.

3ds Max

Autodesk 3ds Max uses right-handed coordinate system with Z axis pointing in the up direction. This convention is similar to Blender, so everything we said about Blender is valid for 3ds Max as well.

Z up axis.png

Now it's time for a history lesson. Both Blender and 3ds Max use coordinate system which were common in early 90's. This convention is typical in architecture — you start modelling from the floor plan which uses X/Y coordinates and then extrude upwards (or downwards).

On the other hand, Maya, most game engines, graphics APIs, and of course Verge3D use different approach. The screen becomes a 2D plane which uses X/Y coordinates to position flat images, while Z coordinate adds depth to the scene. That's why the buffer that stores pixel depth is called Z-buffer and the issue with limited depth precision is called Z-fighting.

Maya

By default, Autodesk Maya uses right-handed coordinate system with Y axis pointing in the up direction.

Y up axis.png

This convention is similar to Verge3D so there is nothing to worry about, especially if you don't set World Coordinate System to Z:

Maya coordinate system.jpg

Puzzles

In Puzzles we use coordinates depending on the loaded scene. If the scene was made in Blender or 3ds Max, we use Z-up coordinate system. If the scene was exported from Maya, we use Y-up coordinate system. That means, that in Puzzles you stick to the coordinate system of your modelling suite.

Puzzles axis.png

In case if you load scenes made in different modelling suites (for example, if you run Verge3D Ultimate), we use the coordinate system of the scene which is loaded first.

Coordinate System Conventions

Below you can find the comparison table of coordinate systems used in Verge3D and other 3D engines or tools:

Software / Standard Default System Handedness Notes
3ds Max Z-up right-handed
Blender Z-up right-handed
Bullet/Ammo.js Y-up right-handed same as in Verge3D
Cinema4D Y-up left-handed
DirectX Y-up left-handed
Houdini Y-up right-handed same as in Verge3D
Maya Y-up right-handed same as in Verge3D, configurable to Z-up right-handed
OpenGL/WebGL/glTF Y-up right-handed same as in Verge3D
Three.js Y-up right-handed same as in Verge3D
Unity Y-up left-handed
Unreal Engine Z-up left-handed
Verge3D Y-up right-handed
WebGPU Y-up left-handed

See also