Browse Source

Examples: Improved webgpu_backdrop_water.

Mr.doob 1 year ago
parent
commit
caf8c1f401

BIN
examples/screenshots/webgpu_backdrop_water.jpg


+ 9 - 10
examples/webgpu_backdrop_water.html

@@ -107,16 +107,15 @@
 				// objects
 				// objects
 
 
 				const textureLoader = new THREE.TextureLoader();
 				const textureLoader = new THREE.TextureLoader();
-				const brick_diffuse = textureLoader.load( './textures/brick_diffuse.jpg' );
-				brick_diffuse.wrapS = THREE.RepeatWrapping;
-				brick_diffuse.wrapT = THREE.RepeatWrapping;
-				brick_diffuse.colorSpace = THREE.NoColorSpace;
+				const iceDiffuse = textureLoader.load( './textures/water.jpg' );
+				iceDiffuse.wrapS = THREE.RepeatWrapping;
+				iceDiffuse.wrapT = THREE.RepeatWrapping;
+				iceDiffuse.colorSpace = THREE.NoColorSpace;
 
 
-				const brick = triplanarTexture( texture( brick_diffuse ) );
+				const iceColorNode = triplanarTexture( texture( iceDiffuse ) );
 
 
-				const geometry = new THREE.TorusKnotGeometry( .6, 0.3, 128, 64 );
-				const material = new MeshStandardNodeMaterial();
-				material.colorNode = brick;
+				const geometry = new THREE.IcosahedronGeometry( 1, 3 );
+				const material = new MeshStandardNodeMaterial( { colorNode: iceColorNode } );
 
 
 				const count = 100;
 				const count = 100;
 				const scale = 3.5;
 				const scale = 3.5;
@@ -164,13 +163,13 @@
 				waterMaterial.backdropAlphaNode = depthEffect.oneMinus();
 				waterMaterial.backdropAlphaNode = depthEffect.oneMinus();
 				waterMaterial.transparent = true;
 				waterMaterial.transparent = true;
 
 
-				const water = new THREE.Mesh( new THREE.BoxGeometry( 100, .001, 100 ), waterMaterial );
+				const water = new THREE.Mesh( new THREE.BoxGeometry( 50, .001, 50 ), waterMaterial );
 				water.position.set( 0, .8, 0 );
 				water.position.set( 0, .8, 0 );
 				scene.add( water );
 				scene.add( water );
 
 
 				// floor
 				// floor
 
 
-				floor = new THREE.Mesh( new THREE.BoxGeometry( 1.7, 10, 1.7 ), new MeshStandardNodeMaterial( { colorNode: brick } ) );
+				floor = new THREE.Mesh( new THREE.CylinderGeometry( 1.1, 1.1, 10 ), new MeshStandardNodeMaterial( { colorNode: iceColorNode } ) );
 				floor.position.set( 0, - 5, 0 );
 				floor.position.set( 0, - 5, 0 );
 				scene.add( floor );
 				scene.add( floor );