Skip to content

Commit

Permalink
fix: water wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ten3roberts committed Sep 22, 2023
1 parent 375216f commit dfe5b42
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/water/src/water.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ fn get_material(in: MaterialInput) -> MaterialOutput {

let screen_size = vec2<f32>(textureDimensions(solids_screen_depth));

let normal_t1 = textureSample(normals_texture, default_sampler, in.world_position.xy * 0.05 + vec2<f32>(global_params.time * 0.01, 0.)).xyz;
let normal_t2 = textureSample(normals_texture, default_sampler, in.world_position.xy * 0.1 + vec2<f32>(0., global_params.time * 0.02)).xyz;
let normal_uv1 = in.world_position.xy * 0.05 + vec2<f32>(global_params.time * 0.01, 0.0);
let normal_uv2 = in.world_position.xy * 0.13 + vec2<f32>(0.0, global_params.time * 0.024);

let normal_t1 = textureSample(normals_texture, default_sampler, fract(normal_uv1)).xyz;
let normal_t2 = textureSample(normals_texture, default_sampler, fract(normal_uv2)).xyz;

let normal_t = (normal_t1 + normal_t2) / 2.;
let normal = normalize(normal_t * 2. - 1.);

Expand Down

0 comments on commit dfe5b42

Please sign in to comment.