/bevy-skills:bevy-pbr-materialsfrom bevy-skills
Guides Bevy 0.20 PBR material workflows: StandardMaterial, custom AsBindGroup materials, WESL shaders, shadow/contact-shadow setup, screen-space transmission, and glTF sub-asset loading.
Ships in bevy-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Material (stylised shading, dissolve, world-space effects).no field shadows_enabled on a light (renamed in 0.19).#import or #ifdef not recognised (naga_oil is gone in 0.20).Handle<StandardMaterial> from a glTF sub-asset fails to load (needs /std since 0.19).use bevy::pbr::ContactShadows;
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
fn setup(
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.8, 0.3, 0.2),
perceptual_roughness: 0.4,
metallic: 0.1,
..default()
});
commands.spawn((
Mesh3d(mesh),
MeshMaterial3d(material),
Transform::from_xyz(0.0, 0.5, 0.0),
));
commands.spawn((
Camera3d::default(),
// Screen-space contact shadows (0.19+). Requires the depth prepass,
// which `ContactShadows` adds as a required component.
ContactShadows::default(),
Transform::from_xyz(0.0, 2.0, 4.0).looking_at(Vec3::ZERO, Vec3::Y),
));
commands.spawn((
DirectionalLight {
// 0.19 renamed `shadows_enabled` to `shadow_maps_enabled`.
shadow_maps_enabled: true,
contact_shadows_enabled: true,
..default()
},
Transform::from_xyz(2.0, 4.0, 2.0).looking_at(Vec3::ZERO, Vec3::Y),
));
}
use bevy::prelude::*;
use bevy::render::render_resource::AsBindGroup;
use bevy::shader::ShaderRef;
#[derive(Asset, AsBindGroup, TypePath, Debug, Clone)]
struct TintMaterial {
#[uniform(0)]
tint: LinearRgba,
}
impl Material for TintMaterial {
// 0.20: shaders are WESL. Use the `.wesl` extension for anything with imports.
fn fragment_shader() -> ShaderRef {
"shaders/tint.wesl".into()
}
}
assets/shaders/tint.wesl:
import bevy_pbr::render::forward_io::VertexOutput;
@group(2) @binding(0) var<uniform> tint: vec4<f32>;
@fragment
fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
return tint;
}
Full Material trait reference, AsBindGroup attributes and WESL translation rules:
references/custom-material.md.
| Topic | Reference |
|---|---|
PointLight, DirectionalLight, SpotLight fields; GlobalAmbientLight; cascades; Atmosphere entity | references/lighting.md |
Plane3d, Cuboid, Sphere, Circle, Cylinder, Capsule3d, Torus constructors and orientation | references/mesh-primitives.md |
Material trait methods, AsBindGroup attributes, ShaderRef, WESL syntax, MaterialPlugin | references/custom-material.md |
#import bevy_pbr::forward_io::VertexOutput becomes import bevy_pbr::render::forward_io::VertexOutput; (semicolon, module path mirrors the crate file path). #ifdef X ... #endif becomes @if(X) on a declaration. #{MATERIAL_BIND_GROUP} becomes constants::MATERIAL_BIND_GROUP. #define_import_path is gone. Rename files .wgsl → .wesl; plain WGSL with no directives still loads. GLSL and the shader_format_wesl feature are gone.ScreenSpaceTransmission is opt-in. Camera3d no longer requires it. Add bevy::pbr::ScreenSpaceTransmission::default() to the camera or transmissive materials render without refraction.Tonemapping::None is a pure passthrough (no grading, no dither, no clamp). For "no tone curve, keep the rest" use Tonemapping::Linear.AsBindGroup: unprepared_bind_group is now build_bind_group writing into a BindGroupBuilder. #[derive(AsBindGroup)] users are unaffected.Material::enable_oit(); the shader def is MATERIAL_OIT_ENABLED.bevy_shape split from bevy_math. Cuboid, Sphere, etc. still come through bevy::prelude::*; direct paths are bevy::shape::*.shadows_enabled → shadow_maps_enabled on PointLight, DirectionalLight, SpotLight. New contact_shadows_enabled field plus the ContactShadows camera component.Atmosphere is an entity, in bevy::light. Spawn Atmosphere::earth(medium) on its own entity; the camera keeps AtmosphereSettings. scene_units_to_m is gone (scale the entity's Transform). Atmosphere::earthlike → Atmosphere::earth.#Material0 now loads a GltfMaterial. Append /std for a Handle<StandardMaterial>.Skybox.image is Option<Handle<Image>> and Skybox lives in bevy::light.AlphaMode moved to bevy_material (prelude still exports it).Bloom::intensity or emissive strength.ViewNode / add_render_graph_node are gone; write a system with ViewQuery in Core3d.Mesh3d(handle) and MeshMaterial3d(handle) — the renderer queries the wrappers.Plane3d::new takes Vec2 for half_size. Color::rgb is gone; use Color::srgb.MaterialPlugin::<M> has no prepass_enabled / shadows_enabled fields; override Material::enable_prepass() / enable_shadows().bevy-cameras — Camera3d, Hdr, Tonemapping, render targets.bevy-vfx — custom-material shader effects and GPU particles.bevy-migration-0-19-to-0-20 — WESL translation and ScreenSpaceTransmission.bevy-migration-0-18-to-0-19 — light field renames, Atmosphere entity, render systems.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub chrisgliddon/bevy-skills --plugin bevy-skills32 skills in this plugin
/bevyUse when starting any Bevy task, choosing between Update and FixedUpdate, picking Cargo feature flags, or recalling which sibling skill covers ECS, assets, rendering, UI, or migration. Routes to the right Bevy 0.20 skill and pins the engine version for downstream snippets./bevy-a11yUse when designing or auditing high-standard video-game accessibility in Bevy 0.20, integrating screen readers and focus navigation, supporting adaptive controllers and complete remapping, implementing captions or audio description, checking contrast and motion safety, or building disabled-player test evidence./bevy-animationUse when wiring `AnimationPlayer` + `AnimationGraphHandle`, building an `AnimationGraph` from glTF clips, blending state-driven animations with `AnimationTransitions::play`, isolating body parts with `AnimationMask`, firing gameplay sync via `#[derive(AnimationEvent)]` + `On<E>` observers, tweening with `AnimatableCurve` / `EaseFunction` / `CubicSegment::new_bezier_easing` from `bevy::curve`, or applying the 12 Basic Principles of Animation to 3D characters in Bevy 0.20./bevy-assetsUse when loading with `AssetServer::load` or `AssetServer::load_builder().with_settings(..)`, holding a `Handle<T>`, spawning a glTF scene with `WorldAssetRoot` (`Handle<WorldAsset>`), mutating through `Assets::get_mut` / `AssetMut`, polling `LoadState::is_loaded`, resolving an `AssetPath`, or replacing `AssetId::invalid()` with `Option<AssetId<T>>` in Bevy 0.20./bevy-audioUse when implementing audio in Bevy 0.20 with `AudioPlayer`, `PlaybackSettings`, `AudioSink` or `SpatialAudioSink`, spatial listeners, application mix groups, ambience/music transitions, asset lifetime, browser gesture restrictions, or choosing built-in audio versus `bevy_seedling 0.8`./bevy-camerasUse when spawning `Camera3d` or `Camera2d`, choosing a `Projection`, rendering to an image with the `RenderTarget` component, adding `Hdr` / `Tonemapping::Linear` / `ScreenSpaceTransmission` to a camera, wiring `FreeCamera`, `PanCamera` or the new `PanOrbitCamera` from `bevy::camera_controller`, ordering views with `Camera::order`, or setting a per-camera `AmbientLight` in Bevy 0.20.Other plugins' skills for the same job