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

MeshReflectorMaterial: wrong reflections if applied on a GLB plane exported from Blender #2355

Open
davcri opened this issue Feb 17, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@davcri
Copy link
Contributor

davcri commented Feb 17, 2025

Problem description:

MeshReflectorMaterial works fine for a planeGeometry created from ThreeJS, however it doesn't work out of the box for a plane geometry exported from Blender.

What I noticed is that it produces wrong reflections by default:

Image

Correct reflections:
Image

Workarounds

There are 2 workaorunds: one from Blender and one from JS (but requires patching the material source code).

In Blender:

  • add a Plane
  • enter in edit mode
  • rotate all the vertices by 90° on the X axis
  • enter object mode
  • rotate the object by -90° on the X axis
  • export the GLB

In JS:

I'm not sure if it's possible to derive a normal from a GLB plane programmatically though.

Relevant code:

In this codesanbox:

  • model1.glb is a Plane exported directly from Blender
  • model2.glb is a Plane exported with the workaround applied

https://codesandbox.io/p/sandbox/376kv7

@davcri davcri added the bug Something isn't working label Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant