I'm using bevy skien and I am having issues with the meshlet processor.
I have and Observe that i use to convert meshes to meshlets :
fn mesh_to_meshlet(mut world: DeferredWorld, HookContext { entity, .. }: HookContext) {
let debug_material = world
.resource_mut::<Assets<MeshletDebugMaterial>>()
.add(MeshletDebugMaterial::default());
let mesh_id = world.get::<Mesh3d>(entity).unwrap().id();
let mesh = match world.resource::<Assets<Mesh>>().get(mesh_id) {
Some(mesh) => mesh,
None => {
error!("Mesh not found for mesh_id: {:?}", mesh_id);
return;
}
};
info!(
"vertex_count: {}, primitives: {:?}, nb of indicies {}",
mesh.count_vertices(),
mesh.primitive_topology(),
mesh.indices().unwrap().len()
);
let meshlet = match MeshletMesh::from_mesh(mesh, 22) {
Ok(meshlet) => meshlet,
Err(err) => {
error!("Failed to create meshlet: {err}");
return;
}
};
let meshlet_handle = world.resource_mut::<Assets<MeshletMesh>>().add(meshlet);
let mut commands = world.commands();
entity! {
<commands|entity>
MeshletMesh3d(meshlet_handle);
MeshMaterial3d(debug_material);
Transform::from_xyz(0.,4.,0.);
.remove::<Mesh3d>()
.remove::<GltfMeshExtras>()
.remove::<MeshletFromMesh>()
.remove::<MeshMaterial3d<StandardMaterial>>();
}
}
The issue is that the meshlet processor is able to make a meshlet but doesnt seem to update the clusters no matter where i move the camera.
I have other meshlets in my scene that i loaded from the bevy repo which where already preprocessed and they work fine.
Am i missing something ?
also here is the entity to wich i applied the MeshFromMeshlet Struct:
