Skip to content

Conversation

@ecoskey
Copy link
Contributor

@ecoskey ecoskey commented Oct 24, 2025

Objective

current exponential falloff parametrization isn't intuitive, strays from previous "scale height" parametrization common in atmospheric scattering literature

Solution

  • Switch to a parametrization of the form
          -(1-p)/s    -1/s
         e         - e
f(p,s) = -----------------
                      -1/s
         1.0       - e

This is basically equivalent to the "scale height" parametrization e^-(1-p)/s for small values of scale, but also has the nice properties f(0, s) = 0, f(1, s) = 1 and has a broader domain for values of scale.

Testing

  • Ran the example, results looked good

@ecoskey ecoskey requested a review from mate-h October 24, 2025 01:24
@ecoskey ecoskey added A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 24, 2025
/// Returns a scattering medium representing an earthlike atmosphere.
///
/// Uses physically-based scale heights from Earth's atmosphere, assuming
/// a 60 km atmosphere height:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took this directly from your pr @mate-h, but isn't this meant to be 100km?

Falloff::Exponential { scale } => {
// fill discontinuity at scale == 0,
// arbitrarily choose linear falloff
if *scale == 0.0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This discontinuity is kind of unfortunate, since it's there because of the division by scale below. I'm fine with it though since it lets us stay close to the "scale height" parametrization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant