fix water
This commit is contained in:
+12
-12
@@ -18,19 +18,21 @@ camera.position.x = 10;
|
||||
camera.position.y = 4;
|
||||
|
||||
|
||||
const renderer = new THREE.WebGLRenderer();
|
||||
const renderer = new THREE.WebGLRenderer( { antialias: true } );
|
||||
renderer.setPixelRatio( Math.min( window.devicePixelRatio, 2 ) );
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.shadowMap.enabled = true;
|
||||
renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
|
||||
renderer.shadowMap.enabled = true;
|
||||
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
||||
renderer.gammaFactor = 2.2;
|
||||
renderer.outputEncoding = THREE.sRGBEncoding;
|
||||
renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
||||
renderer.toneMappingExposure = 1;
|
||||
renderer.physicallyCorrectLights
|
||||
document.body.appendChild( renderer.domElement );
|
||||
|
||||
window.addEventListener( 'resize', () => {
|
||||
camera.aspect = window.innerWidth / window.innerHeight;
|
||||
camera.updateProjectionMatrix();
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
} );
|
||||
|
||||
const controls = new OrbitControls( camera, renderer.domElement );
|
||||
controls.target.set( -4, 0, 0 );
|
||||
|
||||
@@ -322,14 +324,12 @@ for (let x_angle of Array.from(Array(4), (_, i) => 360 / 4 * i)) {
|
||||
}
|
||||
}
|
||||
|
||||
// const spotLight = new THREE.SpotLight( 0xffffff );
|
||||
const spotLight = new THREE.DirectionalLight( 0xeaa7a7, 1.5);
|
||||
// legacy lighting was removed in three r155: intensities need the old value times pi
|
||||
const spotLight = new THREE.DirectionalLight( 0xeaa7a7, 1.5 * Math.PI );
|
||||
spotLight.position.set( 10, 0, 0 );
|
||||
spotLight.castShadow = true;
|
||||
// spotLight.shadow.mapSize.width = 8182;
|
||||
// spotLight.shadow.mapSize.height = 8182;
|
||||
spotLight.shadow.mapSize.width = 4096;
|
||||
spotLight.shadow.mapSize.height = 4096;
|
||||
spotLight.shadow.mapSize.width = 2048;
|
||||
spotLight.shadow.mapSize.height = 2048;
|
||||
spotLight.shadow.camera.far = 21;
|
||||
spotLight.shadow.camera.left = -10;
|
||||
spotLight.shadow.camera.right = 10;
|
||||
|
||||
Reference in New Issue
Block a user