Meshlet misc (#13761)

- Copy module docs so that they show up in the re-export
- Change meshlet_id to cluster_id in the debug visualization
- Small doc tweaks
This commit is contained in:
JMS55 2024-06-10 06:06:08 -07:00 committed by François
parent cbebcb0d3f
commit a944598812
No known key found for this signature in database
4 changed files with 5 additions and 5 deletions

View File

@ -16,6 +16,7 @@ pub mod wireframe;
/// Expect bugs, missing features, compatibility issues, low performance, and/or future breaking changes. /// Expect bugs, missing features, compatibility issues, low performance, and/or future breaking changes.
#[cfg(feature = "meshlet")] #[cfg(feature = "meshlet")]
pub mod experimental { pub mod experimental {
/// Render high-poly 3d meshes using an efficient GPU-driven method. See [`MeshletPlugin`] and [`MeshletMesh`] for details.
pub mod meshlet { pub mod meshlet {
pub use crate::meshlet::*; pub use crate::meshlet::*;
} }

View File

@ -18,7 +18,7 @@ fn vertex(@builtin(vertex_index) vertex_input: u32) -> @builtin(position) vec4<f
@fragment @fragment
fn fragment(@builtin(position) frag_coord: vec4<f32>) -> @location(0) vec4<f32> { fn fragment(@builtin(position) frag_coord: vec4<f32>) -> @location(0) vec4<f32> {
let vertex_output = resolve_vertex_output(frag_coord); let vertex_output = resolve_vertex_output(frag_coord);
var rng = vertex_output.meshlet_id; var rng = vertex_output.cluster_id;
let color = vec3(rand_f(&rng), rand_f(&rng), rand_f(&rng)); let color = vec3(rand_f(&rng), rand_f(&rng), rand_f(&rng));
return vec4(color, 1.0); return vec4(color, 1.0);
} }

View File

@ -95,7 +95,6 @@ const MESHLET_MESH_MATERIAL_SHADER_HANDLE: Handle<Shader> =
/// Once meshes are pre-processed into a [`MeshletMesh`], this plugin can render these kinds of scenes very efficiently. /// Once meshes are pre-processed into a [`MeshletMesh`], this plugin can render these kinds of scenes very efficiently.
/// ///
/// In comparison to Bevy's standard renderer: /// In comparison to Bevy's standard renderer:
/// * Minimal rendering work is done on the CPU. All rendering is GPU-driven.
/// * Much more efficient culling. Meshlets can be culled individually, instead of all or nothing culling for entire meshes at a time. /// * Much more efficient culling. Meshlets can be culled individually, instead of all or nothing culling for entire meshes at a time.
/// Additionally, occlusion culling can eliminate meshlets that would cause overdraw. /// Additionally, occlusion culling can eliminate meshlets that would cause overdraw.
/// * Much more efficient batching. All geometry can be rasterized in a single indirect draw. /// * Much more efficient batching. All geometry can be rasterized in a single indirect draw.
@ -104,7 +103,7 @@ const MESHLET_MESH_MATERIAL_SHADER_HANDLE: Handle<Shader> =
/// * Much greater base overhead. Rendering will be slower than Bevy's standard renderer with small amounts of geometry and overdraw. /// * Much greater base overhead. Rendering will be slower than Bevy's standard renderer with small amounts of geometry and overdraw.
/// * Much greater memory usage. /// * Much greater memory usage.
/// * Requires preprocessing meshes. See [`MeshletMesh`] for details. /// * Requires preprocessing meshes. See [`MeshletMesh`] for details.
/// * More limitations on the kinds of materials you can use. See [`MeshletMesh`] for details. /// * Limitations on the kinds of materials you can use. See [`MeshletMesh`] for details.
/// ///
/// This plugin is not compatible with [`Msaa`], and adding this plugin will disable it. /// This plugin is not compatible with [`Msaa`], and adding this plugin will disable it.
/// ///

View File

@ -85,7 +85,7 @@ struct VertexOutput {
ddy_uv: vec2<f32>, ddy_uv: vec2<f32>,
world_tangent: vec4<f32>, world_tangent: vec4<f32>,
mesh_flags: u32, mesh_flags: u32,
meshlet_id: u32, cluster_id: u32,
#ifdef PREPASS_FRAGMENT #ifdef PREPASS_FRAGMENT
#ifdef MOTION_VECTOR_PREPASS #ifdef MOTION_VECTOR_PREPASS
motion_vector: vec2<f32>, motion_vector: vec2<f32>,
@ -176,7 +176,7 @@ fn resolve_vertex_output(frag_coord: vec4<f32>) -> VertexOutput {
ddy_uv, ddy_uv,
world_tangent, world_tangent,
instance_uniform.flags, instance_uniform.flags,
meshlet_id, cluster_id,
#ifdef PREPASS_FRAGMENT #ifdef PREPASS_FRAGMENT
#ifdef MOTION_VECTOR_PREPASS #ifdef MOTION_VECTOR_PREPASS
motion_vector, motion_vector,