What's wrong with my lighting?

Yes. For typical glTF, they will all be Uint8Array. There are offset, strides, etc. to consider so we can’t just use Float32Array. You can use buffer.forEach function to get numbers back maybe?

1 Like

@Cedric you might need to convert with smthg like this then:

data.position = new Float32Array(data.position.buffer, data.position.byteOffset, data.position.byteLength / Float32Array.BYTES_PER_ELEMENT);

This won’t work all the time. Better to loop through the values with forEach?

but we need them in float to compute normals :slight_smile:

so we should gracefully handle when not possible or slice/dupplicate ?

This will get fixed in the next nightly by Fix Flat Shaded Generation for simple GLTF by sebavan · Pull Request #11252 · BabylonJS/Babylon.js · GitHub