Jump to content

How to automatically invert Z-axis?


ozRocker
 Share

Recommended Posts

When I import OBJs the Z-axis is the wrong way around.  I saw in the documentation that you're meant to make sure -Z axis is forward, but I'm trying to figure out a way where I can flip my Z-axis without having to open the OBJ in Blender and re-exporting it.  This is because I want other users to upload OBJs to the virtual world.  I don't want to ask them all to download Blender, import OBJ then export again.  Is there a way I can alter the mesh or importer to negate the Z-axis?  I tried negative scale on the Z axis but it makes the normals point the wrong way and screws things up

Link to comment
Share on other sites

This could happen when obj are saved in right handed mode. You can ask the scene to switch to right handed but in this case ALL meshes have to be right handed (scene.useRightHandedSystem = true)

Else here are the updates to do to your mesh:

- Invert Z (or swap Y and Z depending on the original system) on all vertices

- Invert normals (same way)

- Change culling mode to CW (mat.sideOrientation = BABYLON.Material.ClockWiseSideOrientation)

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...