Jump to content

Wavefront OBJ Import


photo

Recommended Posts

Posted

Hello everyone,

We currently have a plugin that generates navmeshes in our world. It works perfectly well, and in order to exchange with some legacy module we have to export those meshes in OBJ files. Pretty straightforward. The coordinates of the vertices in these OBJs are in Unigine world space (generally, we also do some local space).

However when we try to import those obj in Unigine, it seems to apply an implicit conversion that is highly irregular. The vertices' X is inverted and the whole thing is rotated. The import options are set to default, which should not make any transformation (since our OBJ is already in Unigine coordinate system, with y forward and Z upward).

We have verified this using a small visualization tool where we placed 3D objects/points at the OBJ's vertex positions, so we know it's the import that is doing what we don't want.

So I had multiple questions:
 

  1. What does Unigine expects in a Wavefront OBJ ? I didn't think OBJ came with a specific coordinate system.
  2. Is there any way to turn off this kind of import operation for OBJs ?
  3. Can we write our own importer for OBJ ?
  4. I tried to change Front Axis/Up axis in every possible configurations, and I realised some of those were ignored (your choice is ignored, and when you deselect/select again the OBJ you see that Unigine reverted to default choice...)

 

We have to use OBJ, and we have to express the vertices in the Unigine coordinate system. The generated navmesh still works, because our legacy module knows the mesh is in Unigine coordinate system, and doesn't try to modify things. But that's kind of silly that we can't import a text-based OBJ file which is already in the correct coordinate system. That would be great for debug.

Posted

Hi Kevin,

Is it possible to share this OBJ with us so we can see how it really needs to look like?

Quote

The import options are set to default, which should not make any transformation (since our OBJ is already in Unigine coordinate system, with y forward and Z upward)

We are always applying additional transformations to all the external 3D models on import, including OBJ, FBX, GLTF and others. We do not apply any transformations for the .MESH files.

There might be some additional bugs in the importers in old SDK versions (2.18 / 2.19) with some combinations of import axes. Importer may produce unexpected results (usually when you are overriding up axis as -x, and front axis as -z).

  1. Importer expects up=Y front=Z (we are using Autodesk FBX SDK for 3ds / obj / fbx imports);
  2. No;
  3. Sure, you can do that;
  4. In attachment you can find a simple obj exported with up=Y and front=Z which produce correct results after import

axes.zip

image.png

If you have some script that writes (X, Y, Z) values directly into the obj, you would need to make order slightly different so default importer will read that and translate correctly: (-X, Z, Y).

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

×
×
  • Create New...