Hi,
I am testing the new automatic batching feature. I have a simple example with 100k cubes, but the NoAutomaticBatching component has no effect (I got the same average fps approx. 45). I would expect a much bigger FPS when the automatic batching is on. What am I doing wrong? Thank you, Jaroslav (Bevy version 0.12.1)
use bevy::prelude::*;
use bevy::diagnostic::FrameTimeDiagnosticsPlugin;
use bevy::diagnostic::LogDiagnosticsPlugin;
use rand::Rng;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(FrameTimeDiagnosticsPlugin::default())
.add_plugins(LogDiagnosticsPlugin::default())
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>) {
let mut rng = rand::thread_rng();
for _ in 0..100000 {
let cube_mesh_handle: Handle<Mesh> = meshes.add(shape::Cube::default().into());
commands.spawn((
PbrBundle {
mesh: cube_mesh_handle,
transform: Transform::from_xyz(rng.gen_range(-1000.0..1000.0), rng.gen_range(-1000.0..1000.0), rng.gen_range(-1000.0..1000.0)),
..default()
},
//bevy::render::batching::NoAutomaticBatching,
));
}
let camera_and_light_transform =
Transform::from_xyz(1.8, 1.8, 1.8).looking_at(Vec3::ZERO, Vec3::Y);
commands.spawn(Camera3dBundle {
transform: camera_and_light_transform,
..default()
});
commands.spawn(PointLightBundle {
point_light: PointLight {
intensity: 1000.0,
range: 100.0,
..default()
},
transform: camera_and_light_transform,
..default()
});
}