mirror of
https://github.com/bevyengine/bevy
synced 2024-11-14 08:58:04 +00:00
2ae5a21009
[*Percentage-closer soft shadows*] are a technique from 2004 that allow shadows to become blurrier farther from the objects that cast them. It works by introducing a *blocker search* step that runs before the normal shadow map sampling. The blocker search step detects the difference between the depth of the fragment being rasterized and the depth of the nearby samples in the depth buffer. Larger depth differences result in a larger penumbra and therefore a blurrier shadow. To enable PCSS, fill in the `soft_shadow_size` value in `DirectionalLight`, `PointLight`, or `SpotLight`, as appropriate. This shadow size value represents the size of the light and should be tuned as appropriate for your scene. Higher values result in a wider penumbra (i.e. blurrier shadows). When using PCSS, temporal shadow maps (`ShadowFilteringMethod::Temporal`) are recommended. If you don't use `ShadowFilteringMethod::Temporal` and instead use `ShadowFilteringMethod::Gaussian`, Bevy will use the same technique as `Temporal`, but the result won't vary over time. This produces a rather noisy result. Doing better would likely require downsampling the shadow map, which would be complex and slower (and would require PR #13003 to land first). In addition to PCSS, this commit makes the near Z plane for the shadow map configurable on a per-light basis. Previously, it had been hardcoded to 0.1 meters. This change was necessary to make the point light shadow map in the example look reasonable, as otherwise the shadows appeared far too aliased. A new example, `pcss`, has been added. It demonstrates the percentage-closer soft shadow technique with directional lights, point lights, spot lights, non-temporal operation, and temporal operation. The assets are my original work. Both temporal and non-temporal shadows are rather noisy in the example, and, as mentioned before, this is unavoidable without downsampling the depth buffer, which we can't do yet. Note also that the shadows don't look particularly great for point lights; the example simply isn't an ideal scene for them. Nevertheless, I felt that the benefits of the ability to do a side-by-side comparison of directional and point lights outweighed the unsightliness of the point light shadows in that example, so I kept the point light feature in. Fixes #3631. [*Percentage-closer soft shadows*]: https://developer.download.nvidia.com/shaderlibrary/docs/shadow_PCSS.pdf ## Changelog ### Added * Percentage-closer soft shadows (PCSS) are now supported, allowing shadows to become blurrier as they stretch away from objects. To use them, set the `soft_shadow_size` field in `DirectionalLight`, `PointLight`, or `SpotLight`, as applicable. * The near Z value for shadow maps is now customizable via the `shadow_map_near_z` field in `DirectionalLight`, `PointLight`, and `SpotLight`. ## Screenshots PCSS off: ![Screenshot 2024-05-24 120012](https://github.com/bevyengine/bevy/assets/157897/0d35fe98-245b-44fb-8a43-8d0272a73b86) PCSS on: ![Screenshot 2024-05-24 115959](https://github.com/bevyengine/bevy/assets/157897/83397ef8-1317-49dd-bfb3-f8286d7610cd) --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: Torstein Grindvik <52322338+torsteingrindvik@users.noreply.github.com>
37 lines
1.3 KiB
TOML
37 lines
1.3 KiB
TOML
[files]
|
|
extend-exclude = [
|
|
"*.pbxproj", # metadata file
|
|
"*.patch", # Automatically generated files that should not be manually modified.
|
|
"*.bin", # Binary files
|
|
]
|
|
|
|
# Corrections take the form of a key/value pair. The key is the incorrect word
|
|
# and the value is the correct word. If the key and value are the same, the
|
|
# word is treated as always correct. If the value is an empty string, the word
|
|
# is treated as always incorrect.
|
|
|
|
# Match Whole Word - Case Sensitive
|
|
[default.extend-identifiers]
|
|
iy = "iy" # Variable name used in bevy_gizmos. Probably stands for "y-axis index", as it's being used in loops.
|
|
ser = "ser" # ron::ser - Serializer
|
|
SME = "SME" # Subject Matter Expert
|
|
Sur = "Sur" # macOS Big Sur - South
|
|
Masia = "Masia" # The surname of one of the authors of SMAA
|
|
Ba = "Ba" # Bitangent for Anisotropy
|
|
ba = "ba" # Part of an accessor in WGSL - color.ba
|
|
|
|
# Match Inside a Word - Case Insensitive
|
|
[default.extend-words]
|
|
LOD = "LOD" # Level of detail
|
|
TOI = "TOI" # Time of impact
|
|
|
|
[default]
|
|
extend-ignore-identifiers-re = [
|
|
"NDK", # NDK - Native Development Kit
|
|
"inventario", # Inventory in Portuguese
|
|
"PNG", # PNG - Portable Network Graphics file format
|
|
# Used in bevy_mikktspace
|
|
"iFO",
|
|
"vOt",
|
|
"fLenOt",
|
|
]
|