bevy/release-content/release-notes
Conner Petzold 3f187cf752
Add TilemapChunk rendering (#18866)
# Objective

An attempt to start building a base for first-party tilemaps (#13782).

The objective is to create a very simple tilemap chunk rendering plugin
that can be used as a building block for 3rd-party tilemap crates, and
eventually a first-party tilemap implementation.

## Solution

- Introduces two user-facing components, `TilemapChunk` and
`TilemapChunkIndices`, and a new material `TilemapChunkMaterial`.
- `TilemapChunk` holds the chunk and tile sizes, and the tileset image
- The tileset image is expected to be a layered image for use with
`texture_2d_array`, with the assumption that atlases or multiple images
would go through an asset loader/processor. Not sure if that should be
part of this PR or not..
- `TilemapChunkIndices` holds a 1d representation of all of the tile's
Option<u32> index into the tileset image.
- Indices are fixed to the size of tiles in a chunk (though maybe this
should just be an assertion instead?)
  - Indices are cloned and sent to the shader through a u32 texture.

## Testing

- Initial testing done with the `tilemap_chunk` example, though I need
to include some way to update indices as part of it.
- Tested wasm with webgl2 and webgpu
- I'm thinking it would probably be good to do some basic perf testing.

---

## Showcase

```rust
let chunk_size = UVec2::splat(64);
let tile_size = UVec2::splat(16);
let indices: Vec<Option<u32>> = (0..chunk_size.x * chunk_size.y)
    .map(|_| rng.gen_range(0..5))
    .map(|i| if i == 0 { None } else { Some(i - 1) })
    .collect();

commands.spawn((
    TilemapChunk {
        chunk_size,
        tile_size,
        tileset,
    },
    TilemapChunkIndices(indices),
));
```

![Screenshot 2025-04-17 at 11 54
56 PM](https://github.com/user-attachments/assets/850a53c1-16fc-405d-aad2-8ef5a0060fea)
2025-06-23 23:55:10 +00:00
..
.gitkeep
bevy_solari.md Fix some typos (#19788) 2025-06-23 22:32:46 +00:00
convert-coordinates.md Allow users to fix glTF coordinate system imports (#19633) 2025-06-16 21:47:34 +00:00
entity-spawn-ticks.md Fix EntityMeta.spawned_or_despawned unsoundness (#19350) 2025-05-27 22:45:07 +00:00
event_split.md Event Split: Event, EntityEvent, and BufferedEvent (#19647) 2025-06-15 16:46:34 +00:00
headless-widgets.md Core Checkbox (#19665) 2025-06-20 16:37:18 +00:00
hot_patching.md Hot patching systems with subsecond (#19309) 2025-06-03 21:12:38 +00:00
key_buttoninput.md Add support for ButtonInput<Key> (#19684) 2025-06-18 20:15:03 +00:00
log-diagnostics-state-public.md Expose LogDiagnosticsState (#19323) 2025-05-23 20:56:36 +00:00
observer_overhaul.md Exposes Observer's system's name (#19611) 2025-06-17 22:38:31 +00:00
specialized_ui_transform.md Specialized UI transform (#16615) 2025-06-09 19:05:49 +00:00
system_set_naming_convention.md Adopt consistent FooSystems naming convention for system sets (#18900) 2025-05-06 15:18:03 +00:00
text-background-colors.md
tilemap-chunk-rendering.md Add TilemapChunk rendering (#18866) 2025-06-23 23:55:10 +00:00
ui_gradients.md Color interpolation in OKLab, OKLCH spaces for UI gradients (#19330) 2025-06-21 15:06:35 +00:00
viewport-node.md Add a viewport UI widget (#17253) 2025-05-05 22:57:37 +00:00