Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve shadows and docs #24

Merged
merged 3 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading