diff --git a/app/assets/textures/clouds-dithered.png b/app/assets/textures/clouds-dithered.png new file mode 100644 index 0000000..7baaf25 Binary files /dev/null and b/app/assets/textures/clouds-dithered.png differ diff --git a/app/assets/textures/clouds.jpg b/app/assets/textures/clouds.jpg deleted file mode 100644 index f3698e8..0000000 Binary files a/app/assets/textures/clouds.jpg and /dev/null differ diff --git a/app/js/components/Clouds.js b/app/js/components/Clouds.js index c7eda7a..4b1b664 100644 --- a/app/js/components/Clouds.js +++ b/app/js/components/Clouds.js @@ -11,6 +11,11 @@ class Clouds extends THREE.Object3D { this.cloudTexture.wrapS = this.cloudTexture.wrapT = THREE.RepeatWrapping; this.cloudTexture.repeat.set(3, 3); + this.cloudShadow = loader.load('textures/clouds-dithered.png'); + this.cloudShadow.wrapS = this.cloudShadow.wrapT = THREE.RepeatWrapping; + this.cloudShadow.magFilter = THREE.NearestFilter; + this.cloudShadow.repeat.set(3, 3); + this.material = new THREE.MeshBasicMaterial({ map: this.cloudTexture, transparent: true, @@ -21,12 +26,12 @@ class Clouds extends THREE.Object3D { mesh.customDepthMaterial = new THREE.MeshDepthMaterial({ depthPacking: THREE.RGBADepthPacking, - map: this.cloudTexture, - alphaTest: 0.3 + map: this.cloudShadow, + alphaTest: 0.25 }); mesh.rotation.x = -Math.PI/2; - mesh.position.y = 10; + mesh.position.y = 15; mesh.castShadow = true; this.add(mesh); @@ -35,8 +40,10 @@ class Clouds extends THREE.Object3D { } onUpdate(time) { - this.cloudTexture.offset.x = (time / 1000) % 200; - this.cloudTexture.offset.y = (time / 5000) % 400; + this.cloudTexture.offset.x = (props.cloudSpeed / 1000 * time) % 200; + this.cloudTexture.offset.y = (props.cloudSpeed / 5000 * time) % 400; + this.cloudShadow.offset.x = (props.cloudSpeed / 1000 * time) % 200; + this.cloudShadow.offset.y = (props.cloudSpeed / 5000 * time) % 400; } } diff --git a/app/js/components/Light.js b/app/js/components/Light.js index 791592d..be72129 100644 --- a/app/js/components/Light.js +++ b/app/js/components/Light.js @@ -10,8 +10,8 @@ class Lighting extends THREE.Object3D { dirLight.position.multiplyScalar( 20 ); dirLight.castShadow = true; - dirLight.shadow.mapSize.width = 1024; - dirLight.shadow.mapSize.height = 1024; + dirLight.shadow.mapSize.width = 2048; + dirLight.shadow.mapSize.height = 2048; dirLight.shadow.radius = 2; let d = 100; diff --git a/app/js/core/Webgl.js b/app/js/core/Webgl.js index 4ddc4ac..571b142 100644 --- a/app/js/core/Webgl.js +++ b/app/js/core/Webgl.js @@ -46,8 +46,6 @@ export default class Webgl { initPostprocessing() { if (!this.usePostprocessing) return; this._composer = new THREE.EffectComposer(this._renderer); - let ssaoShader = THREE.SSAOShader; - ssaoShader.uniforms.onlyAO = true; this._passes.forEach((effect, i) => { if (i == this._passes.length - 1) { effect.renderToScreen = true; diff --git a/app/js/core/props.js b/app/js/core/props.js index d750f2b..ad0235a 100644 --- a/app/js/core/props.js +++ b/app/js/core/props.js @@ -1,5 +1,5 @@ const props = { - rotation: 0.01, + cloudSpeed: 0.5, }; module.exports = props; diff --git a/app/main.js b/app/main.js index eed92c3..2dded4d 100644 --- a/app/main.js +++ b/app/main.js @@ -16,7 +16,7 @@ loop.add(webgl.onUpdate); // ## // GUI const gui = new dat.GUI(); -gui.add(props, 'rotation', 0.01, 1); +gui.add(props, 'cloudSpeed', -1, 1); gui.close(); webgl.add(new Ground());