Adds UV Channel Selection Support for Base Colour, Metallic-Roughness, Normal Map and Occlusion Textures
I'm a Rust and Bevy newbie and this is my first PR, so I expect it not to pass muster! However, I would appreciate any feedback ;)
Objective
- I wanted to be able to use the second UV channel when sampling textures.
Solution
- Adds channel-selection properties to the Standard Material.
- These properties are used in the fragment shader if a second set of UVs exists on the mesh.
- Applies to base colour, metallic-roughness, normal map, and occlusion.
- Adds one example demonstrating the feature.
The new example I tested the changes with: Spheres on the left use UV0 and those on the right use UV1 (which is just a scaled copy — sufficient to see a difference). The top row tests base colour and metallic-roughness, and the bottom tests normal map and occlusion.
Changelog
- Changes across bevy_pbr to add the new properties and to use them within the fragment shader where appropriate.
- A new example which borrows from the 3D shapes but demonstrates using either the first or second UV channels for various textures.
Migration Guide
- I attempted to make these changes s.t. existing features would not change...
Welcome, new contributor!
Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨
The generated examples/README.md is out of sync with the example metadata in Cargo.toml or the example readme template. Please run cargo run -p build-templated-pages -- update examples to update it, and commit the file change.
The generated examples/README.md is out of sync with the example metadata in Cargo.toml or the example readme template. Please run cargo run -p build-templated-pages -- update examples to update it, and commit the file change.