I have a simple question. I will create a cube in a 3D application (3ds max). How to create a cube of exactly the same size in Babylon.js? And years later, we are back to the same question. What units does the Babylon.js engine use?
it’s up to you to determine how much a unit is.
1 unit = 1m
1 unit = 1 cm
this is done with the modeling software. 3ds max also uses units and you define in the parameters the scale of a unit.
Thanks for the response, yes, 3ds max has the option to set the units, mm, cm…. But how to create compatibility, unit conversion ratio between some 3ds max setup and Babylon.js? This is a crucial question. This is how I repeat the question from the top of topic: how to create a cube in 3ds max, exported to Babylon.js, that will have the same size sides as the cube that I create using program code in Babylon.js: (BABYLON.MeshBuilder.CreateBox(“box”, options, scene)
In Unity, we have 1 unit = 1 meter as default. When I create a model in 3D program, I know how big it will be exactly in the Unity engine. How is it in Babylon.js?
It’s the same in Babylon I guess. If in 3ds max you define 1 unit = 1 m, in Babylon your unit will be 1 m.
Do you have a playground example containing a ‘Babylon’ cube of side 1 and an ‘imported’ cube of side 1 where the two cubes do not match?
yes, watch the situation please on playground. In 3ds max, we have size of box: 500x500x500 mm, in Babylon.js we have “some” units and we can see units are not compatible. How do I get a 1:1 cubes?
Oh yes, CORS Policy, very annoying thing, I have it turned off in my browser.
I created 1x1x1 box: units | Babylon.js Playground (babylonjs.com)
yes, i see two cubes of different sizes. The question is how to get two cubes of the same size.
well if yours was 0.5m then create a 0.5x0.5x0.5 cube. I’m not sure to get the issue
Units in modeling software are normally arbitrary, they’re just there to help the 3d modeler.
In a big scene, some objects may be 50 meters tall, some may be 1cm,
so letting devs work on a 1cm object in cm or mm units is just more user friendly, rather than having it be 0.01 in meter units.
If you make a box 500mm / 50cm / 0.5 meters, I would assume export as 0.5 units.
Of course, it all depend on the software and the exporter and your settings, maybe it would export as 500 units in some cases.
I downloaded your glb, it is 0.5 units as expected.
However in the playground, you make a box 5x5x5 units.
that would explain the difference you see.
Note that for a glTF:
The units for all linear distances are meters.
The glTF loader in Babylon.js does not do anything to these linear distances when loading. If you are loading a glTF and are working in Babylon.js in a different unit other than meters, you will need to scale the loaded model to match.