Skip to content

bonsairobo/bevy_triplanar_splatting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Triplanar Mapping and Material Blending for Bevy Engine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published