bevy-voxel-data
Skill29 starsChanged 11 days agoMITView on GitHub
Use when defining voxel blocks in RON (`name`, `textures`, `flags`), building a runtime palette mapping `BlockId -> BlockDef`, baking per-block textures into a KTX2 atlas (`ktx2` + `zstd_rust` features), or binding the atlas as `StandardMaterial.base_color_texture` with an `ImageSampler` so meshed quads sample by face index. Generic Bevy 0.20 voxel-data patterns — no game-specific data baked in.
In this repository34 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-migration-0-19-to-0-20Skill
- bevy-pbr-materialsSkill
- bevy-physicsSkill
- bevy-portingSkill
- bevy-renderingSkill
- bevy-save-loadSkill
- bevySkill
- bevy-testingSkill
- bevy-uiSkill
- bevy-vfxSkill
- bevy-voxel-pipelineSkill
- bevy-voxel-runtimeSkill
- bevy-wasm-webgpuSkill
- similarity-rsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
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
- Distinctive: line 87
Use BC7 (desktop) or ETC2/ASTC (mobile) — see references/ktx2-atlas.md.
- Very specific: line 105
Texture bleeding at mip levels ≥ 1: Add 2-pixel padding around each tile, or switch to a texture array with clamp_to_edge per slice.
- Very specific: line 109
Translucentblocks need a separate draw call: Use AlphaMode::Blend on a second material and a separate mesh batch per chunk — translucent … - Very specific: line 113
Don't bake the atlas at runtime in shipped builds: Run the bake script at content-build time.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.20 — Voxel data (RON, palette, KTX2 atlas)
When to use this skill
- Defining a moddable block catalog in a text format authors can edit.
- Building a runtime palette keyed by
BlockId(u16/u32) for fast lookup during meshing. - Packing per-block textures into a single atlas so all chunks can share one material.
- Switching the atlas to KTX2 for GPU-friendly compressed delivery.
- Choosing a runtime chunk storage format (flat array, RLE, palette compression, hybrid).
- Optimising procedural world generation: extremity bound checking, noise upsampling, noise caching, cross-biome noise sharing.
- Surveying the Rust/Bevy voxel-crate ecosystem and its current gaps before reaching for a dependency.
Canonical end-to-end flow
1. Define blocks in RON (assets/blocks.ron):
(
blocks: [
( name: "air", visibility: Empty ),
( name: "grass", visibility: Opaque,
faces: ( top: "textures/grass_top.png",
bottom: "textures/dirt.png",
side: "textures/grass_side.png" ) ),
( name: "stone", visibility: Opaque,
faces: ( all: "textures/stone.png" ) ),
],
)2. Core Rust types — BlockCatalog is a Bevy Asset; Palette is a Resource:
#[derive(Debug, Deserialize, Asset, TypePath)]
pub struct BlockCatalog { pub blocks: Vec<BlockDef> }
#[derive(Resource, Default)]
pub struct Palette {
pub by_id: Vec<PaletteEntry>, // index == BlockId
pub by_name: HashMap<String, u16>,
}
#[derive(Default, Clone)]
pub struct PaletteEntry {
pub name: String,
pub visibility: BlockVisibility,
/// Atlas tile per face: [−X, −Y, −Z, +X, +Y, +Z] (block-mesh order).
pub face_tiles: [u16; 6],
}3. Build the palette — walk the catalog, look up each face path in the
AtlasIndex (JSON sidecar loaded alongside the KTX2 file), emit one
PaletteEntry per block in catalog order (that order is the BlockId space).
4. Bind the atlas to StandardMaterial.base_color_texture; compute
per-vertex UVs as tile_x = tile_index % atlas_cols during the meshing pass.
Topics
| Topic | Reference |
| Full RON schema, all fields, serde defaults, parser notes | references/ron-schema.md |
BlockDef / BlockFaces / BlockVisibility types, build_palette in full, face_tiles slot convention | references/palette.md |
| KTX2 packing, tile-size budgets, padding for mip safety, BC7/ETC2/ASTC per platform | references/ktx2-atlas.md |
StandardMaterial binding, UV formula, per-vertex emission, sampler config, alpha modes | references/atlas-binding.md |
| Runtime chunk storage formats — flat array, RLE, palette compression, hybrid — with RAM estimates | references/storage-formats.md |
| Procedural generation patterns — noise upsampling, biome sharing, extremity bounds, caching | references/generation.md |
Rust/Bevy voxel-crate ecosystem survey (block-mesh, bevy_voxel_world, bevy-vox-scene, …) | references/ecosystem.md |
Gotchas
- KTX2 is opt-in, and the feature is
zstd_rust, notzstd.ktx2andzstd_rustare both pulled in by3d_api(so by3dand the defaults). For trimmed WASM builds addktx2pluszstd_rust(orzstd_c) explicitly. Use BC7 (desktop) or ETC2/ASTC (mobile) — see references/ktx2-atlas.md. compressed_image_saverchanged meaning (0.20). It now emits BCn/ASTC viactt; the old Basis Universal UASTC behaviour iscompressed_image_saver_universal. Pick one when you let the asset processor bake the atlas instead of an offline script.- Sampler types live in
bevy::image.ImageSampler,ImageSamplerDescriptor,ImageAddressModearebevy::image::*;bevy::render::texture::*is stale pre-0.16 output and no longer resolves. Image::pixel_bytesreturnsResult(0.19). Atlas-inspection code that didif let Some(px) = image.pixel_bytes(..)must match onOk/Err.- Name your enum
BlockVisibility.bevy::prelude::*already exportsVisibility; a localVisibilityshadows it silently and the nextVisibility::Hiddenon a chunk entity hits the wrong type. ResourceimpliesComponent(0.19).#[derive(Resource)]onPaletteis enough;#[derive(Component, Resource)]is now an error.- Palette ordering is the
BlockIdspace. Reordering the catalog after a save file ships will corrupt saves. Always append; never reorder. - Texture bleeding at mip levels ≥ 1. Add 2-pixel padding around each
tile, or switch to a texture array with
clamp_to_edgeper slice. Details in references/ktx2-atlas.md and references/atlas-binding.md. Translucentblocks need a separate draw call. UseAlphaMode::Blendon a second material and a separate mesh batch per chunk — translucent quads cannot be merged with opaque ones.AlphaModemoved tobevy_materialin 0.19 but stays in the prelude.- Don't bake the atlas at runtime in shipped builds. Run the bake script at
content-build time; commit the
.ktx2+ JSON index; load both at startup.
See also
bevy-voxel-pipeline— the meshing step that consumesface_tiles.bevy-voxel-runtime— remesh scheduling once blocks change.bevy-custom-assets— implementing the RON catalog loader.bevy-pbr-materials— wiring the atlas intoStandardMaterial.bevy-migration-0-19-to-0-20—compressed_image_saverand image-feature renames.
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.

