bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Adds UV Channel Selection Support for Base Colour, Metallic-Roughness, Normal Map and Occlusion Textures

Open HulloImJay opened this issue 2 years ago • 3 comments

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.
Screenshot 2024-01-25 at 2 30 24 PM

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...

HulloImJay avatar Jan 25 '24 19:01 HulloImJay

Welcome, new contributor!

Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨

github-actions[bot] avatar Jan 25 '24 19:01 github-actions[bot]

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.

github-actions[bot] avatar Jan 25 '24 20:01 github-actions[bot]

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.

github-actions[bot] avatar Jan 25 '24 20:01 github-actions[bot]