Allow extended materials to exclude `StandardMaterial` inputs that they don't want.
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_PIPELINEin the WGSL file. -
More convenient WGSL combinators to do common things like blend images together.
-
A special type of
ExtendedMaterialthat features anAssetLoaderthat can create anExtendedMaterialdirectly from a.wgslfile, with no Rust code involved. -
A declarative node graph framework, built on the above, that can generate
.wgslfiles 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.). Seeextended_material_decal.rsfor 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.
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.