Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 1.87 KB

README.md

File metadata and controls

45 lines (34 loc) · 1.87 KB

bevy_triplanar_splatting

Triplanar Mapping and Material Blending (AKA Splatting) for Bevy Engine

Screenshot

Scope

This crate provides the TriplanarMaterial, which is based on bevy_pbr's StandardMaterial, but it supports blending up to 4 materials using array textures and a new ATTRIBUTE_MATERIAL_WEIGHTS vertex attribute.

Implementation

The triplanar material is implemented using the AsBindGroup derive macro and the Material trait. Most of the magic happens in the shader code.

Where possible, we reuse shader imports from bevy::pbr to implement lighting effects. Sadly there are still some shader functions and code blocks that are copy-pasted from Bevy; we are hoping to eliminate these in the future to make this crate easier to maintain.

The new shader code is mostly concerned with how array textures are sampled and blended together. The techniques therein were sourced from the following references:

Road Map

  • per-layer uniform constants (e.g. "emissive", "metallic", etc.)
  • support different texture per plane, using more layers
  • blend materials using depth/height map