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.

nishita.wgsl

Constants

PI

#
const PI: f32 = 3.141592653589793

ISTEPS

#
const ISTEPS: u32 = 16u

JSTEPS

#
const JSTEPS: u32 = 8u

Bindings

nishita

#
@group(0)
@binding(0)
var<uniform> nishita: Nishita

image

#
@group(1)
@binding(0)
var image: texture_storage_2d_array<rgba16float, write>

Structures

Nishita

#
struct Nishita {
ray_origin: vec3<f32> ,
sun_position: vec3<f32> ,
sun_intensity: f32 ,
planet_radius: f32 ,
atmosphere_radius: f32 ,
rayleigh_coefficient: vec3<f32> ,
rayleigh_scale_height: f32 ,
mie_coefficient: f32 ,
mie_scale_height: f32 ,
mie_direction: f32 ,
}

Functions

rsi

#
fn rsi ( ) -> vec2<f32>

render_nishita

#
fn render_nishita (
p_sun_full: vec3<f32>
i_sun: f32
r_planet: f32
r_atmos: f32
k_mie: f32
sh_rlh: f32
sh_mie: f32
) -> vec3<f32>

main

#
@compute
Runs custom parallel code on the GPU, not limited to graphics
@workgroup_size(8, 8, 1)
Defines the size of a thread group. One to three numbers: width (x), height (y), and depth (z). Missing values default to 1
fn main (
@builtin(global_invocation_id)
invocation_id: vec3<u32>
@builtin(num_workgroups)
num_workgroups: vec3<u32>
)