Skip to content

Commit

Permalink
Merge pull request #24 from rodolphito/meshlet-docs
Browse files Browse the repository at this point in the history
Improve shadows and docs
  • Loading branch information
JMS55 committed Jan 26, 2024
2 parents ea39e34 + 93fed23 commit ac89611
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions crates/bevy_pbr/src/meshlet/gpu_scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,11 @@ pub struct MeshletGpuScene {
next_material_id: u32,
material_id_lookup: HashMap<UntypedAssetId, u32>,
material_ids_present_in_scene: HashSet<u32>,
/// Per-instance Entity, RenderLayers, and NotShadowCaster
instances: Vec<(Entity, RenderLayers, bool)>,
/// Per-instance transforms, model matrices, and render flags
instance_uniforms: StorageBuffer<Vec<MeshUniform>>,
/// Per-view per-instance visibility bit. Used for RenderLayer and NotShadowCaster support.
view_instance_visibility: EntityHashMap<Entity, StorageBuffer<Vec<u32>>>,
instance_material_ids: StorageBuffer<Vec<u32>>,
thread_instance_ids: StorageBuffer<Vec<u32>>,
Expand Down
7 changes: 6 additions & 1 deletion examples/3d/meshlet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod camera_controller;
use bevy::{
pbr::{
meshlet::{MaterialMeshletMeshBundle, MeshletMesh, MeshletPlugin},
CascadeShadowConfigBuilder,
CascadeShadowConfigBuilder, DirectionalLightShadowMap,
},
prelude::*,
render::render_resource::AsBindGroup,
Expand All @@ -16,6 +16,7 @@ use std::f32::consts::PI;

fn main() {
App::new()
.insert_resource(DirectionalLightShadowMap { size: 4096 })
.add_plugins((
DefaultPlugins,
MeshletPlugin,
Expand Down Expand Up @@ -71,6 +72,10 @@ fn setup(
..default()
});

// A custom file format storing a [`bevy_render::mesh::Mesh`]
// that has been converted to a [`bevy_pbr::meshlet::MeshletMesh`]
// using [`bevy_pbr::meshlet::MeshletMesh::from_mesh`], which is
// a function only available when the `meshlet_processor` cargo feature is enabled.
let meshlet_mesh_handle = asset_server.load("models/bunny.meshlet_mesh");
let debug_material = debug_materials.add(MeshletDebugMaterial::default());

Expand Down

0 comments on commit ac89611

Please sign in to comment.