Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

bevy-pbr-materials

/bevy-pbr-materials

Obsługuje materiały PBR w Bevy 0.19: Mesh3d ze StandardMaterial, własny Material z AsBindGroup, cienie, atmosferę, podzasoby materiałów glTF oraz wybór renderowania forward lub deferred.

Repozytorium
bevy-skills ↗
Licencja
MIT
Ostatnia zmiana repozytorium
25.08.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
4
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 25.08.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Obsługuje materiały PBR w Bevy 0.19: Mesh3d ze StandardMaterial, własny Material z AsBindGroup, cienie, atmosferę, podzasoby materiałów glTF oraz wybór renderowania forward lub deferred.

Oryginalny opis (EN)

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.

Jak działa

  1. When to use this skill
  2. Canonical pattern — StandardMaterial
  3. Custom material — Bevy 0.19 shape
  4. Topics
  5. Bevy 0.19 gotchas
  6. See also
Sekcje z nagłówków SKILL.md, w oryginale · 93 linii, 403 słów
Podgląd SKILL.md
---
name: bevy-pbr-materials
description: 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.
license: MIT
compatibility: opencode,claude-code,cursor
metadata:
  tier: "2"
  area: render
  bevy_version: "0.19"
---

# 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 `Atmosphere` entity 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

```rust
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](references/custom-material.md).

## Topics

| Topic | Reference |
|-------|-----------|
| `PointLight`, `DirectionalLight`, `SpotLight`; `GlobalAmbientLight`; shadow maps, contact shadows, atmosphere | [references/lighting.md](references/lighting.md) |
| `Plane3d`, `Cuboid`, `Sphere`, `Circle`, `Cylinder`, `Capsule3d`, `Torus` constructors and orientation gotchas | [references/mesh-primitives.md](references/mesh-primitives.md) |
| `Material` trait methods, `AsBindGroup` attributes, `ShaderRef` variants, `MaterialPlugin` wiring | [references/custom-material.md](references/custom-material.md) |

## Bevy 0.19 gotchas

- **`MaterialPlugin::<M> { prepass_enabled, shadows_enabled, ..default() }` is gone.** Override the `Material` trait methods instead — see [references/custom-material.md](references/custom-material.md).
- **Light fields use `shadow_maps_enabled`.** `shadows_enabled` was renamed because
  Bevy 0.19 adds the separate `contact_shadows_enabled` control.
- **Contact shadows require both sides.** Add `ContactShadows` to the camera and set
  `contact_shadows_enabled: true` on participating lights.
- **`Atmosphere` is its own entity.** Keep `AtmosphereSettings` on the camera and
  spawn `bevy::light::Atmosphere` separately.
- **glTF material labels changed.** `#Material0` loads `GltfMaterial`; use
  `#Material0/std` when you specifically need `Handle<StandardMaterial>`.
- **`AsBindGroup::label()` is required.** The `#[derive(AsBindGroup)]` macro generates it automatically; hand-rolled impls must add it.
- **Mesh component wrappers.** Use `Mesh3d(handle)` and `MeshMaterial3d(material_handle)` — the wrappers are what the renderer queries on.
- **`Plane3d::new` takes `Vec2` for `half_size`**, not a scalar — see [references/mesh-primitives.md](references/mesh-primitives.md).
- **`Color::rgb(...)` is gone** — use `Color::srgb(...)` or `Color::linear_rgb(...)`.
- **Directional light position is ignored** — only rotation matters. See [references/lighting.md](references/lighting.md).

## See also

- [`bevy-rendering`](../bevy-rendering/SKILL.md) — built-in renderer, forward/deferred,
  custom passes, and renderer replacement boundaries.
- [`bevy-cameras`](../bevy-cameras/SKILL.md) — views, HDR, and render targets.
- [`bevy-migration-0-18-to-0-19`](../bevy-migration-0-18-to-0-19/SKILL.md) — light,
  atmosphere, glTF material, and render-system migrations.
Pliki w paczce (4)
  • SKILL.md 4 KB
  • references/custom-material.md 6 KB
  • references/lighting.md 8 KB
  • references/mesh-primitives.md 6 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · chrisgliddon/bevy-skills100MIT
ianpurton/disposable-heroes100MIT

Migawka bazy z 13.11.2026 · wersja paczki 4d06839a1f4b (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 2 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100bevy-rendering
    Pomaga wybrać renderer w Bevy 0.19: wbudowany, API-only, headless lub zewnętrzny, forward albo deferred PBR, migrację węzłów RenderGraph do systemów renderujących i relację fizyki, np. bevy_rapier3d, do renderowania.
  • 100bevy-rendering
    Wybiera renderer w Bevy 0.20, czy to wbudowany, czy zewnętrzny, oraz tryb forward lub deferred i flagi funkcji 2D i 3D.
  • 95threejs-materials
    Stylizuje siatki w Three.js: materiały PBR, podstawowe, Phong i shadery, a także tekstury i wydajność materiałów.
  • 100bevy-assets
    Obsługuje zasoby w Bevy 0.19: wczytywanie przez AssetServer, Handle<T>, sceny glTF WorldAsset, Assets<T>, hot reload, AssetPath i backendy z Reader::seekable.
  • 100bevy-assets
    Ładuje zasoby w Bevy 0.20: uchwyty, sceny glTF, mutacje zasobów i stany ładowania przez AssetServer.
  • 95threejs-materials
    Pomaga dobierać materiały w Three.js: PBR, basic, phong, materiały shaderowe i ich właściwości, stylowanie siatek, tekstury i wydajność.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.