bevy/crates/bevy_pbr/src
Robert Swain 579928e8e0 bevy_pbr: Support flipping tangent space normal map y for DirectX normal maps (#4433)
# Objective

- Normal maps authored for DirectX use a left-handed convention and have their tangent space normal in the texture inverted from what we need. Support this.
- Details here: https://doc.babylonjs.com/divingDeeper/materials/advanced/normalMaps

## Solution

- Add a `StandardMaterial` `flip_normal_map_y` boolean field
- Add a `STANDARDMATERIAL_FLIP_NORMAL_MAP_Y` flag to `StandardMaterialFlags` and in the PBR shader
- Flip the y-component of the tangent space normal just after sampling it from the normal map texture

## Screenshots

### Before

<img width="1392" alt="Screenshot 2022-04-06 at 21 04 44" src="https://user-images.githubusercontent.com/302146/162050314-e7bfaaf6-9ee1-4756-9821-f6f5ff78f508.png">

### After

<img width="1392" alt="Screenshot 2022-04-06 at 21 03 39" src="https://user-images.githubusercontent.com/302146/162050255-36ee0745-1d79-4fd2-9a1c-18085376b643.png">

---

## Changelog

- Added: Support for flipping the normal map texture y component for normal maps authored for use with DirectX
2022-04-07 15:50:14 +00:00
..
render bevy_pbr: Support flipping tangent space normal map y for DirectX normal maps (#4433) 2022-04-07 15:50:14 +00:00
alpha.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
bundle.rs add Visibility for lights (#3958) 2022-03-05 03:23:01 +00:00
lib.rs Always update clusters and remove per-frame allocations (#4169) 2022-03-24 00:20:27 +00:00
light.rs Always update clusters and remove per-frame allocations (#4169) 2022-03-24 00:20:27 +00:00
material.rs Mesh Skinning. Attempt #3 (#4238) 2022-03-29 18:31:13 +00:00
pbr_material.rs bevy_pbr: Support flipping tangent space normal map y for DirectX normal maps (#4433) 2022-04-07 15:50:14 +00:00
wireframe.rs ParamSet for conflicting SystemParam:s (#2765) 2022-03-29 23:39:38 +00:00