bevy-pbr-materials
Skill16 starsChanged 3 months agoMITView on GitHub
Use when spawning `Mesh3d` with `StandardMaterial`, writing a Bevy 0.19 custom `Material` with `AsBindGroup`, enabling `shadow_maps_enabled` or contact shadows, configuring atmosphere entities, loading glTF `/std` material sub-assets, or selecting forward versus deferred PBR.
In this repository33 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- bevy-a11ySkill
- bevy-animationSkill
- bevy-assetsSkill
- bevy-audioSkill
- bevy-camerasSkill
- bevy-captureSkill
- bevy-cargo-featuresSkill
- bevy-core-conceptsSkill
- bevy-custom-assetsSkill
- bevy-diagnostics-profilingSkill
- bevy-ecs-componentsSkill
- bevy-ecs-queriesSkill
- bevy-ecs-systemsSkill
- bevy-fluentSkill
- bevy-input-actionsSkill
- bevy-migration-0-17-to-0-18Skill
- bevy-migration-0-18-to-0-19Skill
- bevy-physicsSkill
- bevy-portingSkill
- bevy-renderingSkill
- bevy-save-loadSkill
- bevySkill
- bevy-testingSkill
- bevy-uiSkill
- bevy-vfxSkill
- bevy-voxel-dataSkill
- bevy-voxel-pipelineSkill
- bevy-voxel-runtimeSkill
- bevy-wasm-webgpuSkill
- similarity-rsSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 84
Contact shadows require both sides: Add ContactShadows to the camera and set contact_shadows_enabled: true on participating lights.
- Very specific: line 86
Atmosphereis its own entity: Keep AtmosphereSettings on the camera and spawn bevy::light::Atmosphere separately. - Very specific: line 91
Mesh component wrappers: Use Mesh3d(handle) and MeshMaterial3d(material_handle) — the wrappers are what the renderer queries on.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Bevy 0.19 — PBR Materials
When to use this skill
- Texturing a mesh with the built-in physically based shader.
- Writing a custom
Material(e.g. for stylised shading, dissolve effects, world-space shaders). - Enabling shadow maps or Bevy 0.19 contact shadows.
- Spawning an
Atmosphereentity and enabling it on a camera. - Compiler error on
AsBindGroup::label()(now required). - Compiler error on
MaterialPlugin::<M> { prepass_enabled: ... }(fields removed in 0.18).
Canonical pattern — StandardMaterial
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(),
Transform::from_xyz(0.0, 2.0, 4.0).looking_at(Vec3::ZERO, Vec3::Y),
));
commands.spawn((
DirectionalLight::default(),
Transform::from_xyz(2.0, 4.0, 2.0).looking_at(Vec3::ZERO, Vec3::Y),
));
}Custom material — Bevy 0.19 shape
Custom materials with the Material trait and AsBindGroup are covered in
detail at references/custom-material.md.
Topics
| Topic | Reference |
PointLight, DirectionalLight, SpotLight; GlobalAmbientLight; shadow maps, contact shadows, atmosphere | references/lighting.md |
Plane3d, Cuboid, Sphere, Circle, Cylinder, Capsule3d, Torus constructors and orientation gotchas | references/mesh-primitives.md |
Material trait methods, AsBindGroup attributes, ShaderRef variants, MaterialPlugin wiring | references/custom-material.md |
Bevy 0.19 gotchas
MaterialPlugin::<M> { prepass_enabled, shadows_enabled, ..default() }is gone. Override theMaterialtrait methods instead — see references/custom-material.md.- Light fields use
shadow_maps_enabled.shadows_enabledwas renamed because Bevy 0.19 adds the separatecontact_shadows_enabledcontrol. - Contact shadows require both sides. Add
ContactShadowsto the camera and setcontact_shadows_enabled: trueon participating lights. Atmosphereis its own entity. KeepAtmosphereSettingson the camera and spawnbevy::light::Atmosphereseparately.- glTF material labels changed.
#Material0loadsGltfMaterial; use#Material0/stdwhen you specifically needHandle<StandardMaterial>. AsBindGroup::label()is required. The#[derive(AsBindGroup)]macro generates it automatically; hand-rolled impls must add it.- Mesh component wrappers. Use
Mesh3d(handle)andMeshMaterial3d(material_handle)— the wrappers are what the renderer queries on. Plane3d::newtakesVec2forhalf_size, not a scalar — see references/mesh-primitives.md.Color::rgb(...)is gone — useColor::srgb(...)orColor::linear_rgb(...).- Directional light position is ignored — only rotation matters. See references/lighting.md.
See also
bevy-rendering— built-in renderer, forward/deferred, custom passes, and renderer replacement boundaries.bevy-cameras— views, HDR, and render targets.bevy-migration-0-18-to-0-19— light, atmosphere, glTF material, and render-system migrations.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

