Crates.io | bevy_mikktspace |
lib.rs | bevy_mikktspace |
version | 0.17.0-dev |
created_at | 2022-07-30 14:45:44.105543+00 |
updated_at | 2025-08-03 19:33:17.654535+00 |
description | Safe rust implementation of Mikkelsen tangent space algorithm |
homepage | https://bevy.org |
repository | https://github.com/bevyengine/bevy_mikktspace |
max_upload_size | |
id | 635550 |
size | 128,001 |
This is a rewrite of the Mikkelsen Tangent Space Algorithm reference implementation in Rust. It is loosely based on mikktspace
, an existing port, except bevy_mikktspace
has:
Requires at least Rust 1.85.1.
Demonstrates generating tangents for a cube with 4 triangular faces per side.
cargo run --example cube_tangents
The original reference implementation has a couple bugs,
which are largely inconsequential in most practical applications.
However, fixing them would mean diverging from exact output equivalence,
so bevy_mikktspace
offers features to control this behavior:
corrected-edge-sorting
:
Correct a comparison in the reference's edge quicksort implementation.
This can only differ on the last triangle in a model.corrected-vertex-welding
:
Guarantees the smallest-index vertex is chosen when welding.
This differs from the reference on NaN vertices.Licensed under either of
at your option. AND parts of the code are licensed under:
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Extensive fuzz-testing against the reference implementation revealed divergence in NaN handling in https://github.com/gltf-rs/mikktspace, which is probably inconsequential for practical uses. ↩