mirror of
https://github.com/bevyengine/bevy
synced 2024-12-20 18:13:10 +00:00
bdef86ea6e
# Objective Models can be produced that do not have vertex tangents but do have normal map textures. The tangents can be generated. There is a way that the vertex tangents can be generated to be exactly invertible to avoid introducing error when recreating the normals in the fragment shader. ## Solution - After attempts to get https://github.com/gltf-rs/mikktspace to integrate simple glam changes and version bumps, and releases of that crate taking weeks / not being made (no offense intended to the authors/maintainers, bevy just has its own timelines and needs to take care of) it was decided to fork that repository. The following steps were taken: - mikktspace was forked to https://github.com/bevyengine/mikktspace in order to preserve the repository's history in case the original is ever taken down - The README in that repo was edited to add a note stating from where the repository was forked and explaining why - The repo was locked for changes as its only purpose is historical - The repo was integrated into the bevy repo using `git subtree add --prefix crates/bevy_mikktspace git@github.com:bevyengine/mikktspace.git master` - In `bevy_mikktspace`: - The travis configuration was removed - `cargo fmt` was run - The `Cargo.toml` was conformed to bevy's (just adding bevy to the keywords, changing the homepage and repository, changing the version to 0.7.0-dev - importantly the license is exactly the same) - Remove the features, remove `nalgebra` entirely, only use `glam`, suppress clippy. - This was necessary because our CI runs clippy with `--all-features` and the `nalgebra` and `glam` features are mutually exclusive, plus I don't want to modify this highly numerically-sensitive code just to appease clippy and diverge even more from upstream. - Rebase https://github.com/bevyengine/bevy/pull/1795 - @jakobhellermann said it was fine to copy and paste but it ended up being almost exactly the same with just a couple of adjustments when validating correctness so I decided to actually rebase it and then build on top of it. - Use the exact same fragment shader code to ensure correct normal mapping. - Tested with both https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/NormalTangentMirrorTest which has vertex tangents and https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/NormalTangentTest which requires vertex tangent generation Co-authored-by: alteous <alteous@outlook.com>
114 lines
2.2 KiB
Text
114 lines
2.2 KiB
Text
v 0.5 -0.5 0.5
|
|
v 0.5 -0.5 -0.5
|
|
v 0.5 0.5 -0.5
|
|
v 0.5 0.5 0.5
|
|
v 0.5 0 0
|
|
v -0.5 0.5 0.5
|
|
v -0.5 0.5 -0.5
|
|
v -0.5 -0.5 -0.5
|
|
v -0.5 -0.5 0.5
|
|
v -0.5 0 0
|
|
v 0.5 0.5 0.5
|
|
v 0.5 0.5 -0.5
|
|
v -0.5 0.5 -0.5
|
|
v -0.5 0.5 0.5
|
|
v 0 0.5 0
|
|
v -0.5 -0.5 0.5
|
|
v -0.5 -0.5 -0.5
|
|
v 0.5 -0.5 -0.5
|
|
v 0.5 -0.5 0.5
|
|
v 0 -0.5 0
|
|
v -0.5 0.5 0.5
|
|
v -0.5 -0.5 0.5
|
|
v 0.5 -0.5 0.5
|
|
v 0.5 0.5 0.5
|
|
v 0 0 0.5
|
|
v 0.5 0.5 -0.5
|
|
v 0.5 -0.5 -0.5
|
|
v -0.5 -0.5 -0.5
|
|
v -0.5 0.5 -0.5
|
|
v 0 0 -0.5
|
|
vn 0.57735026 -0.57735026 0.57735026
|
|
vn 0.57735026 -0.57735026 -0.57735026
|
|
vn 0.57735026 0.57735026 -0.57735026
|
|
vn 0.57735026 0.57735026 0.57735026
|
|
vn 1 0 0
|
|
vn -0.57735026 0.57735026 0.57735026
|
|
vn -0.57735026 0.57735026 -0.57735026
|
|
vn -0.57735026 -0.57735026 -0.57735026
|
|
vn -0.57735026 -0.57735026 0.57735026
|
|
vn -1 0 0
|
|
vn 0.57735026 0.57735026 0.57735026
|
|
vn 0.57735026 0.57735026 -0.57735026
|
|
vn -0.57735026 0.57735026 -0.57735026
|
|
vn -0.57735026 0.57735026 0.57735026
|
|
vn 0 1 0
|
|
vn -0.57735026 -0.57735026 0.57735026
|
|
vn -0.57735026 -0.57735026 -0.57735026
|
|
vn 0.57735026 -0.57735026 -0.57735026
|
|
vn 0.57735026 -0.57735026 0.57735026
|
|
vn 0 -1 0
|
|
vn -0.57735026 0.57735026 0.57735026
|
|
vn -0.57735026 -0.57735026 0.57735026
|
|
vn 0.57735026 -0.57735026 0.57735026
|
|
vn 0.57735026 0.57735026 0.57735026
|
|
vn 0 0 1
|
|
vn 0.57735026 0.57735026 -0.57735026
|
|
vn 0.57735026 -0.57735026 -0.57735026
|
|
vn -0.57735026 -0.57735026 -0.57735026
|
|
vn -0.57735026 0.57735026 -0.57735026
|
|
vn 0 0 -1
|
|
vt 0 0
|
|
vt 0 1
|
|
vt 1 1
|
|
vt 1 0
|
|
vt 0.5 0.5
|
|
vt 1 0
|
|
vt 1 1
|
|
vt 0 1
|
|
vt 0 0
|
|
vt 0.5 0.5
|
|
vt 0 0
|
|
vt 0 1
|
|
vt 0 1
|
|
vt 0 0
|
|
vt 0 0.5
|
|
vt 0 0
|
|
vt 0 1
|
|
vt 0 1
|
|
vt 0 0
|
|
vt 0 0.5
|
|
vt 0 0
|
|
vt 0 1
|
|
vt 1 1
|
|
vt 1 0
|
|
vt 0.5 0.5
|
|
vt 1 0
|
|
vt 1 1
|
|
vt 0 1
|
|
vt 0 0
|
|
vt 0.5 0.5
|
|
f 1/1/1 2/2/2 5/5/5
|
|
f 2/2/2 3/3/3 5/5/5
|
|
f 3/3/3 4/4/4 5/5/5
|
|
f 4/4/4 1/1/1 5/5/5
|
|
f 6/6/6 7/7/7 10/10/10
|
|
f 7/7/7 8/8/8 10/10/10
|
|
f 8/8/8 9/9/9 10/10/10
|
|
f 9/9/9 6/6/6 10/10/10
|
|
f 11/11/11 12/12/12 15/15/15
|
|
f 12/12/12 13/13/13 15/15/15
|
|
f 13/13/13 14/14/14 15/15/15
|
|
f 14/14/14 11/11/11 15/15/15
|
|
f 16/16/16 17/17/17 20/20/20
|
|
f 17/17/17 18/18/18 20/20/20
|
|
f 18/18/18 19/19/19 20/20/20
|
|
f 19/19/19 16/16/16 20/20/20
|
|
f 21/21/21 22/22/22 25/25/25
|
|
f 22/22/22 23/23/23 25/25/25
|
|
f 23/23/23 24/24/24 25/25/25
|
|
f 24/24/24 21/21/21 25/25/25
|
|
f 26/26/26 27/27/27 30/30/30
|
|
f 27/27/27 28/28/28 30/30/30
|
|
f 28/28/28 29/29/29 30/30/30
|
|
f 29/29/29 26/26/26 30/30/30
|