Three.js: [io_three] Use object origin for exporting

Created on 21 Feb 2017  路  12Comments  路  Source: mrdoob/three.js

I'm currently working on a game with a lot of models which I create in Blender and export using the io_three addon. I store all of them in the same file and the same scene.

When I export them using the addon the vertices in the exported file are relative to the scene's center. As far as I've seen there's no option to make them relative to the object's origin which is very important for my game, because players can place models with their mouse cursor, that's why I need the origin.

Please add a checkbox on the export screen to enable that. :cat: :pray:

Most helpful comment

Same issue for me using r87 and Blender 2.79, ( with scene and hierarchy checked) was fixed issue by reverting blender addon back to the exporter used in r79 but still using threejs r87 for the rendering.

All 12 comments

Is this exporting the geometry only?

@mrdoob The io_three addon? It exports geometry, material settings, UV maps and a lot more.
These are the settings I use (not all of them, but those which matter):

screenshot

So yes, but the option I suggested would only affect the geometry (especially the vertices JSON property) anyway as far as I know.

Can you share an example of a file you're exporting that has the vertices relative to the scene origin?

@mrdoob I just created a new scene, moved the default Blender cube while in Object Mode (I therefore didn't move the vertices), exported it and loaded it into my scene. And it was not at 0|0|0 where I wanted it to be. And yes, after resetting the model's position in Blender, reexporting and reloading it into the scene everything worked fine, it was at 0|0|0.

If you want to recreate this just create a new Blender file, move the cube and export.

Can you share the file you created? I don't have access to Blender at the moment.

I tried

moved the default Blender cube while in Object Mode (I therefore didn't move the vertices), exported it

and I have no offset in geometry. my exporter must be older, because it does not have 'apply modifiers' option

and I have no offset in geometry. my exporter must be older, because it does not have 'apply modifiers' option

Neither do I, using latest blender (2.78c) and latest io_three (freshly downloaded from the github repo).

I can reproduce @brainscript's issue with latest blender (2.78c) and latest io_three. If I export a cube which is translated in blender, the pivot point in three.js is not in the center of the cube, but in the center of the scene (the cube's vertices being translated relatively). I used the exporter's default settings.

@makc By not having "scene" checked, you are using the geometry only exporter. I think it is making some assumptions that are not what you want.

Can you try the same experiment with "scene" checked on export, and pull your objects out of the imported scene instead?

Same issue for me using r87 and Blender 2.79, ( with scene and hierarchy checked) was fixed issue by reverting blender addon back to the exporter used in r79 but still using threejs r87 for the rendering.

The JSON Blender exporter has been removed with R93 (#14117).

Also see: https://threejs.org/docs/#manual/introduction/Loading-3D-models

Was this page helpful?
0 / 5 - 0 ratings

Related issues

filharvey picture filharvey  路  3Comments

Horray picture Horray  路  3Comments

fuzihaofzh picture fuzihaofzh  路  3Comments

seep picture seep  路  3Comments

clawconduce picture clawconduce  路  3Comments