bevy/crates
Robert Swain bdef86ea6e Generate vertex tangents using mikktspace (#3872)
# 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>
2022-05-31 22:53:54 +00:00
..
bevy_animation Clippy improvements (#4665) 2022-05-31 01:38:07 +00:00
bevy_app Clippy improvements (#4665) 2022-05-31 01:38:07 +00:00
bevy_asset Clippy improvements (#4665) 2022-05-31 01:38:07 +00:00
bevy_audio Clippy improvements (#4665) 2022-05-31 01:38:07 +00:00
bevy_core Split time functionality into bevy_time (#4187) 2022-05-26 00:27:18 +00:00
bevy_core_pipeline ExtractResourcePlugin (#3745) 2022-05-30 18:36:03 +00:00
bevy_derive Decouple some dependencies (#3886) 2022-04-27 19:08:11 +00:00
bevy_diagnostic Split time functionality into bevy_time (#4187) 2022-05-26 00:27:18 +00:00
bevy_dylib Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_dynamic_plugin Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_ecs Derive default on ReportExecutionOrderAmbiguities (#4873) 2022-05-31 15:54:38 +00:00
bevy_ecs_compile_fail_tests Make derived SystemParam readonly if possible (#4650) 2022-05-09 16:09:33 +00:00
bevy_encase_derive Migrate to encase from crevice (#4339) 2022-05-18 21:09:21 +00:00
bevy_gilrs Update gilrs to v0.9 (#4848) 2022-05-30 17:26:23 +00:00
bevy_gltf Generate vertex tangents using mikktspace (#3872) 2022-05-31 22:53:54 +00:00
bevy_hierarchy Support returning data out of with_children (#4708) 2022-05-17 22:37:51 +00:00
bevy_input Update keyboard.rs docs in bevy_input (#4517) 2022-05-17 04:16:54 +00:00
bevy_internal Split time functionality into bevy_time (#4187) 2022-05-26 00:27:18 +00:00
bevy_log Update tracing-tracy requirement from 0.8.0 to 0.9.0 (#4786) 2022-05-27 11:54:57 +00:00
bevy_macro_utils bevy_reflect_derive: Tidying up the code (#4712) 2022-05-12 19:43:23 +00:00
bevy_math Document bevy_math (#4591) 2022-04-26 18:23:29 +00:00
bevy_mikktspace Generate vertex tangents using mikktspace (#3872) 2022-05-31 22:53:54 +00:00
bevy_pbr Generate vertex tangents using mikktspace (#3872) 2022-05-31 22:53:54 +00:00
bevy_ptr Clippy improvements (#4665) 2022-05-31 01:38:07 +00:00
bevy_reflect Clippy improvements (#4665) 2022-05-31 01:38:07 +00:00
bevy_render Generate vertex tangents using mikktspace (#3872) 2022-05-31 22:53:54 +00:00
bevy_scene Update gilrs to v0.9 (#4848) 2022-05-30 17:26:23 +00:00
bevy_sprite Clippy improvements (#4665) 2022-05-31 01:38:07 +00:00
bevy_tasks Remove unused CountdownEvent (#4290) 2022-04-26 21:20:12 +00:00
bevy_text Clippy improvements (#4665) 2022-05-31 01:38:07 +00:00
bevy_time Split time functionality into bevy_time (#4187) 2022-05-26 00:27:18 +00:00
bevy_transform Nightly clippy fixes (#3491) 2022-05-17 04:38:03 +00:00
bevy_ui Clippy improvements (#4665) 2022-05-31 01:38:07 +00:00
bevy_utils Update gilrs to v0.9 (#4848) 2022-05-30 17:26:23 +00:00
bevy_window Update gilrs to v0.9 (#4848) 2022-05-30 17:26:23 +00:00
bevy_winit Clippy improvements (#4665) 2022-05-31 01:38:07 +00:00