secondlife / viewer

🖥️ Second Life's official client
GNU Lesser General Public License v2.1
199 stars 46 forks source link

Generate normals and tangents according to GLTF Specification #1654

Open RunitaiLinden opened 3 weeks ago

RunitaiLinden commented 3 weeks ago

Test model: https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/PrimitiveModeNormalsTest

Test plan

  1. Download each of the assets from the glTF folder of the Test model.
  2. Create a box in Second Life.
  3. While the box is selected in edit mode, click Develop menu > GLTF > Open....
  4. Choose the .gltf file of the Test model.
  5. Verify the model appears in-world and matches the Screenshot on Test model page.

GLTF Spec declares:

When tangents are not specified, client implementations SHOULD calculate tangents using default MikkTSpace algorithms with the specified vertex positions, normals, and texture coordinates associated with the normal texture.

When normals are not specified, client implementations MUST calculate flat normals and the provided tangents (if present) MUST be ignored.

Source: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#meshes

Test:

https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/PrimitiveModeNormalsTest

vladyslavasproductengine commented 6 days ago

Pass QA. Verified on the Second Life Release 7.1.9.9620320242 (64bit) on Win10/OSX in scope https://github.com/secondlife/iqa/issues/266.