-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exporting from Blender: Y and Z axes are flipped #31
Comments
This Is intentional because Babylon.js uses a system with y up. My blender uses a system with z up so I flip them to keep a visual continuity. Does your blender use a y up coordinates system? |
No, my blender (default install of the latest version on either Mac or Windows) uses a Z-up coordinate system. In the default 3D view, there's an X and Y grid with Z going up and down. So when I make a model that, for example, stays on Z = 0 but has objects along the X and Y axis, importing it into Babylon flips it on its side (since Z = Y in Babylon). I'll try changing the exporter code around to see if it fixes the issue. Or is there a way to change the coordinate system to be Y-up in Blender? |
So when I change lines 66, 435, and 436 to flip Z and Y, for example changing this:
to this:
It works, but the model's textures seem to render inverted somehow. Here's an image of the way the existing export plugin renders in Babylon. The three cubes are the X (red), Y (green), and Z (blue) axes. Here's the way my adaptation renders it: The model should be pointing along the Y axis, which it does in my version of the exporter. |
It is cool that you can have what you want but there is something I do nor understand here:) Could you share a blender scene you created? I would like to test because for me the y/z inversion is required |
Definitely -- here's the files I've used to demo the issue: https://github.com/cyle/babylonjs-model-test Just want to say that this project is amazing. I'm extremely impressed with how quickly I've been able to rig up a good-looking 3D game in no time with Javascript in the browser. This is an excellent project and I'm super excited to see it get even better. Thank you for all of your work! |
Thank you :) I will have a look :) |
Okay, so that's how it should work between Blender and Babylon.js. So if we make models in Blender that we want to use in Babylon.js, we just need to make them along the Y axis if we expect them to be oriented correctly in Babylon.js. Is there any way Babylon.js could be changed so it works the other way, or is it required for the engine? |
It is required by the fact that in this way, the image produced by blender is the same in babylon.js :) |
Okay, cool. Just wanted to make sure that was the case. Thanks for your help! |
Yep. Seems like this problem was not solved. Exporting with "Preserve Z-up right-handed" doesnt work eighter. I tried to export using Blender 2.91.2 and for preview https://sandbox.babylonjs.com/ |
Hello again. I'm having a weird issue exporting models from Blender into Babylon.js -- it seems that the axes get flipped around. For example, if I make a cone in Blender and point it upwards along the Z axis, it imports into Babylon as pointing along the Y axis. Putting a sphere at (x = 0, y = 0, z = 1) in Blender results in the item importing as (x = 0, y = 1, z = 0) in Babylon.js. Is this something that could be fixed in the exporter? It looks like line 66 of io_export_babylon.py is flipping the Y and Z coordinate -- is that intentional? It seems to also be the case on lines 435 and 436, as well. Any help would be appreciated! Thanks.
The text was updated successfully, but these errors were encountered: