
Bevy 3d Materials
Bevy ECS skill for PBR materials.
Install
npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-3d-materials -g -a claude-code -y- Repository
- thedivergentai/Game-Dev-Agentic-Skills917
- Category
- Engineering
- Updated
- 19d ago
- License
- LGPL-3.0
- Context cost
- Mediumabout 2,032 tokens
- Runs scripts
- No, instructions only
What it does
Bevy ECS skill for PBR materials. Keywords: Bevy, StandardMaterial, PBR, material, ExtendedMaterial.
Bevy 3D materials
When to use
Load this when a mesh needs a PBR surface. Custom shader extension points are on bevy-shaders. Lighting is on bevy-3d-lighting.
ECS shape
- Type:
StandardMaterial(feature blurbs andDistanceFog). - Extension:
ExtendedMaterialon the pbr page. - Features that mention StandardMaterial textures:
pbr_anisotropy_texture,pbr_multi_layer_material_textures,pbr_specular_textures,pbr_transmission_textures. Check the struct page for field names before writing them. - Plugin:
bevy_pbradds PBR rendering. It is part of the 3d render collection.
Surface choice
| Need | Bevy idiom |
|---|---|
| PBR surface | StandardMaterial on MeshMaterial3d, with base_color, metallic, and perceptual_roughness. |
| Extra shader data on that surface | ExtendedMaterial<StandardMaterial, E> where E: MaterialExtension. |
| Transparency | alpha_mode: AlphaMode::Mask for cutout, AlphaMode::Blend for glass. |
Examples
[dependencies]
bevy = "0.20"
Spawn a mesh with a metal StandardMaterial. The mesh component is Mesh3d. The material component is MeshMaterial3d<StandardMaterial>.
fn spawn_metal(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
let mesh = meshes.add(Cuboid::new(1.0, 1.0, 1.0));
let material = materials.add(StandardMaterial {
base_color: Color::srgb(0.75, 0.15, 0.12),
metallic: 1.0,
perceptual_roughness: 0.25,
reflectance: 0.5,
..default()
});
commands.spawn((Mesh3d(mesh), MeshMaterial3d(material), Transform::default()));
}
Cutout foliage discards fragments under the mask. Glass uses alpha blending and a translucent base color.
