mirror of
https://github.com/bevyengine/bevy
synced 2024-11-14 08:58:04 +00:00
77ed72bc16
Clearcoat is a separate material layer that represents a thin translucent layer of a material. Examples include (from the [Filament spec]) car paint, soda cans, and lacquered wood. This commit implements support for clearcoat following the Filament and Khronos specifications, marking the beginnings of support for multiple PBR layers in Bevy. The [`KHR_materials_clearcoat`] specification describes the clearcoat support in glTF. In Blender, applying a clearcoat to the Principled BSDF node causes the clearcoat settings to be exported via this extension. As of this commit, Bevy parses and reads the extension data when present in glTF. Note that the `gltf` crate has no support for `KHR_materials_clearcoat`; this patch therefore implements the JSON semantics manually. Clearcoat is integrated with `StandardMaterial`, but the code is behind a series of `#ifdef`s that only activate when clearcoat is present. Additionally, the `pbr_feature_layer_material_textures` Cargo feature must be active in order to enable support for clearcoat factor maps, clearcoat roughness maps, and clearcoat normal maps. This approach mirrors the same pattern used by the existing transmission feature and exists to avoid running out of texture bindings on platforms like WebGL and WebGPU. Note that constant clearcoat factors and roughness values *are* supported in the browser; only the relatively-less-common maps are disabled on those platforms. This patch refactors the lighting code in `StandardMaterial` significantly in order to better support multiple layers in a natural way. That code was due for a refactor in any case, so this is a nice improvement. A new demo, `clearcoat`, has been added. It's based on [the corresponding three.js demo], but all the assets (aside from the skybox and environment map) are my original work. [Filament spec]: https://google.github.io/filament/Filament.html#materialsystem/clearcoatmodel [`KHR_materials_clearcoat`]: https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_clearcoat/README.md [the corresponding three.js demo]: https://threejs.org/examples/webgl_materials_physical_clearcoat.html ![Screenshot 2024-04-19 101143](https://github.com/bevyengine/bevy/assets/157897/3444bcb5-5c20-490c-b0ad-53759bd47ae2) ![Screenshot 2024-04-19 102054](https://github.com/bevyengine/bevy/assets/157897/6e953944-75b8-49ef-bc71-97b0a53b3a27) ## Changelog ### Added * `StandardMaterial` now supports a clearcoat layer, which represents a thin translucent layer over an underlying material. * The glTF loader now supports the `KHR_materials_clearcoat` extension, representing materials with clearcoat layers. ## Migration Guide * The lighting functions in the `pbr_lighting` WGSL module now have clearcoat parameters, if `STANDARD_MATERIAL_CLEARCOAT` is defined. * The `R` reflection vector parameter has been removed from some lighting functions, as it was unused.
227 lines
8.2 KiB
TOML
227 lines
8.2 KiB
TOML
[package]
|
|
name = "bevy_internal"
|
|
version = "0.14.0-dev"
|
|
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_asset?/trace",
|
|
"bevy_core_pipeline?/trace",
|
|
"bevy_ecs/trace",
|
|
"bevy_log/trace",
|
|
"bevy_pbr?/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"]
|
|
|
|
sysinfo_plugin = ["bevy_diagnostic/sysinfo_plugin"]
|
|
|
|
# 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", "bevy_core_pipeline/dds", "bevy_gltf/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"]
|
|
shader_format_spirv = ["bevy_render/shader_format_spirv"]
|
|
|
|
serialize = [
|
|
"bevy_core/serialize",
|
|
"bevy_input/serialize",
|
|
"bevy_time/serialize",
|
|
"bevy_window/serialize",
|
|
"bevy_winit?/serialize",
|
|
"bevy_transform/serialize",
|
|
"bevy_math/serialize",
|
|
"bevy_scene?/serialize",
|
|
"bevy_ui?/serialize",
|
|
"bevy_color?/serialize",
|
|
]
|
|
multi-threaded = [
|
|
"bevy_asset?/multi-threaded",
|
|
"bevy_ecs/multi-threaded",
|
|
"bevy_render?/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",
|
|
]
|
|
|
|
# Multi-layer material textures in `StandardMaterial`:
|
|
pbr_multi_layer_material_textures = [
|
|
"bevy_pbr?/pbr_multi_layer_material_textures",
|
|
"bevy_gltf?/pbr_multi_layer_material_textures",
|
|
]
|
|
|
|
# Optimise for WebGL2
|
|
webgl = [
|
|
"bevy_core_pipeline?/webgl",
|
|
"bevy_pbr?/webgl",
|
|
"bevy_render?/webgl",
|
|
"bevy_gizmos?/webgl",
|
|
"bevy_sprite?/webgl",
|
|
]
|
|
|
|
webgpu = [
|
|
"bevy_core_pipeline?/webgpu",
|
|
"bevy_pbr?/webgpu",
|
|
"bevy_render?/webgpu",
|
|
"bevy_gizmos?/webgpu",
|
|
"bevy_sprite?/webgpu",
|
|
]
|
|
|
|
# enable systems that allow for automated testing on CI
|
|
bevy_ci_testing = ["bevy_dev_tools/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"]
|
|
|
|
# Enable system stepping support
|
|
bevy_debug_stepping = [
|
|
"bevy_ecs/bevy_debug_stepping",
|
|
"bevy_app/bevy_debug_stepping",
|
|
]
|
|
|
|
# Enables the meshlet renderer for dense high-poly scenes (experimental)
|
|
meshlet = ["bevy_pbr?/meshlet"]
|
|
|
|
# Enables processing meshes into meshlet meshes for bevy_pbr
|
|
meshlet_processor = ["bevy_pbr?/meshlet_processor"]
|
|
|
|
# Provides a collection of developer tools
|
|
bevy_dev_tools = ["dep:bevy_dev_tools"]
|
|
|
|
# Enable support for the ios_simulator by downgrading some rendering capabilities
|
|
ios_simulator = ["bevy_pbr?/ios_simulator", "bevy_render?/ios_simulator"]
|
|
|
|
[dependencies]
|
|
# bevy
|
|
bevy_a11y = { path = "../bevy_a11y", version = "0.14.0-dev" }
|
|
bevy_app = { path = "../bevy_app", version = "0.14.0-dev" }
|
|
bevy_core = { path = "../bevy_core", version = "0.14.0-dev" }
|
|
bevy_derive = { path = "../bevy_derive", version = "0.14.0-dev" }
|
|
bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.14.0-dev" }
|
|
bevy_ecs = { path = "../bevy_ecs", version = "0.14.0-dev" }
|
|
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.14.0-dev" }
|
|
bevy_input = { path = "../bevy_input", version = "0.14.0-dev" }
|
|
bevy_log = { path = "../bevy_log", version = "0.14.0-dev" }
|
|
bevy_math = { path = "../bevy_math", version = "0.14.0-dev" }
|
|
bevy_ptr = { path = "../bevy_ptr", version = "0.14.0-dev" }
|
|
bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", features = [
|
|
"bevy",
|
|
] }
|
|
bevy_time = { path = "../bevy_time", 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_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" }
|
|
# bevy (optional)
|
|
bevy_animation = { path = "../bevy_animation", optional = true, version = "0.14.0-dev" }
|
|
bevy_asset = { path = "../bevy_asset", optional = true, version = "0.14.0-dev" }
|
|
bevy_audio = { path = "../bevy_audio", optional = true, version = "0.14.0-dev" }
|
|
bevy_color = { path = "../bevy_color", optional = true, version = "0.14.0-dev" }
|
|
bevy_core_pipeline = { path = "../bevy_core_pipeline", optional = true, version = "0.14.0-dev" }
|
|
bevy_gltf = { path = "../bevy_gltf", optional = true, version = "0.14.0-dev" }
|
|
bevy_pbr = { path = "../bevy_pbr", optional = true, version = "0.14.0-dev" }
|
|
bevy_render = { path = "../bevy_render", optional = true, version = "0.14.0-dev" }
|
|
bevy_dynamic_plugin = { path = "../bevy_dynamic_plugin", optional = true, version = "0.14.0-dev" }
|
|
bevy_scene = { path = "../bevy_scene", optional = true, version = "0.14.0-dev" }
|
|
bevy_sprite = { path = "../bevy_sprite", optional = true, version = "0.14.0-dev" }
|
|
bevy_text = { path = "../bevy_text", optional = true, version = "0.14.0-dev" }
|
|
bevy_ui = { path = "../bevy_ui", optional = true, version = "0.14.0-dev" }
|
|
bevy_winit = { path = "../bevy_winit", optional = true, version = "0.14.0-dev" }
|
|
bevy_gilrs = { path = "../bevy_gilrs", optional = true, version = "0.14.0-dev" }
|
|
bevy_gizmos = { path = "../bevy_gizmos", optional = true, version = "0.14.0-dev", default-features = false }
|
|
bevy_dev_tools = { path = "../bevy_dev_tools", optional = true, version = "0.14.0-dev" }
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[package.metadata.docs.rs]
|
|
rustdoc-args = ["-Zunstable-options", "--cfg", "docsrs"]
|
|
all-features = true
|