Skip to content

Commit

Permalink
convert vertex colors to linear in PLYLoader (#23342)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjohnson authored Jan 26, 2022
1 parent 98f64b0 commit 145f712
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions examples/jsm/loaders/PLYLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
FileLoader,
Float32BufferAttribute,
Loader,
LoaderUtils
LoaderUtils,
Color
} from 'three';

/**
Expand Down Expand Up @@ -32,6 +33,7 @@ import {
*
*/

const _color = new Color();

class PLYLoader extends Loader {

Expand Down Expand Up @@ -407,7 +409,13 @@ class PLYLoader extends Loader {

if ( attrR !== null && attrG !== null && attrB !== null ) {

buffer.colors.push( element[ attrR ] / 255.0, element[ attrG ] / 255.0, element[ attrB ] / 255.0 );
_color.setRGB(
element[ attrR ] / 255.0,
element[ attrG ] / 255.0,
element[ attrB ] / 255.0
).convertSRGBToLinear();

buffer.colors.push( _color.r, _color.g, _color.b );

}

Expand Down

0 comments on commit 145f712

Please sign in to comment.