# What unit of distance in threejs?

**URL:** <https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782>\
**Category:** Questions\
**Tags:** transform\
**Created:** [November 17, 2020, 5:54am UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782 "2020-11-17T05:54:48Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evil\_Google](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/evil_google/32/11834_2.png) [@Evil\_Google](https://discourse.threejs.org/u/Evil_Google)\
**Post date:** [November 17, 2020, 5:54am UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782/1 "2020-11-17T05:54:49Z")

</div>

Hello.  
I write numbers in functions to indicate the coordinates, sizes, and so on:  
new THREE.BoxBufferGeometry( **4, 4, 2** );  
object.position.set( **4, 2, 0** );  
new THREE.Vector3( **0, 1, 3** );

Ок. What unit of distance in threejs? Meters, millimeters? 🙄

---

<div class="post-metadata">

**Author:** ![marquizzo](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/marquizzo/32/25192_2.png) [@marquizzo](https://discourse.threejs.org/u/marquizzo)\
**Post date:** [November 17, 2020, 6:02am UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782/2 "2020-11-17T06:02:27Z")

</div>

It’s a unitless system. The number `1` means whatever value you assign to it. If you want to go with meters, just make sure all units follow the same convention of meters, and you’ll have no problem.

If you want to go with inches, make sure all your measurements also assume inches, etc. It’s entirely up to you.

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [November 17, 2020, 6:04am UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782/3 "2020-11-17T06:04:53Z")

</div>

[3 years of discussion on that topic awaits you](https://discourse.threejs.org/t/units-in-three-js/1174/10), @Evil_Google.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [November 17, 2020, 10:13am UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782/4 "2020-11-17T10:13:05Z")

</div>

> [@marquizzo](#):
>
> It’s a unitless system.

Um, I would not say that. We always use the term _world units_. It’s right that you can map any concrete unit to it but usually it’s meter.

---

<div class="post-metadata">

**Author:** ![Fyrestar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fyrestar/32/52793_2.png) [@Fyrestar](https://discourse.threejs.org/u/Fyrestar)\
**Post date:** [November 17, 2020, 12:36pm UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782/5 "2020-11-17T12:36:27Z")

</div>

You can pick any kind of unit that fits your case. If you’re about to make an app on microscopic level it makes **no** sense to use a large unit that always deals with many decimal places.

Asides of having a reasonable unit for reasonable numbers to deal with, what you generally want to avoid is float precision issues which will first appear on GPU with 32bit or less, not so with JS having 64bit.

For regular scaled scenes such as the real world from a human point of view i’m using centimeter as 1 unit, meter is often used too, though you can quickly run into precision issues with WebGL depending on the size of your scene and the device which can be from super low end to super high end on this platform. I’d recommend reading the topic @mjurczyk linked.

---

<div class="post-metadata">

**Author:** ![Evil\_Google](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/evil_google/32/11834_2.png) [@Evil\_Google](https://discourse.threejs.org/u/Evil_Google)\
**Post date:** [November 21, 2020, 10:41am UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782/6 "2020-11-21T10:41:47Z")

</div>

OK, meter 🙂

sofa dimensions in 3d max

 ![s1](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/2X/a/adee06d18efdfa5dca4b6498758ec547be3be0bb.jpeg)  
create a box to check the dimensions

let t\_geo = new THREE.BoxBufferGeometry(3.421, 1.071, 1.317);  
let t\_mat = new THREE.MeshBasicMaterial({color: 0xea3fb6});  
let t\_mesh = new THREE.Mesh(t\_geo, t\_mat);  
t\_mesh.position.set(-1.3,0,0);  
t\_mesh.rotation.y = THREE.Math.degToRad(-90)  
scene.add(t\_mesh);

 ![s2](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/2X/7/7bea927c738f93fcd7014ade26da8029e6d6228a.jpeg)

In threejs the dimensions are slightly larger 🙄

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [November 21, 2020, 11:12am UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782/7 "2020-11-21T11:12:06Z")

</div>

Question - does it actually matter? Besides relative sizing between objects, user can’t really “measure” a unit in 3D space.

And if you need to calculate software-to-three size ratio, it should be enough to export a 1m x 1m x 1m cube from your software of choice and measure it using Box3. This should then give you an exact unit-to-metre ratio (which can be different for every software you export from - there are no industry rules or standards.)

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [November 21, 2020, 11:31am UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782/8 "2020-11-21T11:31:08Z")

</div>

> [@Evil\_Google](#):
>
> In threejs the dimensions are slightly larger

Are you absolutely sure that the 3DS Max exporter did not transform the sofa in some way? To be sure, check the transformation of the asset’s entire object hierarchy. And also check the raw geometry data.

---

<div class="post-metadata">

**Author:** ![felixmariotto](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/felixmariotto/32/5928_2.png) [@felixmariotto](https://discourse.threejs.org/u/felixmariotto)\
**Post date:** [November 21, 2020, 12:52pm UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782/9 "2020-11-21T12:52:00Z")

</div>

> [@mjurczyk](#):
>
> Question - does it actually matter?

I think it’s important for ray-tracing, since some materials can affect colors depending on the length rays travel in them. So even if we don’t do that in three.js, it may be a good idea to start taking good habits now, for better future interoperability.

Take [PointLight.distance](https://threejs.org/docs/#api/en/lights/PointLight.distance) for instance, if `PointLight` is to be used in `WebGLRenderer` and in a future hypothetical `RaytracingRenderer`, then `distance` must be of a certain unit, hence your scene must be scale accordingly.

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [November 21, 2020, 4:31pm UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782/10 "2020-11-21T16:31:12Z")

</div>

@felixmariotto yep, you’re right - I meant more of this thread’s context (for what I understand, just placing real-life models next to each other and maintaining proportions.)

---

<div class="post-metadata">

**Author:** ![Fyrestar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fyrestar/32/52793_2.png) [@Fyrestar](https://discourse.threejs.org/u/Fyrestar)\
**Post date:** [November 22, 2020, 2:37am UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782/11 "2020-11-22T02:37:13Z")

</div>

Rather than being forced into a specific unit system (which is not reasonable regarding the app specific world dimensions/precision issues that can occur) that should be a renderer setting defining a constant, to avoid something hardcoded as this.

---

<div class="post-metadata">

**Author:** ![felixmariotto](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/felixmariotto/32/5928_2.png) [@felixmariotto](https://discourse.threejs.org/u/felixmariotto)\
**Post date:** [November 22, 2020, 10:49am UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782/12 "2020-11-22T10:49:31Z")

</div>

I didn’t think about that, you’re right that’s even better. It’s true that floating point imprecision would be an issue with small models.

---

<div class="post-metadata">

**Author:** ![Quan\_Le](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/quan_le/32/36133_2.png) [@Quan\_Le](https://discourse.threejs.org/u/Quan_Le)\
**Post date:** [June 1, 2021, 2:37am UTC](https://discourse.threejs.org/t/what-unit-of-distance-in-threejs/20782/13 "2021-06-01T02:37:12Z")

</div>

> [@Evil\_Google](#):
>
> What unit of distance in threejs? Meters, millimeters?

Hope this helps!

> **[The Big List of three.js Tips and Tricks! | Discover three.js](https://discoverthreejs.com/tips-and-tricks/)**
>
> Lots of tips, tricks, and suggestions for best practices while building a high performance three.js application.
