diff --git a/res/shaders/constants.wgsl b/res/shaders/constants.wgsl index 62b2acc..5de93ee 100644 --- a/res/shaders/constants.wgsl +++ b/res/shaders/constants.wgsl @@ -7,7 +7,6 @@ const SHADOW_SAMPLES = 2; const INV_SHADOW_SAMPLES = 1.0 / 25.0; const FOG_MAX_STEPS = 30; const FOG_STEP_SIZE = 5.0; -const FOG_SCALE = 0.01; const FOG_DENSITY = 2.0; const FOG_ALPHA = 1.0; const FOG_BLEND_STEPS = 4; diff --git a/res/shaders/fog.wgsl b/res/shaders/fog.wgsl index 9b598ea..7cdb00f 100644 --- a/res/shaders/fog.wgsl +++ b/res/shaders/fog.wgsl @@ -46,11 +46,19 @@ var t_geometry_depth: texture_depth_2d; var s_geometry_depth: sampler; fn fog_noise(pos: vec3) -> f32 { - var p = pos * FOG_SCALE; - p.x += global_uniforms.time * 0.1; - p.y += global_uniforms.time * 0.2; - p.z += sin(global_uniforms.time * 0.1) * 0.2; - return fbm(p); + var p1 = pos * 0.01; + p1.x += global_uniforms.time * 0.2; + p1.y += global_uniforms.time * 0.2; + p1.z += sin(global_uniforms.time * 0.1) * 0.5; + let noise1 = fbm(p1); + + var p2 = pos * 0.05; + p2.x += global_uniforms.time * 0.2; + p2.y += global_uniforms.time * 0.2; + p2.z += sin(global_uniforms.time * 0.1) * 0.5; + let noise2 = fbm(p2); + + return 0.8 * noise1 + 0.2 * noise2; } fn ray_march(origin: vec3, direction: vec3, scene_depth: f32) -> f32 { diff --git a/src/core/state.rs b/src/core/state.rs index 65965ce..0c4611b 100644 --- a/src/core/state.rs +++ b/src/core/state.rs @@ -400,9 +400,9 @@ impl State { }); let fog_instances = vec![Instance { - position: [0.0, 20.0, 0.0].into(), + position: [0.0, 30.0, 0.0].into(), rotation: cgmath::Quaternion::one(), - scale: [1360.0, 20.0, 600.0].into(), + scale: [1360.0, 30.0, 600.0].into(), }]; let fog_instance_data = fog_instances.iter().map(Instance::to_raw).collect::>(); let fog_instance_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {