Answers is deprecated.

Please use Forum to participate in community by asking and answering questions!

This is more of a bug report than a real question, but I don't know where else to post this. Is there a bug tracker somewhere? Anyway I read that "PlayCanvas treats 1 unit as 1 meter", so I made a simple plane in Blender and exported it as OBJ. Here's the file:

# Blender v2.68 (sub 0) OBJ File: ''
# www.blender.org
mtllib plane.mtl
o Plane
v 0.500000 0.000000 0.500000
v -0.500000 0.000000 0.500000
v 0.500000 0.000000 -0.500000
v -0.500000 0.000000 -0.500000
vt 0.000100 0.000100
vt 0.999900 0.000100
vt 0.000100 0.999900
vt 0.999900 0.999900
g Plane_Plane_None
usemtl None
s off
f 2/1 1/2 4/3
f 1/2 3/4 4/3

The critical part here are the v instructions that define the vertex positions. As you can see Blender exports them correctly. Still, when you import this file in PC the model is 100x smaller. If I import the same file in Unity the scale is correct.

PS: I have the same problem when I export my model to FBX.

asked 06 Oct '14, 21:57

nickjanssen's gravatar image

nickjanssen
5113
accept rate: 0%

edited 06 Oct '14, 22:05


TL;DR

To export models from Blender either:

  1. Use the FBX exporter from Blender 2.72 and up.
  2. Use the OBJ exporter and set the scale to 100 in the export settings

I've created a test project to show some of the different programs, file-formats and settings can effect importing.

http://playcanvas.com/dave/scale_test

The pack contains a bunch of models which should be labelled according to how they were exported.

NOTE: I used Blender 2.72 for this. Blender 2.7 introduced a new FBX exporter which is much better. The earlier version of the blender fbx exporter was no good.

Summary:

Blender:

  • FBX: As long as you are using the latest FBX exporter, a 1x1x1 cube appears in PlayCanvas as a 1x1x1 cube
  • COLLADA: A 1x1x1 cube appears in PlayCanvas as a 1x1x1 cube
  • OBJ: A 1x1x1 cube appears in PlayCanvas as a 0.01x0.01x0.01 cube

Maya LT:

  • FBX: A 1x1x1 cube with units set to meters, appears in PlayCanvas as a 1x1x1 cube
  • COLLADA: Didn't test
  • OBJ: A 1x1x1 cube with units set to meters appears in PlayCanvas as a 1x1x1 cube

Notice the difference between behaviour of OBJ from Maya and Blender. Basically as OBJ has no units defined an arbitrary choice is made by programs about what scale to import at. Blender chooses 1 unit = 1 metre. Maya chooses 1 unit = 1 centimetre.

To counter act the differences, Blender lets you scale objects when you export them.

alt text

To export an OBJ at the correct scale simply set the scale to 100 when exporting (Blender will remember this setting, so you only need to set it once).

link

answered 07 Oct '14, 17:11

dave's gravatar image

dave ♦♦
4.3k1530
accept rate: 42%

Thanks for the extended answer and demo! I was indeed using Blender 2.69, that explains a lot. It's a shame about the OBJ's but I can live with the scale setting.

(08 Oct '14, 13:41) nickjanssen

Thanks Nick, it is frustrating that OBJs are handled differently by different programs. On the plus side if you use FBX it supports materials and texture embedding...

(08 Oct '14, 13:55) dave ♦♦

There is an issue tracker, yes, but only for the engine project. It's perfectly OK to put bug reports either there or on here.

OBJ is not like FBX. FBX files carry the units that determine the real world size of objects that they contain. However, as you can see from the contents of your OBJ file, there are no units. So the vertices could really mean anything: centimeters, meters, inches and so on.

It just so happens that when 3DS Max or Maya export a meter cubed cube to OBJ, the vertices are at -50 to 50. So clearly, these apps have decided to serialize OBJ vertices in centimeters. Blender, on the other hand, seems to want OBJ vertices to be serialized in meters.

This is one of the reasons we recommend using FBX instead of OBJ. It's a much more robust, compact and better tested file format....and what you see in the modelling app is generally what you'll get after import to PlayCanvas.

I'm not sure how Unity works in this area. Perhaps it treats units from imported OBJ files as centimeters and perhaps incorrectly scales OBJ from Max and Maya? Or maybe you can override units on import? I would have to look at the behavior there before I can make a call on exactly what's going on...

link

answered 06 Oct '14, 23:17

will's gravatar image

will ♦♦
5.7k11224
accept rate: 46%

So by default PC assumes OBJ units are centimers? This is kind of contradicting with "PC treats 1 unit as 1 meter"? Also Three.js reads the OBJ fine and treat units as meters (try the three.js editor) so why would you do it differently? Personally I find it very strange to read them as centimers and not as actual editor units ("meters").

(07 Oct '14, 09:45) nickjanssen

Also how is FBX more compact? My OBJ is 300 bytes compared to the 60kb FBX file that Blender spits out. As for your recommendation towards FBX, then why support the importing of OBJ at all if it doesn't work? There's clearly something broken if it works fine on all other tools I've used. On top of that I can't even get the same simple plane to have the correct scale in FBX format. Please see my PC project.

(07 Oct '14, 09:45) nickjanssen

Just a side note, which version of Blender are you using? I discovered today that Blender 2.72+ has much better support for FBX.

(07 Oct '14, 17:12) dave ♦♦

Actually - by default in an OBJ a unit is a "unit". It's up to the interpreting application to assign what that unit is. If your working scale is 1 unit = 1 meter, then that's what a unit is. A unit is an abstraction. What matters is that the unit in the text of the OBJ file should correspond to a unit in the host application. Maya defaults to units being in centimeters (this can be changed in the preferences), so their models appear to be 100x too big when imported into packages expecting a unit to be a meter. If Playcanvas is shrinking OBJs so that cm models equal Playcanvas' meter scale, then something is wrong in their assumptions. Either modelers need to learn to set units, or Playcanvas could give a scale on import option. Sorry - I've been working with OBJs since the early 90s across a bunch of different applications in different industries - they're amazingly straightforward. Units trip up a lot of people - especially when it comes to integrating models and dynamics. And bizarrely enough - it's pretty common in VFX to run into the "decimal inch" - one 10th of a foot, because us Americans can't relate to a meter but still like having things divisible by 10. At DWA we called them "shrekels".

link

answered 25 Dec '16, 08:05

sukotto1's gravatar image

sukotto1
0
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×9
×2

Asked: 06 Oct '14, 21:57

Seen: 10,897 times

Last updated: 25 Dec '16, 08:05

about | privacy | support | contact

playcanvas