Skip to content

Commit

Permalink
Convert to linear colors when parsing LDraw models (#23272)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjohnson authored Jan 20, 2022
1 parent 6289f1c commit 82776b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/jsm/loaders/LDrawLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2329,6 +2329,7 @@ class LDrawLoader extends Loader {
material.premultipliedAlpha = true;
material.opacity = alpha;
material.depthWrite = ! isTransparent;
material.color.convertSRGBToLinear();

material.polygonOffset = true;
material.polygonOffsetFactor = 1;
Expand All @@ -2350,6 +2351,7 @@ class LDrawLoader extends Loader {
} );
edgeMaterial.userData.code = code;
edgeMaterial.name = name + ' - Edge';
edgeMaterial.color.convertSRGBToLinear();

// This is the material used for conditional edges
edgeMaterial.userData.conditionalEdgeMaterial = new LDrawConditionalLineMaterial( {
Expand All @@ -2361,6 +2363,7 @@ class LDrawLoader extends Loader {
opacity: alpha,

} );
edgeMaterial.userData.conditionalEdgeMaterial.color.convertSRGBToLinear();

}

Expand Down
1 change: 1 addition & 0 deletions examples/webgl_loader_ldraw.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
container.appendChild( renderer.domElement );

Expand Down

0 comments on commit 82776b6

Please sign in to comment.