Skip to content

Commit

Permalink
Adelson's Checker-Shadow Illusion
Browse files Browse the repository at this point in the history
  • Loading branch information
altunenes committed Oct 27, 2024
1 parent ca20552 commit 215d742
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions shaders/adelson.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fn render(ro: vec3<f32>, rd: vec3<f32>) -> vec3<f32> {
}

let diff = max(dot(n, LIGHT_DIR), 0.0);
let amb = 0.099;
let amb = params.blue;

let isDot = dotss(p.xz);
if (isDot < 0.5 || res.y > 0.5) {
Expand All @@ -140,7 +140,7 @@ fn render(ro: vec3<f32>, rd: vec3<f32>) -> vec3<f32> {
fn main(@builtin(position) FragCoord: vec4<f32>) -> @location(0) vec4<f32> {
let resolution = vec2<f32>(1920.0, 1080.0);
var uv = (vec2<f32>(FragCoord.x / resolution.x, 1.0 - FragCoord.y / resolution.y) * 2.0 - vec2<f32>(1.0, 1.0));
let angle = u_time.time * params.blue* PI / 30.0;
let angle = u_time.time * 2.0* PI / 30.0;
let camHeight = 2.0;
let camDist = 1.5;
let la = clamp(angle, -1.0472, 1.0472);
Expand Down
4 changes: 2 additions & 2 deletions src/adelson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn update(app: &App, model: &mut Model, update: Update) {
ui.add(egui::Slider::new(&mut model.settings.theta, 0.0..=5.0).text("CYLINDER_HEIGHT"));
ui.add(egui::Slider::new(&mut model.settings.sigma, 0.0..=2.0).text("CYLINDER_RADIUS"));
ui.add(egui::Slider::new(&mut model.settings.gamma, 0.0..=2.0).text("gamma"));
ui.add(egui::Slider::new(&mut model.settings.blue, 1.0..=4.0).text("b"));
ui.add(egui::Slider::new(&mut model.settings.blue, 0.0..=0.1).text("Illusion_constant"));

});
let params_data = [model.settings.lambda, model.settings.theta, model.settings.sigma,model.settings.gamma,model.settings.blue];
Expand Down Expand Up @@ -146,7 +146,7 @@ fn model(app: &App) -> Model {
theta:0.8,
sigma:0.2,
gamma:0.4545,
blue:2.0,
blue:0.095,
show_ui:true,
};
let params_data = [settings.lambda, settings.theta, settings.sigma,settings.gamma,settings.blue];
Expand Down

0 comments on commit 215d742

Please sign in to comment.