- To achieve the effect of water ripples:
- By adding geometric shapes, the geometry of the platform can be
const waterGeometry = new THREE.PlaneGeometry( 10000, 10000 );
- Introduce the water plug-in and modify the water material.
import { Water } from 'three/addons/objects/Water.js'; const water = new Water( waterGeometry, { textureWidth: 512, textureHeight: 512, waterNormals: new THREE.TextureLoader().load( 'textures/waternormals.jpg', function ( texture ) { texture.wrapS = texture.wrapT = THREE.RepeatWrapping; } ), sunDirection: new THREE.Vector3(), sunColor: 0xffffff, waterColor: 0x001e0f, distortionScale: 3.7, fog: scene.fog !== undefined } ); // 加入场景中 scene.add( water );
- Texture map used on water surface
Threejs realizes the effect of water surface
Guess you like
Origin blog.csdn.net/weixin_38441229/article/details/132304561
Recommended
Ranking