Przeglądaj źródła

Add tone mapping to the cubetti

Andrea Franceschini 1 rok temu
rodzic
commit
21d560a688
1 zmienionych plików z 5 dodań i 2 usunięć
  1. 5 2
      components/Cubetti.vue

+ 5 - 2
components/Cubetti.vue

@@ -35,13 +35,16 @@
     import { WebGLRenderer } from 'three/src/renderers/WebGLRenderer';
     import anime from 'animejs';
     import { randInt } from 'three/src/math/MathUtils';
+    import { LinearToneMapping } from 'three/src/constants';
 
     const scene = new Scene()
     const camera = new PerspectiveCamera(80, 1, 0.1, 1000)
     const renderer = new WebGLRenderer({ antialias: true, alpha: true })
     renderer.setPixelRatio(window.devicePixelRatio);
-    const directionalLight = new DirectionalLight(0x808080)
-    const ambientLight = new AmbientLight(0x808080*1.75)
+    renderer.toneMapping = LinearToneMapping
+    renderer.toneMappingExposure = 2.5
+    const directionalLight = new DirectionalLight(0xffffff)
+    const ambientLight = new AmbientLight(0xffffff)
     const geometry = new BoxGeometry(1, 1, 1)
     const blueMaterial = new MeshStandardMaterial({ color: 'dodgerblue' })
     const greenMaterial = new MeshStandardMaterial({ color: 'greenyellow' })