bevy/crates/bevy_pbr/src
Robert Swain ac8bbafc5c Faster view frustum culling (#4181)
# Objective

- Reduce time spent in the `check_visibility` system

## Solution

- Use `Vec3A` for all bounding volume types to leverage SIMD optimisations and to avoid repeated runtime conversions from `Vec3` to `Vec3A`
- Inline all bounding volume intersection methods
- Add on-the-fly calculated `Aabb` -> `Sphere` and do `Sphere`-`Frustum` intersection tests before `Aabb`-`Frustum` tests. This is faster for `many_cubes` but could be slower in other cases where the sphere test gives a false-positive that the `Aabb` test discards. Also, I tested precalculating the `Sphere`s and inserting them alongside the `Aabb` but this was slower. 
- Do not test meshes against the far plane. Apparently games don't do this anymore with infinite projections, and it's one fewer plane to test against. I made it optional and still do the test for culling lights but that is up for discussion.
- These collectively reduce `check_visibility` execution time in `many_cubes -- sphere` from 2.76ms to 1.48ms and increase frame rate from ~42fps to ~44fps
2022-03-19 04:41:28 +00:00
..
render KTX2/DDS/.basis compressed texture support (#3884) 2022-03-15 22:26:46 +00:00
alpha.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
bundle.rs add Visibility for lights (#3958) 2022-03-05 03:23:01 +00:00
lib.rs Dynamic light clusters (#3968) 2022-03-08 04:56:42 +00:00
light.rs Faster view frustum culling (#4181) 2022-03-19 04:41:28 +00:00
material.rs Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
pbr_material.rs KTX2/DDS/.basis compressed texture support (#3884) 2022-03-15 22:26:46 +00:00
wireframe.rs Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00