Giter Site home page Giter Site logo

Comments (11)

deltakosh avatar deltakosh commented on May 22, 2024

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?

from babylon.js.

cyle avatar cyle commented on May 22, 2024

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?

from babylon.js.

cyle avatar cyle commented on May 22, 2024

So when I change lines 66, 435, and 436 to flip Z and Y, for example changing this:

file_handler.write(",\""+name+"\":[" + "%.4f,%.4f,%.4f"%(vector.x,vector.z,vector.y) + "]")

to this:

file_handler.write(",\""+name+"\":[" + "%.4f,%.4f,%.4f"%(vector.x,vector.y,vector.z) + "]")

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.

screen shot 2013-08-27 at 6 19 47 pm

Here's the way my adaptation renders it:

screen shot 2013-08-27 at 6 19 33 pm

The model should be pointing along the Y axis, which it does in my version of the exporter.

from babylon.js.

deltakosh avatar deltakosh commented on May 22, 2024

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

from babylon.js.

cyle avatar cyle commented on May 22, 2024

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!

from babylon.js.

deltakosh avatar deltakosh commented on May 22, 2024

Thank you :) I will have a look :)

from babylon.js.

deltakosh avatar deltakosh commented on May 22, 2024

According to the scene you sent, the object should point along the z axis of babylon.js (which is the Y axis of blender):
capture

So I think the exporter behave well:
original

from babylon.js.

cyle avatar cyle commented on May 22, 2024

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?

from babylon.js.

deltakosh avatar deltakosh commented on May 22, 2024

It is required by the fact that in this way, the image produced by blender is the same in babylon.js :)

from babylon.js.

cyle avatar cyle commented on May 22, 2024

Okay, cool. Just wanted to make sure that was the case. Thanks for your help!

from babylon.js.

marcusdiy avatar marcusdiy commented on May 22, 2024

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/

from babylon.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.