Skip to content

Commit 145f712

Browse files
authored
convert vertex colors to linear in PLYLoader (#23342)
1 parent 98f64b0 commit 145f712

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

examples/jsm/loaders/PLYLoader.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import {
33
FileLoader,
44
Float32BufferAttribute,
55
Loader,
6-
LoaderUtils
6+
LoaderUtils,
7+
Color
78
} from 'three';
89

910
/**
@@ -32,6 +33,7 @@ import {
3233
*
3334
*/
3435

36+
const _color = new Color();
3537

3638
class PLYLoader extends Loader {
3739

@@ -407,7 +409,13 @@ class PLYLoader extends Loader {
407409

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

410-
buffer.colors.push( element[ attrR ] / 255.0, element[ attrG ] / 255.0, element[ attrB ] / 255.0 );
412+
_color.setRGB(
413+
element[ attrR ] / 255.0,
414+
element[ attrG ] / 255.0,
415+
element[ attrB ] / 255.0
416+
).convertSRGBToLinear();
417+
418+
buffer.colors.push( _color.r, _color.g, _color.b );
411419

412420
}
413421

0 commit comments

Comments
 (0)