Lightmap is not updating
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Bevy version
0.16.1
## \[Optional\] Relevant system information
```ignore
AdapterInfo { name: "NVIDIA RTX A3000 Laptop GPU", vendor: 4318, device: 9400, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "566.24", backend: Vulkan }
```
## What you did
I tried to run this code:
```rust
use bevy::{
asset::RenderAssetUsages,
pbr::Lightmap,
prelude::*,
render::render_resource::{Extent3d, TextureDimension, TextureFormat},
};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.add_systems(Update, update_lightmap)
.run();
}
fn setup(
mut commands: Commands,
mut meshes: ResMut>,
mut materials: ResMut>,
mut images: ResMut>,
) {
let mut mesh: Mesh = Plane3d::new(Vec3::Y, 5.0 * Vec2::ONE).into();
let uv_0 = mesh.attribute(Mesh::ATTRIBUTE_UV_0).unwrap().clone();
mesh.insert_attribute(Mesh::ATTRIBUTE_UV_1, uv_0);
let image = Image::new_fill(
Extent3d {
width: 1,
height: 1,
..Default::default()
},
TextureDimension::D2,
&[255, 255, 255, 255],
TextureFormat::bevy_default(),
RenderAssetUsages::all(),
);
commands.spawn((
Mesh3d(meshes.add(mesh)),
MeshMaterial3d(materials.add(StandardMaterial {
lightmap_exposure: 250.0,
..Default::default()
})),
Transform::default(),
Lightmap {
image: images.add(image),
..Default::default()
},
));
commands.spawn((
Camera3d::default(),
Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y),
));
}
fn update_lightmap(
lightmap: Single<&Lightmap>,
time: Res
## What went wrong
Plane lighting isn't updating
Contributor guide
Research direction
Start by running the reproduction in the issue and inspect the Lightmap component, setup function, and update_lightmap system. Trace how the image asset is consumed by the plane's lighting, then verify that changing the image makes the plane lighting update over time.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100