Skip to content

Commit

Permalink
Examples: Update webgl_morphtargets_*, use physically-based lights (#…
Browse files Browse the repository at this point in the history
…25537)

* Examples: Update webgl_morphtargets_*, use physically-based lights.

* Update screenshot for webgl_morphtargets_sphere

* Bump sphere lighting
  • Loading branch information
donmccurdy authored Mar 9, 2023
1 parent 79e3cfe commit 3b5cbe0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
Binary file modified examples/screenshots/webgl_morphtargets_sphere.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions examples/webgl_morphtargets.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';

THREE.ColorManagement.enabled = true;

let container, camera, scene, renderer, mesh;

init();
Expand All @@ -49,9 +51,9 @@
camera.position.z = 10;
scene.add( camera );

scene.add( new THREE.AmbientLight( 0x8FBCD4, 0.4 ) );
scene.add( new THREE.AmbientLight( 0x8FBCD4, 1.5 ) );

const pointLight = new THREE.PointLight( 0xffffff, 1 );
const pointLight = new THREE.PointLight( 0xffffff, 200 );
camera.add( pointLight );

const geometry = createGeometry();
Expand All @@ -69,6 +71,8 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.useLegacyLights = false;
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.setAnimationLoop( function () {

renderer.render( scene, camera );
Expand Down
7 changes: 5 additions & 2 deletions examples/webgl_morphtargets_horse.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';

THREE.ColorManagement.enabled = true;

let container, stats;
let camera, scene, renderer;
let mesh, mixer;
Expand All @@ -69,11 +71,11 @@

//

const light1 = new THREE.DirectionalLight( 0xefefff, 1.5 );
const light1 = new THREE.DirectionalLight( 0xefefff, 5 );
light1.position.set( 1, 1, 1 ).normalize();
scene.add( light1 );

const light2 = new THREE.DirectionalLight( 0xffefef, 1.5 );
const light2 = new THREE.DirectionalLight( 0xffefef, 5 );
light2.position.set( - 1, - 1, - 1 ).normalize();
scene.add( light2 );

Expand All @@ -97,6 +99,7 @@
renderer.setSize( window.innerWidth, window.innerHeight );

renderer.outputEncoding = THREE.sRGBEncoding;
renderer.useLegacyLights = false;

container.appendChild( renderer.domElement );

Expand Down
10 changes: 8 additions & 2 deletions examples/webgl_morphtargets_sphere.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';

THREE.ColorManagement.enabled = true;

let camera, scene, renderer, clock;

let mesh;
Expand All @@ -54,11 +56,11 @@

clock = new THREE.Clock();

const light1 = new THREE.PointLight( 0xff2200, 0.7 );
const light1 = new THREE.PointLight( 0xff2200, 50000 );
light1.position.set( 100, 100, 100 );
scene.add( light1 );

const light2 = new THREE.PointLight( 0x22ff00, 0.7 );
const light2 = new THREE.PointLight( 0x22ff00, 10000 );
light2.position.set( - 100, - 100, - 100 );
scene.add( light2 );

Expand Down Expand Up @@ -92,6 +94,10 @@
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );

renderer.outputEncoding = THREE.sRGBEncoding;
renderer.useLegacyLights = false;

container.appendChild( renderer.domElement );

//
Expand Down

0 comments on commit 3b5cbe0

Please sign in to comment.