Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Three.js - what do the matrices in a 3D object represent

Looking at the source of THREE.Object3D, there are three properties: matrix, matrixWorld and matrixRotationWorld.

I see that the object's position, scale and rotation can be extracted from matrix. I also see that the world position of a point on the object can be extracted from matrixWorld.

My question:

  • Do matrix and matrixWorld represent the same information, i.e. can matrix be converted to matrixWorld, and vice versa?

  • What does matrixRotationWorld represent? What is it used for? And can it be converted to matrix and/or matrixWorld?

Thanks

like image 837
CL22 Avatar asked Feb 14 '13 12:02

CL22


People also ask

What is matrix in three js?

Three. js uses matrices to encode 3D transformations---translations (position), rotations, and scaling. Every instance of Object3D has a matrix which stores that object's position, rotation, and scale.

What is a matrix4?

A class representing a 4x4 matrix. The most common use of a 4x4 matrix in 3D computer graphics is as a Transformation Matrix. For an introduction to transformation matrices as used in WebGL, check out this tutorial.


1 Answers

object.matrix is the matrix transform of the object.

object.matrixWorld is the matrix transform of the object, taking into consideration the matrix transform of the object's parent. (The object's parent may also have a parent, so the calculation of object.matrixWorld is recursive.)

object.matrix and object.matrixWorld are identical when the object has no parent, other than the scene.

object.matrixRotationWorld no longer exists.

three.js r.69

like image 131
WestLangley Avatar answered Oct 20 '22 20:10

WestLangley