mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 12:43:34 +00:00
54a943d232
# Objective This pull request implements *reflection probes*, which generalize environment maps to allow for multiple environment maps in the same scene, each of which has an axis-aligned bounding box. This is a standard feature of physically-based renderers and was inspired by [the corresponding feature in Blender's Eevee renderer]. ## Solution This is a minimal implementation of reflection probes that allows artists to define cuboid bounding regions associated with environment maps. For every view, on every frame, a system builds up a list of the nearest 4 reflection probes that are within the view's frustum and supplies that list to the shader. The PBR fragment shader searches through the list, finds the first containing reflection probe, and uses it for indirect lighting, falling back to the view's environment map if none is found. Both forward and deferred renderers are fully supported. A reflection probe is an entity with a pair of components, *LightProbe* and *EnvironmentMapLight* (as well as the standard *SpatialBundle*, to position it in the world). The *LightProbe* component (along with the *Transform*) defines the bounding region, while the *EnvironmentMapLight* component specifies the associated diffuse and specular cubemaps. A frequent question is "why two components instead of just one?" The advantages of this setup are: 1. It's readily extensible to other types of light probes, in particular *irradiance volumes* (also known as ambient cubes or voxel global illumination), which use the same approach of bounding cuboids. With a single component that applies to both reflection probes and irradiance volumes, we can share the logic that implements falloff and blending between multiple light probes between both of those features. 2. It reduces duplication between the existing *EnvironmentMapLight* and these new reflection probes. Systems can treat environment maps attached to cameras the same way they treat environment maps applied to reflection probes if they wish. Internally, we gather up all environment maps in the scene and place them in a cubemap array. At present, this means that all environment maps must have the same size, mipmap count, and texture format. A warning is emitted if this restriction is violated. We could potentially relax this in the future as part of the automatic mipmap generation work, which could easily do texture format conversion as part of its preprocessing. An easy way to generate reflection probe cubemaps is to bake them in Blender and use the `export-blender-gi` tool that's part of the [`bevy-baked-gi`] project. This tool takes a `.blend` file containing baked cubemaps as input and exports cubemap images, pre-filtered with an embedded fork of the [glTF IBL Sampler], alongside a corresponding `.scn.ron` file that the scene spawner can use to recreate the reflection probes. Note that this is intentionally a minimal implementation, to aid reviewability. Known issues are: * Reflection probes are basically unsupported on WebGL 2, because WebGL 2 has no cubemap arrays. (Strictly speaking, you can have precisely one reflection probe in the scene if you have no other cubemaps anywhere, but this isn't very useful.) * Reflection probes have no falloff, so reflections will abruptly change when objects move from one bounding region to another. * As mentioned before, all cubemaps in the world of a given type (diffuse or specular) must have the same size, format, and mipmap count. Future work includes: * Blending between multiple reflection probes. * A falloff/fade-out region so that reflected objects disappear gradually instead of vanishing all at once. * Irradiance volumes for voxel-based global illumination. This should reuse much of the reflection probe logic, as they're both GI techniques based on cuboid bounding regions. * Support for WebGL 2, by breaking batches when reflection probes are used. These issues notwithstanding, I think it's best to land this with roughly the current set of functionality, because this patch is useful as is and adding everything above would make the pull request significantly larger and harder to review. --- ## Changelog ### Added * A new *LightProbe* component is available that specifies a bounding region that an *EnvironmentMapLight* applies to. The combination of a *LightProbe* and an *EnvironmentMapLight* offers *reflection probe* functionality similar to that available in other engines. [the corresponding feature in Blender's Eevee renderer]: https://docs.blender.org/manual/en/latest/render/eevee/light_probes/reflection_cubemaps.html [`bevy-baked-gi`]: https://github.com/pcwalton/bevy-baked-gi [glTF IBL Sampler]: https://github.com/KhronosGroup/glTF-IBL-Sampler
190 lines
6.8 KiB
TOML
190 lines
6.8 KiB
TOML
[package]
|
|
name = "bevy_internal"
|
|
version = "0.12.0"
|
|
edition = "2021"
|
|
description = "An internal Bevy crate used to facilitate optional dynamic linking via the 'dynamic_linking' feature"
|
|
homepage = "https://bevyengine.org"
|
|
repository = "https://github.com/bevyengine/bevy"
|
|
license = "MIT OR Apache-2.0"
|
|
keywords = ["game", "engine", "gamedev", "graphics", "bevy"]
|
|
categories = ["game-engines", "graphics", "gui", "rendering"]
|
|
|
|
[features]
|
|
trace = [
|
|
"bevy_app/trace",
|
|
"bevy_core_pipeline?/trace",
|
|
"bevy_ecs/trace",
|
|
"bevy_log/trace",
|
|
"bevy_render?/trace",
|
|
"bevy_hierarchy/trace",
|
|
"bevy_winit?/trace",
|
|
]
|
|
trace_chrome = ["bevy_log/tracing-chrome"]
|
|
trace_tracy = ["bevy_render?/tracing-tracy", "bevy_log/tracing-tracy"]
|
|
trace_tracy_memory = ["bevy_log/trace_tracy_memory"]
|
|
wgpu_trace = ["bevy_render/wgpu_trace"]
|
|
detailed_trace = ["bevy_utils/detailed_trace"]
|
|
|
|
# Image format support for texture loading (PNG and HDR are enabled by default)
|
|
exr = ["bevy_render/exr"]
|
|
hdr = ["bevy_render/hdr"]
|
|
png = ["bevy_render/png"]
|
|
tga = ["bevy_render/tga"]
|
|
jpeg = ["bevy_render/jpeg"]
|
|
bmp = ["bevy_render/bmp"]
|
|
webp = ["bevy_render/webp"]
|
|
basis-universal = ["bevy_render/basis-universal"]
|
|
dds = ["bevy_render/dds"]
|
|
pnm = ["bevy_render/pnm"]
|
|
ktx2 = ["bevy_render/ktx2"]
|
|
# For ktx2 supercompression
|
|
zlib = ["bevy_render/zlib"]
|
|
zstd = ["bevy_render/zstd"]
|
|
|
|
# Include tonemapping LUT KTX2 files.
|
|
tonemapping_luts = ["bevy_core_pipeline/tonemapping_luts"]
|
|
|
|
# Audio format support (vorbis is enabled by default)
|
|
flac = ["bevy_audio/flac"]
|
|
mp3 = ["bevy_audio/mp3"]
|
|
vorbis = ["bevy_audio/vorbis"]
|
|
wav = ["bevy_audio/wav"]
|
|
minimp3 = ["bevy_audio/minimp3"]
|
|
symphonia-aac = ["bevy_audio/symphonia-aac"]
|
|
symphonia-all = ["bevy_audio/symphonia-all"]
|
|
symphonia-flac = ["bevy_audio/symphonia-flac"]
|
|
symphonia-isomp4 = ["bevy_audio/symphonia-isomp4"]
|
|
symphonia-vorbis = ["bevy_audio/symphonia-vorbis"]
|
|
symphonia-wav = ["bevy_audio/symphonia-wav"]
|
|
|
|
# Shader formats
|
|
shader_format_glsl = [
|
|
"bevy_render/shader_format_glsl",
|
|
"bevy_pbr?/shader_format_glsl",
|
|
]
|
|
shader_format_spirv = ["bevy_render/shader_format_spirv"]
|
|
|
|
serialize = [
|
|
"bevy_core/serialize",
|
|
"bevy_input/serialize",
|
|
"bevy_time/serialize",
|
|
"bevy_window/serialize",
|
|
"bevy_transform/serialize",
|
|
"bevy_math/serialize",
|
|
"bevy_scene?/serialize",
|
|
"bevy_ui?/serialize",
|
|
]
|
|
multi-threaded = [
|
|
"bevy_asset/multi-threaded",
|
|
"bevy_ecs/multi-threaded",
|
|
"bevy_tasks/multi-threaded",
|
|
]
|
|
async-io = ["bevy_tasks/async-io"]
|
|
|
|
# Display server protocol support (X11 is enabled by default)
|
|
wayland = ["bevy_winit/wayland"]
|
|
x11 = ["bevy_winit/x11"]
|
|
|
|
# enable rendering of font glyphs using subpixel accuracy
|
|
subpixel_glyph_atlas = ["bevy_text/subpixel_glyph_atlas"]
|
|
|
|
# Transmission textures in `StandardMaterial`:
|
|
pbr_transmission_textures = [
|
|
"bevy_pbr?/pbr_transmission_textures",
|
|
"bevy_gltf?/pbr_transmission_textures",
|
|
]
|
|
|
|
# Optimise for WebGL2
|
|
webgl = [
|
|
"bevy_core_pipeline?/webgl",
|
|
"bevy_pbr?/webgl",
|
|
"bevy_render?/webgl",
|
|
"bevy_gizmos?/webgl",
|
|
"bevy_sprite?/webgl",
|
|
]
|
|
|
|
# enable systems that allow for automated testing on CI
|
|
bevy_ci_testing = [
|
|
"bevy_app/bevy_ci_testing",
|
|
"bevy_time/bevy_ci_testing",
|
|
"bevy_render?/bevy_ci_testing",
|
|
"bevy_render?/ci_limits",
|
|
]
|
|
|
|
# Enable animation support, and glTF animation loading
|
|
animation = ["bevy_animation", "bevy_gltf?/bevy_animation"]
|
|
|
|
bevy_sprite = ["dep:bevy_sprite", "bevy_gizmos?/bevy_sprite"]
|
|
bevy_pbr = ["dep:bevy_pbr", "bevy_gizmos?/bevy_pbr"]
|
|
|
|
# Used to disable code that is unsupported when Bevy is dynamically linked
|
|
dynamic_linking = ["bevy_diagnostic/dynamic_linking"]
|
|
|
|
# Enable using a shared stdlib for cxx on Android.
|
|
android_shared_stdcxx = ["bevy_audio/android_shared_stdcxx"]
|
|
|
|
# Enable AccessKit on Unix backends (currently only works with experimental
|
|
# screen readers and forks.)
|
|
accesskit_unix = ["bevy_winit/accesskit_unix"]
|
|
|
|
bevy_text = ["dep:bevy_text", "bevy_ui?/bevy_text"]
|
|
|
|
bevy_render = ["dep:bevy_render", "bevy_scene?/bevy_render"]
|
|
|
|
# Enable assertions to check the validity of parameters passed to glam
|
|
glam_assert = ["bevy_math/glam_assert"]
|
|
|
|
# Enable assertions in debug builds to check the validity of parameters passed to glam
|
|
debug_glam_assert = ["bevy_math/debug_glam_assert"]
|
|
|
|
default_font = ["bevy_text?/default_font"]
|
|
|
|
# Enables the built-in asset processor for processed assets.
|
|
asset_processor = ["bevy_asset?/asset_processor"]
|
|
|
|
# Enables watching the filesystem for Bevy Asset hot-reloading
|
|
file_watcher = ["bevy_asset?/file_watcher"]
|
|
|
|
# Enables watching embedded files for Bevy Asset hot-reloading
|
|
embedded_watcher = ["bevy_asset?/embedded_watcher"]
|
|
|
|
[dependencies]
|
|
# bevy
|
|
bevy_a11y = { path = "../bevy_a11y", version = "0.12.0" }
|
|
bevy_app = { path = "../bevy_app", version = "0.12.0" }
|
|
bevy_core = { path = "../bevy_core", version = "0.12.0" }
|
|
bevy_derive = { path = "../bevy_derive", version = "0.12.0" }
|
|
bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.12.0" }
|
|
bevy_ecs = { path = "../bevy_ecs", version = "0.12.0" }
|
|
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.12.0" }
|
|
bevy_input = { path = "../bevy_input", version = "0.12.0" }
|
|
bevy_log = { path = "../bevy_log", version = "0.12.0" }
|
|
bevy_math = { path = "../bevy_math", version = "0.12.0" }
|
|
bevy_ptr = { path = "../bevy_ptr", version = "0.12.0" }
|
|
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = [
|
|
"bevy",
|
|
] }
|
|
bevy_time = { path = "../bevy_time", version = "0.12.0" }
|
|
bevy_transform = { path = "../bevy_transform", version = "0.12.0" }
|
|
bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
|
|
bevy_window = { path = "../bevy_window", version = "0.12.0" }
|
|
bevy_tasks = { path = "../bevy_tasks", version = "0.12.0" }
|
|
# bevy (optional)
|
|
bevy_animation = { path = "../bevy_animation", optional = true, version = "0.12.0" }
|
|
bevy_asset = { path = "../bevy_asset", optional = true, version = "0.12.0" }
|
|
bevy_audio = { path = "../bevy_audio", optional = true, version = "0.12.0" }
|
|
bevy_core_pipeline = { path = "../bevy_core_pipeline", optional = true, version = "0.12.0" }
|
|
bevy_gltf = { path = "../bevy_gltf", optional = true, version = "0.12.0" }
|
|
bevy_pbr = { path = "../bevy_pbr", optional = true, version = "0.12.0" }
|
|
bevy_render = { path = "../bevy_render", optional = true, version = "0.12.0" }
|
|
bevy_dynamic_plugin = { path = "../bevy_dynamic_plugin", optional = true, version = "0.12.0" }
|
|
bevy_scene = { path = "../bevy_scene", optional = true, version = "0.12.0" }
|
|
bevy_sprite = { path = "../bevy_sprite", optional = true, version = "0.12.0" }
|
|
bevy_text = { path = "../bevy_text", optional = true, version = "0.12.0" }
|
|
bevy_ui = { path = "../bevy_ui", optional = true, version = "0.12.0" }
|
|
bevy_winit = { path = "../bevy_winit", optional = true, version = "0.12.0" }
|
|
bevy_gilrs = { path = "../bevy_gilrs", optional = true, version = "0.12.0" }
|
|
bevy_gizmos = { path = "../bevy_gizmos", optional = true, version = "0.12.0", default-features = false }
|
|
|
|
[lints]
|
|
workspace = true
|