Просмотр исходного кода

Add tone mapping to the cubetti

Andrea Franceschini 1 год назад
Родитель
Сommit
21d560a688
1 измененных файлов с 5 добавлено и 2 удалено
  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' })