mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
6d6810c90d
Adds a basic level of detail system to meshlets. An extremely brief summary is as follows: * In `from_mesh.rs`, once we've built the first level of clusters, we group clusters, simplify the new mega-clusters, and then split the simplified groups back into regular sized clusters. Repeat several times (ideally until you can't anymore). This forms a directed acyclic graph (DAG), where the children are the meshlets from the previous level, and the parents are the more simplified versions of their children. The leaf nodes are meshlets formed from the original mesh. * In `cull_meshlets.wgsl`, each cluster selects whether to render or not based on the LOD bounding sphere (different than the culling bounding sphere) of the current meshlet, the LOD bounding sphere of its parent (the meshlet group from simplification), and the simplification error relative to its children of both the current meshlet and its parent meshlet. This kind of breaks two pass occlusion culling, which will be fixed in a future PR by using an HZB from the previous frame to get the initial list of occluders. Many, _many_ improvements to be done in the future https://github.com/bevyengine/bevy/issues/11518, not least of which is code quality and speed. I don't even expect this to work on many types of input meshes. This is just a basic implementation/draft for collaboration. Arguable how much we want to do in this PR, I'll leave that up to maintainers. I've erred on the side of "as basic as possible". References: * Slides 27-77 (video available on youtube) https://advances.realtimerendering.com/s2021/Karis_Nanite_SIGGRAPH_Advances_2021_final.pdf * https://blog.traverseresearch.nl/creating-a-directed-acyclic-graph-from-a-mesh-1329e57286e5 * https://jglrxavpok.github.io/2024/01/19/recreating-nanite-lod-generation.html, https://jglrxavpok.github.io/2024/03/12/recreating-nanite-faster-lod-generation.html, https://jglrxavpok.github.io/2024/04/02/recreating-nanite-runtime-lod-selection.html, and https://github.com/jglrxavpok/Carrot * https://github.com/gents83/INOX/tree/master/crates/plugins/binarizer/src * https://cs418.cs.illinois.edu/website/text/nanite.html ![image](https://github.com/bevyengine/bevy/assets/47158642/e40bff9b-7d0c-4a19-a3cc-2aad24965977) ![image](https://github.com/bevyengine/bevy/assets/47158642/442c7da3-7761-4da7-9acd-37f15dd13e26) --------- Co-authored-by: Ricky Taylor <rickytaylor26@gmail.com> Co-authored-by: vero <email@atlasdostal.com> Co-authored-by: François <mockersf@gmail.com> Co-authored-by: atlas dostal <rodol@rivalrebels.com> Co-authored-by: Patrick Walton <pcwalton@mimiga.net>
73 lines
2.4 KiB
TOML
73 lines
2.4 KiB
TOML
[package]
|
|
name = "bevy_pbr"
|
|
version = "0.14.0-dev"
|
|
edition = "2021"
|
|
description = "Adds PBR rendering to Bevy Engine"
|
|
homepage = "https://bevyengine.org"
|
|
repository = "https://github.com/bevyengine/bevy"
|
|
license = "MIT OR Apache-2.0"
|
|
keywords = ["bevy"]
|
|
|
|
[features]
|
|
webgl = []
|
|
webgpu = []
|
|
pbr_transmission_textures = []
|
|
shader_format_glsl = ["bevy_render/shader_format_glsl"]
|
|
trace = ["bevy_render/trace"]
|
|
ios_simulator = ["bevy_render/ios_simulator"]
|
|
# Enables the meshlet renderer for dense high-poly scenes (experimental)
|
|
meshlet = [
|
|
"dep:lz4_flex",
|
|
"dep:serde",
|
|
"dep:bincode",
|
|
"dep:thiserror",
|
|
"dep:range-alloc",
|
|
]
|
|
# Enables processing meshes into meshlet meshes
|
|
meshlet_processor = ["meshlet", "dep:meshopt", "dep:metis", "dep:itertools"]
|
|
|
|
[dependencies]
|
|
# bevy
|
|
bevy_app = { path = "../bevy_app", version = "0.14.0-dev" }
|
|
bevy_asset = { path = "../bevy_asset", version = "0.14.0-dev" }
|
|
bevy_color = { path = "../bevy_color", version = "0.14.0-dev" }
|
|
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.14.0-dev" }
|
|
bevy_ecs = { path = "../bevy_ecs", version = "0.14.0-dev" }
|
|
bevy_math = { path = "../bevy_math", version = "0.14.0-dev" }
|
|
bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", features = [
|
|
"bevy",
|
|
] }
|
|
bevy_render = { path = "../bevy_render", version = "0.14.0-dev" }
|
|
bevy_transform = { path = "../bevy_transform", version = "0.14.0-dev" }
|
|
bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" }
|
|
bevy_window = { path = "../bevy_window", version = "0.14.0-dev" }
|
|
bevy_derive = { path = "../bevy_derive", version = "0.14.0-dev" }
|
|
|
|
|
|
# other
|
|
bitflags = "2.3"
|
|
fixedbitset = "0.5"
|
|
# meshlet
|
|
lz4_flex = { version = "0.11", default-features = false, features = [
|
|
"frame",
|
|
], optional = true }
|
|
serde = { version = "1", features = ["derive", "rc"], optional = true }
|
|
bincode = { version = "1", optional = true }
|
|
thiserror = { version = "1", optional = true }
|
|
range-alloc = { version = "0.1", optional = true }
|
|
meshopt = { version = "0.2", optional = true }
|
|
metis = { version = "0.2", optional = true }
|
|
itertools = { version = "0.12", optional = true }
|
|
# direct dependency required for derive macro
|
|
bytemuck = { version = "1", features = ["derive", "must_cast"] }
|
|
radsort = "0.1"
|
|
smallvec = "1.6"
|
|
nonmax = "0.5"
|
|
static_assertions = "1"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[package.metadata.docs.rs]
|
|
rustdoc-args = ["-Zunstable-options", "--cfg", "docsrs"]
|
|
all-features = true
|