bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Allow extended materials to exclude `StandardMaterial` inputs that they don't want.

Open pcwalton opened this issue 1 year ago • 1 comments

This makes it possible to use only portions of pbr_input_from_standard_material, which improves ergonomics of common use cases. A simple example is provided that applies a decal to a texture.

Possible follow-ups to improve ergonomics further include:

  • Figure out how to get rid of the ugly #ifdef PREPASS_PIPELINE in the WGSL file.

  • More convenient WGSL combinators to do common things like blend images together.

  • A special type of ExtendedMaterial that features an AssetLoader that can create an ExtendedMaterial directly from a .wgsl file, with no Rust code involved.

  • A declarative node graph framework, built on the above, that can generate .wgsl files from nodes, like Blender Eevee does.

This is mostly a draft to get feedback on the API.

Changelog

This section is optional. If this was a trivial fix, or has no externally-visible impact, you can delete this section.

Added

  • A new function, bevy_pbr::pbr_material::exclude_standard_material_features, has been added to make authoring extended materials easier. You can now override any arbitrary subset of the PBR inputs (base color, emission color, etc.). See extended_material_decal.rs for an example of use.

  • A new shader function, pbr_functions::apply_lighting_and_postprocessing, is available, in order to reduce boilerplate for the common case of an extended material that simply wants to override some PBR inputs.

pcwalton avatar Feb 12 '24 22:02 pcwalton

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 Feb 12 '24 22:02 github-actions[bot]