Advanced search tips: use spaces to require multiple terms (AND), | for alternatives (OR), wrap phrases in quotes (="a b"), =term for exact match, 'term to include, !term to exclude, ^term to match prefix, !^term to exclude prefix, .ext$ to match suffix, and !.ext$ to exclude suffix.

bruneton_functions.wgsl

Import path

Functions

transmittance_lut_r_mu_to_uv

#

Mapping from view height ® and zenith cos angle (mu) to UV coordinates in the transmittance LUT Assuming r between ground and top atmosphere boundary, and mu= cos(zenith_angle) Chosen to increase precision near the ground and to work around a discontinuity at the horizon See Bruneton and Neyret 2008, “Precomputed Atmospheric Scattering” section 4

fn transmittance_lut_r_mu_to_uv ( ) -> vec2<f32>

transmittance_lut_uv_to_r_mu

#

Inverse of the mapping above, mapping from UV coordinates in the transmittance LUT to view height ® and zenith cos angle (mu)

fn transmittance_lut_uv_to_r_mu ( ) -> vec2<f32>

distance_to_top_atmosphere_boundary

#

Simplified ray-sphere intersection where: Ray origin, o = [0,0,r] with r <= atmosphere.top_radius mu is the cosine of spherical coordinate theta (-1.0 <= mu <= 1.0) so ray direction in spherical coordinates is [1,acos(mu),0] which needs to be converted to cartesian Direction of ray, u = [0,sqrt(1-mu*mu),mu] Center of sphere, c = [0,0,0] Radius of sphere, r = atmosphere.top_radius This function solves the quadratic equation for line-sphere intersection simplified under these assumptions

fn distance_to_top_atmosphere_boundary ( ) -> f32

distance_to_bottom_atmosphere_boundary

#

Simplified ray-sphere intersection as above for intersections with the ground

fn distance_to_bottom_atmosphere_boundary ( ) -> f32

ray_intersects_ground

#
fn ray_intersects_ground ( ) -> bool