Skip to content

Commit

Permalink
Examples: Improved webgpu_backdrop_water.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Dec 22, 2023
1 parent b7ebd00 commit caf8c1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Binary file modified examples/screenshots/webgpu_backdrop_water.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 9 additions & 10 deletions examples/webgpu_backdrop_water.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,15 @@
// objects

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 scale = 3.5;
Expand Down Expand Up @@ -164,13 +163,13 @@
waterMaterial.backdropAlphaNode = depthEffect.oneMinus();
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 );
scene.add( water );

// 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 );
scene.add( floor );

Expand Down

0 comments on commit caf8c1f

Please sign in to comment.