-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Open
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-Needs-InvestigationThis issue requires detective work to figure out what's going wrongThis issue requires detective work to figure out what's going wrong
Description
Bevy version
0.16.1
[Optional] Relevant system information
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:
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<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
mut images: ResMut<Assets<Image>>,
) {
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<Time>,
mut images: ResMut<Assets<Image>>,
) {
let image = images.get_mut(&lightmap.image).unwrap();
let brightness = time.elapsed_secs().sin() * 0.5 + 0.5;
image
.set_color_at(0, 0, Color::srgba(brightness, brightness, brightness, 1.0))
.unwrap();
}
What went wrong
Plane lighting isn't updating
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-Needs-InvestigationThis issue requires detective work to figure out what's going wrongThis issue requires detective work to figure out what's going wrong