3

I know 3d model (.fbx, .obj etc) files have accurate scale information. But do they also have embedded unit measurement information (inches, centimeters)? Is it possible to include units information where I draw a cube of 1*1*1 cm and then later generate another cube of 1*1*1 m. If so how interoperable are they? Can I generate these 2 different size cubes in one software(say unity or 3ds max), export fbx file and then import it in another software like playcanvas. Will they recognize the different sizes ?

MichaelsonBritt
  • 976
  • 6
  • 9
noob Mama
  • 267
  • 8
  • 28
  • I don't seem to understand wouldn't the sizes of the cubes remain across the engines because the model should look exactly like how you created it in the studio regardless of the engine you import it to. – Sharad Khanna Apr 10 '18 at 23:49
  • @op no offence but trying that out yourself would have probably taken you as long as writing the question. but there is actually more to it. in general the size of objects, both in a 3d suite and a game engine is arbitrary. a unit can be 1km, 1m, 1mm or even inches or yards or whatever strange units are used in imperial - that is for as long as you dont use the physics engine though, where size indeed does matter, but usually (at least in unity) you can change its scale. – yes Apr 11 '18 at 01:06
  • @yes Thank you, that somewhat answers my question. When I create the model of a chair in Revit and then create the model of a table in another software like 3DS, and then import them both into a third software, one of them is of the size of an elephant while the other is a rat. This is why I'm curious if there's a standard way to define measurement lengths in these 3d file formats that can be utilized which makes it more interoperable across softwares. So yes, I already tried and failed, to get this interoperability working, hence the question. – noob Mama Apr 11 '18 at 19:56
  • @noobMama i forgot to add, the "default unit size" (again as long as you dont use physics its completely arbitrary) in unity is 1unit = 1meter (if you look at the physics option for gravity its at 9.81 (m/s²), if lets say you would need the world to be 1unit = 1km youd simply scale gravity accordingly to 0.00981 (km/s²)). i guess as for the 3d modeling suits you have to figure out their scalings yourself or look that up in their forums or manual, it usually is noted somewhere. – yes Apr 12 '18 at 21:37
  • 1
    Testing this in 3ds Max suggests that FBX and 3DS do have measurement units information embedded in the file. They import with automatic resizing to current system units. However OBJ does not. Its importer requires that you manually enter the original measurement units in the file. For FBX and 3DS formats, Unity3D should be able to read the units information and rescale accordingly; if not, it's a bug or limitation worth reporting to them. – MichaelsonBritt Apr 18 '18 at 22:47

1 Answers1

0

Objects imported to Unity3D usually comes with a renderer component, most likely, MeshRenderer, you can then retrieve the size info with below code snippet:

var renderer= GetComponent<Renderer<();
var bound = renderer.bounds;
var center = bound.center;
var radius = bound.extents.magnitude;

enter image description here enter image description here

David
  • 15,894
  • 22
  • 55
  • 66