Skip to content
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
22 changes: 14 additions & 8 deletions examples/jsm/loaders/FBXLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,12 +542,12 @@ class FBXTreeParser {

if ( materialNode.Diffuse ) {

parameters.color = new Color().fromArray( materialNode.Diffuse.value );
parameters.color = new Color().fromArray( materialNode.Diffuse.value ).convertSRGBToLinear();

} else if ( materialNode.DiffuseColor && ( materialNode.DiffuseColor.type === 'Color' || materialNode.DiffuseColor.type === 'ColorRGB' ) ) {

// The blender exporter exports diffuse here instead of in materialNode.Diffuse
parameters.color = new Color().fromArray( materialNode.DiffuseColor.value );
parameters.color = new Color().fromArray( materialNode.DiffuseColor.value ).convertSRGBToLinear();

}

Expand All @@ -559,12 +559,12 @@ class FBXTreeParser {

if ( materialNode.Emissive ) {

parameters.emissive = new Color().fromArray( materialNode.Emissive.value );
parameters.emissive = new Color().fromArray( materialNode.Emissive.value ).convertSRGBToLinear();

} else if ( materialNode.EmissiveColor && ( materialNode.EmissiveColor.type === 'Color' || materialNode.EmissiveColor.type === 'ColorRGB' ) ) {

// The blender exporter exports emissive color here instead of in materialNode.Emissive
parameters.emissive = new Color().fromArray( materialNode.EmissiveColor.value );
parameters.emissive = new Color().fromArray( materialNode.EmissiveColor.value ).convertSRGBToLinear();

}

Expand Down Expand Up @@ -600,12 +600,12 @@ class FBXTreeParser {

if ( materialNode.Specular ) {

parameters.specular = new Color().fromArray( materialNode.Specular.value );
parameters.specular = new Color().fromArray( materialNode.Specular.value ).convertSRGBToLinear();

} else if ( materialNode.SpecularColor && materialNode.SpecularColor.type === 'Color' ) {

// The blender exporter exports specular color here instead of in materialNode.Specular
parameters.specular = new Color().fromArray( materialNode.SpecularColor.value );
parameters.specular = new Color().fromArray( materialNode.SpecularColor.value ).convertSRGBToLinear();

}

Expand Down Expand Up @@ -1153,7 +1153,7 @@ class FBXTreeParser {

if ( lightAttribute.Color !== undefined ) {

color = new Color().fromArray( lightAttribute.Color.value );
color = new Color().fromArray( lightAttribute.Color.value ).convertSRGBToLinear();

}

Expand Down Expand Up @@ -1469,7 +1469,7 @@ class FBXTreeParser {

if ( r !== 0 || g !== 0 || b !== 0 ) {

const color = new Color( r, g, b );
const color = new Color( r, g, b ).convertSRGBToLinear();
sceneGraph.add( new AmbientLight( color, 1 ) );

}
Expand Down Expand Up @@ -2217,6 +2217,12 @@ class GeometryParser {

}

for ( let i = 0, c = new Color(); i < buffer.length; i += 4 ) {

c.fromArray( buffer, i ).convertSRGBToLinear().toArray( buffer, i );

}

return {
dataSize: 4,
buffer: buffer,
Expand Down
Binary file modified examples/screenshots/webgl_loader_fbx.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/screenshots/webgl_loader_fbx_nurbs.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/screenshots/webgl_raycaster_bvh.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions examples/webgl_loader_fbx.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { FBXLoader } from 'three/addons/loaders/FBXLoader.js';

THREE.ColorManagement.enabled = true;

let camera, scene, renderer, stats;

const clock = new THREE.Clock();
Expand All @@ -56,11 +58,11 @@
scene.background = new THREE.Color( 0xa0a0a0 );
scene.fog = new THREE.Fog( 0xa0a0a0, 200, 1000 );

const hemiLight = new THREE.HemisphereLight( 0xffffff, 0x444444 );
const hemiLight = new THREE.HemisphereLight( 0xffffff, 0x444444, 1.5 );
hemiLight.position.set( 0, 200, 0 );
scene.add( hemiLight );

const dirLight = new THREE.DirectionalLight( 0xffffff );
const dirLight = new THREE.DirectionalLight( 0xffffff, 1.5 );
dirLight.position.set( 0, 200, 100 );
dirLight.castShadow = true;
dirLight.shadow.camera.top = 180;
Expand Down Expand Up @@ -109,6 +111,7 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.shadowMap.enabled = true;
container.appendChild( renderer.domElement );

Expand Down
3 changes: 3 additions & 0 deletions examples/webgl_loader_fbx_nurbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { FBXLoader } from 'three/addons/loaders/FBXLoader.js';

THREE.ColorManagement.legacyMode = false;

let camera, scene, renderer, stats;

init();
Expand Down Expand Up @@ -76,6 +78,7 @@
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
container.appendChild( renderer.domElement );

const controls = new OrbitControls( camera, renderer.domElement );
Expand Down
3 changes: 3 additions & 0 deletions examples/webgl_raycaster_bvh.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';

THREE.ColorManagement.legacyMode = false;

// Add the extension functions
THREE.BufferGeometry.prototype.computeBoundsTree = computeBoundsTree;
THREE.BufferGeometry.prototype.disposeBoundsTree = disposeBoundsTree;
Expand Down Expand Up @@ -97,6 +99,7 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
document.body.appendChild( renderer.domElement );

stats = new Stats();
Expand Down
1 change: 1 addition & 0 deletions examples/webgpu_skinning_points.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setAnimationLoop( animate );
renderer.outputEncoding = THREE.sRGBEncoding;
document.body.appendChild( renderer.domElement );

window.addEventListener( 'resize', onWindowResize );
Expand Down