Skip to content

GLTFLoader: Inconsistent lighting on objects with negative scaling #31994

@akkara

Description

@akkara

Description

When SketchUp Components are mirrored (using negative scale values) and then imported into Three.js, the lighting/shading of those objects is compiled incorrectly. Since mirrored instances still reference the original Component definitions, the problem consistently appears for every mirrored element those scaled with negative values.

The only workaround is to "Explode" every mirrored Component inside SketchUp before exporting. However, this is impractical, since architects and engineers deliver the models to me with Components, and every revision requires me to manually find and explode mirrored Components again.

Suggested fix

When importing SketchUp models, Three.js should ensure that geometry vertices are processed with positive scale values, so that mirrored instances don’t cause shading/light compilation errors.

Reproduction steps

  1. In SketchUp, create a Component.
  2. Add mirrored instances of this Component using negative scale values (e.g. -1).
  3. Export the model and load it into Three.js.
  4. Observe the incorrect lighting on mirrored instances.

Code

none

Live example

https://akkara.github.io/threejs-scaled-components/scaled.html

Screenshots

Image

Version

r179

Device

Desktop

Browser

Chrome

OS

Windows

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions