Tweak fog params
This commit is contained in:
parent
c4ca8b9a04
commit
31c86644a7
3 changed files with 15 additions and 8 deletions
|
@ -7,7 +7,6 @@ const SHADOW_SAMPLES = 2;
|
||||||
const INV_SHADOW_SAMPLES = 1.0 / 25.0;
|
const INV_SHADOW_SAMPLES = 1.0 / 25.0;
|
||||||
const FOG_MAX_STEPS = 30;
|
const FOG_MAX_STEPS = 30;
|
||||||
const FOG_STEP_SIZE = 5.0;
|
const FOG_STEP_SIZE = 5.0;
|
||||||
const FOG_SCALE = 0.01;
|
|
||||||
const FOG_DENSITY = 2.0;
|
const FOG_DENSITY = 2.0;
|
||||||
const FOG_ALPHA = 1.0;
|
const FOG_ALPHA = 1.0;
|
||||||
const FOG_BLEND_STEPS = 4;
|
const FOG_BLEND_STEPS = 4;
|
||||||
|
|
|
@ -46,11 +46,19 @@ var t_geometry_depth: texture_depth_2d;
|
||||||
var s_geometry_depth: sampler;
|
var s_geometry_depth: sampler;
|
||||||
|
|
||||||
fn fog_noise(pos: vec3<f32>) -> f32 {
|
fn fog_noise(pos: vec3<f32>) -> f32 {
|
||||||
var p = pos * FOG_SCALE;
|
var p1 = pos * 0.01;
|
||||||
p.x += global_uniforms.time * 0.1;
|
p1.x += global_uniforms.time * 0.2;
|
||||||
p.y += global_uniforms.time * 0.2;
|
p1.y += global_uniforms.time * 0.2;
|
||||||
p.z += sin(global_uniforms.time * 0.1) * 0.2;
|
p1.z += sin(global_uniforms.time * 0.1) * 0.5;
|
||||||
return fbm(p);
|
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<f32>, direction: vec3<f32>, scene_depth: f32) -> f32 {
|
fn ray_march(origin: vec3<f32>, direction: vec3<f32>, scene_depth: f32) -> f32 {
|
||||||
|
|
|
@ -400,9 +400,9 @@ impl State {
|
||||||
});
|
});
|
||||||
|
|
||||||
let fog_instances = vec![Instance {
|
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(),
|
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::<Vec<_>>();
|
let fog_instance_data = fog_instances.iter().map(Instance::to_raw).collect::<Vec<_>>();
|
||||||
let fog_instance_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
let fog_instance_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue