|
@@ -36,10 +36,10 @@
|
|
|
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
|
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
|
|
import { RenderPixelatedPass } from 'three/addons/postprocessing/RenderPixelatedPass.js';
|
|
|
+ import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
|
|
|
+ import { GammaCorrectionShader } from 'three/addons/shaders/GammaCorrectionShader.js';
|
|
|
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
|
|
|
|
|
|
- THREE.ColorManagement.enabled = false; // TODO: Consider enabling color management.
|
|
|
-
|
|
|
let camera, scene, renderer, composer, crystalMesh, clock;
|
|
|
let gui, params;
|
|
|
|
|
@@ -69,6 +69,9 @@
|
|
|
const renderPixelatedPass = new RenderPixelatedPass( 6, scene, camera );
|
|
|
composer.addPass( renderPixelatedPass );
|
|
|
|
|
|
+ const outputPass = new ShaderPass( GammaCorrectionShader );
|
|
|
+ composer.addPass( outputPass );
|
|
|
+
|
|
|
window.addEventListener( 'resize', onWindowResize );
|
|
|
|
|
|
const controls = new OrbitControls( camera, renderer.domElement );
|
|
@@ -130,8 +133,8 @@
|
|
|
crystalMesh = new THREE.Mesh(
|
|
|
geometry,
|
|
|
new THREE.MeshPhongMaterial( {
|
|
|
- color: 0x2379cf,
|
|
|
- emissive: 0x143542,
|
|
|
+ color: 0x68b7e9,
|
|
|
+ emissive: 0x4f7e8b,
|
|
|
shininess: 10,
|
|
|
specular: 0xffffff
|
|
|
} )
|
|
@@ -142,15 +145,15 @@
|
|
|
|
|
|
// lights
|
|
|
|
|
|
- scene.add( new THREE.AmbientLight( 0x2d3645, 1.5 ) );
|
|
|
+ scene.add( new THREE.AmbientLight( 0x757f8e ) );
|
|
|
|
|
|
- const directionalLight = new THREE.DirectionalLight( 0xfffc9c, .5 );
|
|
|
+ const directionalLight = new THREE.DirectionalLight( 0xfffecd, .5 );
|
|
|
directionalLight.position.set( 100, 100, 100 );
|
|
|
directionalLight.castShadow = true;
|
|
|
directionalLight.shadow.mapSize.set( 2048, 2048 );
|
|
|
scene.add( directionalLight );
|
|
|
|
|
|
- const spotLight = new THREE.SpotLight( 0xff8800, 1, 10, Math.PI / 16, .02, 2 );
|
|
|
+ const spotLight = new THREE.SpotLight( 0xffc100, 1, 10, Math.PI / 16, .02, 2 );
|
|
|
spotLight.position.set( 2, 2, 0 );
|
|
|
const target = spotLight.target;
|
|
|
scene.add( target );
|
|
@@ -213,6 +216,7 @@
|
|
|
texture.generateMipmaps = false;
|
|
|
texture.wrapS = THREE.RepeatWrapping;
|
|
|
texture.wrapT = THREE.RepeatWrapping;
|
|
|
+ texture.colorSpace = THREE.SRGBColorSpace;
|
|
|
return texture;
|
|
|
|
|
|
}
|