SIGN IN SIGN UP
bevyengine / bevy UNCLAIMED

A refreshingly simple data-driven game engine built in Rust

0 0 59 Rust

fixed far plane intersection test for fogvolumes (#24220)

# Objective

Fixes #22574 

## Solution

The previous code assumed there are only 3 back faces visible at any
time for the FogVolume. This assumption is incorrect and breaks in some
instances: e.g. when the camera is looking head-on at one of the faces
of a cube. Depending on the distance and size of the cube, 5 back faces
will be visible.

The solution is to consider all visible back faces for testing in the
shader.

## Testing

Tested with this command and on another test scene without atmospherics
(see showcase)
`cargo run -r --example atmosphere --features free_camera`

---

## Showcase

Before:


https://github.com/user-attachments/assets/72381ba3-b85f-4a14-9dab-70d99b205ddd

After:


https://github.com/user-attachments/assets/9438bcf2-0c95-4d44-9341-52114ecd68cd

</details>

---------

Co-authored-by: François Mockers <francois.mockers@vleue.com>
Co-authored-by: Kevin Chen <chen.kevin.f@gmail.com>
J
Jeroen committed
42e0cd4a563bdc8a7404df9b12c4fd83b31d82f4
Parent: 6dca76a
Committed by GitHub <noreply@github.com> on 5/21/2026, 11:12:57 AM