diff --git a/examples/jsm/objects/WaterMesh.js b/examples/jsm/objects/WaterMesh.js index 3e8dd31dfff85c..285df75da5a781 100644 --- a/examples/jsm/objects/WaterMesh.js +++ b/examples/jsm/objects/WaterMesh.js @@ -3,7 +3,7 @@ import { Mesh, Vector3 } from 'three'; -import { Fn, NodeMaterial, add, cameraPosition, div, normalize, positionWorld, sub, timerLocal, texture, vec2, vec3, vec4, max, dot, reflect, pow, length, float, uniform, reflector, mul, mix } from 'three/tsl'; +import { Fn, NodeMaterial, add, cameraPosition, div, normalize, positionWorld, sub, time, texture, vec2, vec3, vec4, max, dot, reflect, pow, length, float, uniform, reflector, mul, mix } from 'three/tsl'; /** * Work based on : @@ -36,14 +36,14 @@ class WaterMesh extends Mesh { // TSL - const timeNode = timerLocal(); - const getNoise = Fn( ( [ uv ] ) => { - const uv0 = add( div( uv, 103 ), vec2( div( timeNode, 17 ), div( timeNode, 29 ) ) ).toVar(); - const uv1 = div( uv, 107 ).sub( vec2( div( timeNode, - 19 ), div( timeNode, 31 ) ) ).toVar(); - const uv2 = add( div( uv, vec2( 8907.0, 9803.0 ) ), vec2( div( timeNode, 101 ), div( timeNode, 97 ) ) ).toVar(); - const uv3 = sub( div( uv, vec2( 1091.0, 1027.0 ) ), vec2( div( timeNode, 109 ), div( timeNode, - 113 ) ) ).toVar(); + const offset = time; + + const uv0 = add( div( uv, 103 ), vec2( div( offset, 17 ), div( offset, 29 ) ) ).toVar(); + const uv1 = div( uv, 107 ).sub( vec2( div( offset, - 19 ), div( offset, 31 ) ) ).toVar(); + const uv2 = add( div( uv, vec2( 8907.0, 9803.0 ) ), vec2( div( offset, 101 ), div( offset, 97 ) ) ).toVar(); + const uv3 = sub( div( uv, vec2( 1091.0, 1027.0 ) ), vec2( div( offset, 109 ), div( offset, - 113 ) ) ).toVar(); const sample0 = this.waterNormals.uv( uv0 ); const sample1 = this.waterNormals.uv( uv1 ); diff --git a/examples/jsm/transpiler/ShaderToyDecoder.js b/examples/jsm/transpiler/ShaderToyDecoder.js index c640559a10525a..f4fe871432e18c 100644 --- a/examples/jsm/transpiler/ShaderToyDecoder.js +++ b/examples/jsm/transpiler/ShaderToyDecoder.js @@ -7,7 +7,7 @@ class ShaderToyDecoder extends GLSLDecoder { super(); - this.addPolyfill( 'iTime', 'float iTime = timerGlobal();' ); + this.addPolyfill( 'iTime', 'float iTime = time;' ); this.addPolyfill( 'iResolution', 'vec2 iResolution = screenSize;' ); this.addPolyfill( 'fragCoord', 'vec3 fragCoord = vec3( screenCoordinate.x, screenSize.y - screenCoordinate.y, screenCoordinate.z );' ); diff --git a/examples/screenshots/webgpu_backdrop_water.jpg b/examples/screenshots/webgpu_backdrop_water.jpg index 2bc13bde83027f..d7d0acc9a3741d 100644 Binary files a/examples/screenshots/webgpu_backdrop_water.jpg and b/examples/screenshots/webgpu_backdrop_water.jpg differ diff --git a/examples/webgpu_animation_retargeting.html b/examples/webgpu_animation_retargeting.html index 64ee303c0b0177..6b1ca3f21fd8fe 100644 --- a/examples/webgpu_animation_retargeting.html +++ b/examples/webgpu_animation_retargeting.html @@ -24,7 +24,7 @@