Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.
1#import bevy_pbr::{
2 mesh_view_types::Lights,
3 atmosphere::{
4 types::{Atmosphere, AtmosphereSettings},
5 bindings::{atmosphere, view, settings},
6 functions::{
7 sample_atmosphere, AtmosphereSample,
8 sample_local_inscattering, get_view_position,
9 max_atmosphere_distance, direction_atmosphere_to_world,
10 sky_view_lut_uv_to_zenith_azimuth, zenith_azimuth_to_ray_dir,
11 MIDPOINT_RATIO, raymarch_atmosphere, EPSILON
12 },
13 }
16#import bevy_render::{
17 view::View,
18 maths::HALF_PI,
20#import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput
22@group(0) @binding(13) var sky_view_lut_out: texture_storage_2d<rgba16float, write>;
24@compute
25@workgroup_size(16, 16, 1)
26fn main(@builtin(global_invocation_id) idx: vec3<u32>) {
27 let uv = vec2<f32>(idx.xy) / vec2<f32>(settings.sky_view_lut_size);
29 let cam_pos = get_view_position();
30 let r = length(cam_pos);
31 var zenith_azimuth = sky_view_lut_uv_to_zenith_azimuth(r, uv);
33 let ray_dir_as = zenith_azimuth_to_ray_dir(zenith_azimuth.x, zenith_azimuth.y);
34 let ray_dir_ws = direction_atmosphere_to_world(ray_dir_as);
36 let world_pos = vec3(0.0, r, 0.0);
37 let up = normalize(world_pos);
38 let mu = dot(ray_dir_ws, up);
39 let t_max = max_atmosphere_distance(r, mu);
41 let result = raymarch_atmosphere(world_pos, ray_dir_ws, t_max, settings.sky_view_lut_samples, uv, true);
43 textureStore(sky_view_lut_out, idx.xy, vec4(result.inscattering, 1.0));
Contents