Skip to content
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

The coordinate system problem of blender to three.js #10111

Closed
3 of 12 tasks
iceleaf97 opened this issue Nov 13, 2016 · 9 comments
Closed
3 of 12 tasks

The coordinate system problem of blender to three.js #10111

iceleaf97 opened this issue Nov 13, 2016 · 9 comments

Comments

@iceleaf97
Copy link

iceleaf97 commented Nov 13, 2016

(*** This section is for bug reports and feature requests only. This is NOT a help site. Do not ask help questions here. If you need help, please use stackoverflow. ***)

Description of the problem

In this three.js scene, I put my camera at (0, 0, 80) and put a directionalLight at ( 50, 50, 50 ). Then, I create a white sphere geometry (the left sphere) and load a json model from blender (the right sphere). However, the scene showed on the screen looks weird. The directional light project on the wrong surface of the json model. It seems the problem of the coordinate system.
two sphere

The version I use is that Blender v2.78 and three.js r80

Three.js version
  • Dev
  • r82
  • r80
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • Linux
  • Android
  • IOS
Hardware Requirements (graphics card, VR Device, ...)
@Itee
Copy link
Contributor

Itee commented Nov 13, 2016

And what about three.js r82 ? Same problem ?

@michaelybecker
Copy link
Contributor

michaelybecker commented Nov 13, 2016

Commenting here to say I've noticed similar behavior in specifically similar circumstances - namely upon importing a sphere from Blender and trying to illuminate it. Both DirectionalLight and PointLight yielded surprisingly counterintuitive and seemingly wrong results. I ended up working around the anomaly (code here, live here) but the issue is definitely there.

Hope someone has an illuminating thought about it.

@Itee
Copy link
Contributor

Itee commented Nov 13, 2016

I got an 404 error for second (live) link.
What is the sphere type ? Ico or UV ? Seems to be an UVSphere, right ?

And what about the blender export, as json object, right ? And did you try with an .obj export if you got the same behavior (this could be a work around waiting fix).

For me the first thing that came up, is flipped normal (means inside the sphère, so try to flit normal before exporting your json) and give me a feedback.

@iceleaf97
Copy link
Author

iceleaf97 commented Nov 14, 2016

Here are some test results:
blender version: v2.78a
three.js version: r82
exporter: io_three
sphere type: UVsphere
model filetype: .json

【io_three before version 76】
I got a correct result
version 76
version 75

【io_three "all versions" after 77 include 82】
I got the wrong result
version 77
version 82

@zydecode
Copy link
Contributor

not sure if this is the same issue, but I solved similar to this by changing a line in one of the blender -> threejs exporter files: in exporter/api/mesh.py change line 619 from:
vector = (vector[0], vector[2], -vector[1])
to
vector = (vector[0], vector[1], vector[2])

@mrdoob
Copy link
Owner

mrdoob commented Nov 17, 2016

@zydecode would you like to do a Pull Request with the fix?

@zydecode
Copy link
Contributor

I'm happy to, as it immediately solved the issues we were having, and
we've had no more issues since implementing this fix.

I just hope that the vectors were not as they were to solve another issue..

Cheers,

Sean

On 11/16/2016 10:57 PM, Mr.doob wrote:

@zydecode https://github.com/zydecode would you like to do a Pull
Request with the fix?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#10111 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABoKkSpAmwa2JWiI4fWZdgA6TL09JjPSks5q-9CmgaJpZM4KwuiX.

@iceleaf97
Copy link
Author

@zydecode It does work! Thank you.

@mvangeest
Copy link

@iceleaf97 A pull request for this change was created (#10155) and has since been merged; if that fixes the problem, perhaps this issue can be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants