From dfe5b4269ebbb5a3c387dc3870d33986695fe4cc Mon Sep 17 00:00:00 2001 From: Tei Leelo Roberts Date: Fri, 22 Sep 2023 15:29:46 +0200 Subject: [PATCH] fix: water wrapping --- crates/water/src/water.wgsl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/water/src/water.wgsl b/crates/water/src/water.wgsl index 5d48e225fd..830e96b7e1 100644 --- a/crates/water/src/water.wgsl +++ b/crates/water/src/water.wgsl @@ -50,8 +50,12 @@ fn get_material(in: MaterialInput) -> MaterialOutput { let screen_size = vec2(textureDimensions(solids_screen_depth)); - let normal_t1 = textureSample(normals_texture, default_sampler, in.world_position.xy * 0.05 + vec2(global_params.time * 0.01, 0.)).xyz; - let normal_t2 = textureSample(normals_texture, default_sampler, in.world_position.xy * 0.1 + vec2(0., global_params.time * 0.02)).xyz; + let normal_uv1 = in.world_position.xy * 0.05 + vec2(global_params.time * 0.01, 0.0); + let normal_uv2 = in.world_position.xy * 0.13 + vec2(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.);