CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.92k stars 3.48k forks source link

Wrong normals for instanced models with node scaling in glTF #11477

Open javagl opened 1 year ago

javagl commented 1 year ago

The attached archive contains a tileset with three contents:

The non-uniform scaling of the node that refers to the EXT_mesh_gpu_instancing causes some error with the computation of the normals:

Bottom: Box.glb Center: boxScaled.i3dm Top: boxScaled.glb

Cesium instances normal issue

The effect is highly dependent on the view direction...

Cesium instances normal issue 2

This may be a hint that there's likely some place where the transformation of the normals with the transpose of the inverse of the modelview matrix does not properly take into account the matrix of the node that the instancing extension is attached to...

The archive with the tileset, tiles, and a Sandcastle for quick tests:

CesiumJS_instancing_normal_issue.zip

ggetz commented 1 year ago

Thanks for the report @javagl!

Next think I'd suggest is to check whether this is a regression that was introduced in 1.97, or if the issue was pre-existing.