zeux / meshoptimizer

Mesh optimization library that makes meshes smaller and faster to render
MIT License
5.67k stars 481 forks source link

gltfpack: Remove normal streams from meshes with unlit materials #633

Closed zeux closed 11 months ago

zeux commented 11 months ago

Unlit materials do not require normals or tangents; we already automatically filter out tangents because of the lack of normal texture or other material extensions, but normals were not removed until now.

This can reduce the amount of geometry we need to output; this also mostly subsumes the redundant normal stream filtering for point clouds as point clouds often have an unlit material, but for now we'll keep that redundancy.

When material variants are used, we only do this when all material variants for a given mesh are unlit. The use of the default material also blocks this optimization as default material implies basic lighting.