From 8ff7ee7f62901f8540068b645c3b4d12871ee091 Mon Sep 17 00:00:00 2001 From: arcadeperfect Date: Sat, 7 Dec 2024 01:18:41 -0500 Subject: [PATCH] better defaults --- src/gui.rs | 4 ++-- src/main.rs | 9 +++++---- src/shaders/ca.wgsl | 2 +- src/shaders/extract.wgsl | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/gui.rs b/src/gui.rs index 25182a2..b2a9f1b 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -37,7 +37,7 @@ fn ui_system( ui.label("radius"); ui.add(egui::Slider::new(&mut params.radius, 0.0..=1.).text("radius")); ui.add(egui::Slider::new(&mut params.noise_amplitude, 0.0..=5.).text("amplitude")); - ui.add(egui::Slider::new(&mut params.noise_scale, 0.0..=1.).text("frequency")); + ui.add(egui::Slider::new(&mut params.noise_freq, 0.0..=1.).text("frequency")); ui.add(egui::Slider::new(&mut params.noise_offset, 0.0..=20.).text("offset")); ui.add(egui::Slider::new(&mut params.power_bias, 0.0..=6.).text("power bias")); ui.add(egui::Slider::new(&mut params.flatness, 0.0..=6.).text("flatness")); @@ -60,7 +60,7 @@ fn ui_system( .range(0..=100), ); }); - ui.add(egui::Slider::new(&mut params.ca_thresh, 0.0..=1.).text("thresh")); + ui.add(egui::Slider::new(&mut params.ca_thresh, 0.0..=0.25).text("thresh")); ui.add(egui::Slider::new(&mut params.ca_search_radius, 0.1..=6.).text("search radius")); }); diff --git a/src/main.rs b/src/main.rs index ca0f877..13886e7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,7 +34,7 @@ struct ParamsUniform { dimensions: u32, radius: f32, noise_seed: u32, - noise_scale: f32, + noise_freq: f32, noise_amplitude: f32, noise_offset: f32, power_bias: f32, @@ -49,13 +49,14 @@ struct ParamsUniform { } impl Default for ParamsUniform { + fn default() -> Self { Self { dimensions: BUFFER_LEN as u32, - radius: 0.5, + radius: 0.75, noise_seed: 0, - noise_scale: 1.0, - noise_amplitude: 1.0, + noise_freq: 0.3, + noise_amplitude: 1.55, noise_offset: 0.0, power_bias: 1.8, flatness: 1.5, diff --git a/src/shaders/ca.wgsl b/src/shaders/ca.wgsl index 0657fa7..5b659c3 100644 --- a/src/shaders/ca.wgsl +++ b/src/shaders/ca.wgsl @@ -156,7 +156,7 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { // Create an exponential edge falloff factor // pow(x, n) where n > 1 creates exponential curve // Higher power = sharper falloff - let edge_power = n * 5.; // Adjust this to control falloff sharpness + let edge_power = n * 51.; // Adjust this to control falloff sharpness let edge_scale = n; // Adjust this to control where falloff starts let edge_factor = pow(clamp(edge_dist / edge_scale, 0.0, 1.0), edge_power); diff --git a/src/shaders/extract.wgsl b/src/shaders/extract.wgsl index 3ec1369..0258815 100644 --- a/src/shaders/extract.wgsl +++ b/src/shaders/extract.wgsl @@ -30,5 +30,5 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { r = clamp(r, 0., 1.); // textureStore(output_texture, upos, vec4f(r,r,r,1.)); - textureStore(output_texture, upos, vec4f(r, 0., 0., 1.0)); + textureStore(output_texture, upos, vec4f(r, current.g, current.b, 1.0)); }