Jump to content

Blender Export Rotations


port9001
 Share

Recommended Posts

Probably a good question for @JCPalmer:

I am looking for some advice regarding rotations of exported Blender models. During the creation of the two models below I used the Blender alignments, i.e. I used front view when editing the front of the model, right view to edit what I considered the right side, etc. However, when I export them they have different alignments than expected. 

ns2TFzw.png

The box model is just a simple test cube. It does not have an armature. The "dude" model does have an armature. Still, it is aligned with the same axes as the box. Neither model has any rotation (all 0's). Both are using the default XYZ Euler rotation mode. The dude is slightly elevated (y axis) but is otherwise at 0, 0. I would not expect the red dot to be visible in the Babylon shot. I have not rotated either mesh in Blender, only imported them with SceneLoader.ImportMesh.

Link to comment
Share on other sites

Since both are at zero, you must have multiple blends.  BTW, if a mesh with an armature is attempted to be exported with rotation or scaling un-applied, the export terminates with a message to apply it.

self.fatalError = 'Mesh: ' + mesh.name + ' has un-applied transformations.  This will never work for a mesh with an armature.  Export cancelled'

Make sure you armature in rest pose is all I can think of.  Change to 'POSE' mode, select all bone <A> toggle. Clear rotations <Alt R>, Clear Locations <Alt G>,  clear Scale<Alt S>.

Link to comment
Share on other sites

Yes, I am working with multiple blends. Perhaps that is not ideal? I'm still working out what the right workflow would be Blender -> Babylon so open to changing things up if it makes it easier.

Unfortunately switching to a rest mode didn't change anything. Strangely I noticed whenever I export it always switches to the last action after the export is complete. I had to create an action with the name "zrest" to prevent this from happening.

Perhaps I'll try recreating my models into one blend file and seeing if that helps.

Link to comment
Share on other sites

  • 2 months later...

@port9001 and @JCPalmer. I think I've reproduced this (exactly backwards) result a few times, and starting to understand it better. Here are my notes and potential workaround. And potential insight for a solution. 

Just recently experienced a "backwards" export from blender to .babylon. So got meticulous to try and figure it out as much as possible.

The mesh was in a state of: rotated, appliedreverted origin to center mass,  then rotated again (so as to export the rotation) RESULT = backward export.

Why? This could reasonably happen in the case where a mesh export -  need not Apply.

HOW TO TEST THIS:

1) confirmed normals in blender vs. local showAxis() in babylon.  2) Y+ moves it Y- (in localspace). 

 WORK-AROUND -SOLUTION:

      SPECIFIC CASE(again): a plane was rotated then applied, then origin to center to get origin location for translation and exported = backwards.

       Had to re-create the planes to avoid export pretzel - and it worked.

       1) Re-created the planes.

       2) transformed, scaled, and rotated.

       3) DID NOT apply Translation in blender. (Instead use cursor center plane to maintain localspace placements to parent object);

       4) DID NOT apply Rotation in blender. (to allow parent to pass rotation to child objects. check the mesh.rotation in debugger).

UPDATE:

       5) DID need to apply scale. What a tightrope.

       AND I see no way around this. The specificity is required. AND I think the problem is that it isn't very obvious in Blender. 

       ... of HOW APPLY effect BABYLON WORLDSPACE/LOCALSPACE.

       What is a clear cut rule, of when to APPLY and when NOT to APPLY.... (is the question). So here goes:

       Emerging rule of Thumb:

                  1) APPLY RTS to remove localspace offsets (if you do not want them).

                  2) Do NOT APPLY if you wish to keep localspace offsets.

                  3) Depending on what you are building - Sometimes it is a MIX of what should be applied and what should not be applied in RTS.

                  4) If you get it wrong and apply something that should not be applied - if you go back - (reset origin) you might experience 'backward export rotation' (above).

                             a) if that happens - follow the solution (above) of re-creating the mesh - without applying one or all of RTS (rotation, translation, scale).

... welcome to the jungle...  : ) 

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...