Blender Exporter 6.3 Position Issues

Hi everyone,

I am struggling with positioning issues when exporting a set of meshes in blender. I have a model that I downloaded and it has been cutted into several pieces. All those pieces have their own origin set and everything worked fine. However, I recently split some more of the geometry off into new meshes by selecting the affected faces and creating a new object from them.

For all meshes that are a result of this operation, their global positional offset within the scene is added to the origin when I import them into my babylonjs scene. For the other meshes (that have just been cutted with the knife before), this is not a problem. Currently my only workaround is to set the position of all meshes to 0,0,0 before exporting, but that’s not really nice because then they all overlap and that makes the original scene hardly “readible”.

I tried doing a “Clear Parent” operation since I expected there to be some weird hidden parenting or something similar going on, but I just can’t find out what causes this. In babylonjs, I am using SceneLoader.ImportMeshes to import the file and then I explicitly reference meshes within the scene and reposition them.

It’s not really a major issue, since resetting the position helps, but it’s a silly workaround and it would be great to know if there are known issues in that area or if someone else experienced this and knows why that happens.

Be aware that this problem occurs in blender 2.79 with the older exporter as well as in 2.8.2 with the new exporter.

If I need to provide more details, let me know.

Hey @jacquesr, can you try Applying All Transforms to set Location to all 0, Rotation to all 0, and Scale to all 1 before exporting, as shown in the images below?


Hi,

as I said. I don’t want to. If I do this, everything works fine. If I don’t, some of the meshes are exported with their origin and some are exported with their origin being their origin + their global offset.

The behavior is simply inconsistent and there must be a (to me very unobvious) reason.

They all have no rotation and scaling 1,1,1

Instead of setting the position of these meshes to 0,0,0 using Blender move operations, can you use Ctrl + A to apply Location? This will make the mesh’s Location read as 0,0,0 without actually moving the mesh to 0,0,0 in Blender.

Adding @JCPalmer to this thread as he is the Blender exporter master :slight_smile:

I am pretty sure there is a good reason for it.

I think this may have to do with what the origin of the vertices (that dot when the mesh is selected) is. That is what the position is relevant to.

Here I took the default scene, put the cube into edit mode, selected a face, then rightclick->separate->selection. Now I have two meshes with vertices that share the same relative origin. I then moved the carved out face to x position of 4, and that is EXACTLY where the DOT is, but the mesh is at 5.
separatebyselection

When you separate meshes, I assume it is to move the pieces independently, otherwise why bother. The vertices in this case all have 1 for the x, and will be exported that way. This is not really considered a transform, so it is not un-doable as such.

You can just change the origin of all of the vertices in a number of ways to more reflect what you are expecting. One way is thru right clicking the mesh in object mode & using the menu.

Please verify where the origins of the vertices of your meshes are. I do not believe this has anything to do with the exporter.

Hi,

my mesh origins are all correct, assuming that blender shows me the correct data. I doubt that this can be wrong.

As I said. It’s just wrong for the meshes that I “extracted” from other meshes. I cared for adapting all origins after creating new meshes from existing geometry.

I will try to get a reproducable example that I can send you guys. Unfortunately, it’s a paid model bought from a 3D model store and thus I can’t simply share the file with you.

I do have a log file for the exporter. One reason was so it could be shared even though the geometry couldn’t. It does not show what the position of each mesh was set to though.

First, you could just open the .babylon file with Wordpad. It is a text file. Do a find on the name of the mesh. Properties like position, rotation, & scale are all on that same line, and very close. How does that compare to what Blender has? If they are the same, then something is affecting the values of the positions of each vertex.

The other thing to check is are there any modifiers on the meshes. When meshes are split, the modifiers are as well. Modifiers are taken into account during export. Definitely something to rule out.