Rajkamal Subramanian
Rajkamal Subramanian

Reputation: 6944

what is the unit for the Three js objects?

var camera = new THREE.PerspectiveCamera(
    35,         // Field of view
    800 / 640,  // Aspect ratio
    .1,         // Near
    10000       // Far
);

var cube = new THREE.Mesh(
    new THREE.CubeGeometry( 5, 5, 5 ),
    new THREE.MeshLambertMaterial( { color: 0xFF0000 } )
);

In camera, what is the unit for Near and Far parameters.

In Cube what is the unit of the parameters for CubeGeometry

Please point me to the url where, i can find details about

Object space - (the local axis used to draw an object) World space - (the global axis)

Upvotes: 9

Views: 8940

Answers (2)

heiskr
heiskr

Reputation: 405

Pretty sure these parameters are units in OpenGL. If you look at the OpenGL red book, for each in chapter 3

http://www.glprogramming.com/red/chapter03.html

There's a short paragraph here:

The preceding paragraph mentions inches and millimeters - do these really have anything to do with OpenGL? The answer is, in a word, no. The projection and other transformations are inherently unitless. If you want to think of the near and far clipping planes as located at 1.0 and 20.0 meters, inches, kilometers, or leagues, it's up to you. The only rule is that you have to use a consistent unit of measurement. Then the resulting image is drawn to scale.

So to answer your question, the units are whatever you think they should be, they are a purely relative scale.

Upvotes: 12

bhouston
bhouston

Reputation: 934

The official answer is that ThreeJS uses SI units for all measures, see here:

https://github.com/mrdoob/three.js/issues/6259

Upvotes: 7

Related Questions