Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples: Update webgl_morphtargets_*, use physically-based lights #25537

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 );
WestLangley marked this conversation as resolved.
Show resolved Hide resolved
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 );
WestLangley marked this conversation as resolved.
Show resolved Hide resolved
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