@@ -31,14 +31,16 @@ import {
3131 DepthTexture ,
3232 Clock ,
3333 Object3D ,
34- ColorManagement ,
34+
35+ SRGBColorSpace ,
3536} from "three" ;
3637import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js" ;
3738import { EffectComposer } from "three/examples/jsm/postprocessing/EffectComposer.js" ;
3839import { FullScreenQuad } from "three/examples/jsm/postprocessing/Pass.js" ;
3940import { RenderPass } from "three/examples/jsm/postprocessing/RenderPass.js" ;
4041import { ShaderPass } from "three/examples/jsm/postprocessing/ShaderPass.js" ;
4142import { FXAAShader } from "three/examples/jsm/shaders/FXAAShader.js" ;
43+ import { OutputPass } from "three/examples/jsm/postprocessing/OutputPass.js" ;
4244import { PlayerAnimation } from "./animation.js" ;
4345import { type BackEquipment , PlayerObject } from "./model.js" ;
4446import { NameTagObject } from "./nametag.js" ;
@@ -343,13 +345,14 @@ export class SkinViewer {
343345 this . camera . add ( this . cameraLight ) ;
344346 this . scene . add ( this . camera ) ;
345347 this . scene . add ( this . globalLight ) ;
346- ColorManagement . enabled = false ;
347348
348349 this . renderer = new WebGLRenderer ( {
349350 canvas : this . canvas ,
350351 preserveDrawingBuffer : options . preserveDrawingBuffer === true , // default: false
351352 } ) ;
352353
354+ this . renderer . outputColorSpace = SRGBColorSpace ;
355+
353356 this . onDevicePixelRatioChange = ( ) => {
354357 this . renderer . setPixelRatio ( window . devicePixelRatio ) ;
355358 this . updateComposerSize ( ) ;
@@ -385,6 +388,7 @@ export class SkinViewer {
385388 this . fxaaPass = new ShaderPass ( FXAAShader ) ;
386389 this . composer . addPass ( this . renderPass ) ;
387390 this . composer . addPass ( this . fxaaPass ) ;
391+ this . composer . addPass ( new OutputPass ( ) ) ;
388392
389393 this . playerObject = new PlayerObject ( ) ;
390394 this . playerObject . name = "player" ;
@@ -510,6 +514,7 @@ export class SkinViewer {
510514 this . skinTexture . dispose ( ) ;
511515 }
512516 this . skinTexture = new CanvasTexture ( this . skinCanvas ) ;
517+ this . skinTexture . colorSpace = SRGBColorSpace ;
513518 this . skinTexture . magFilter = NearestFilter ;
514519 this . skinTexture . minFilter = NearestFilter ;
515520 this . playerObject . skin . map = this . skinTexture ;
@@ -520,6 +525,7 @@ export class SkinViewer {
520525 this . capeTexture . dispose ( ) ;
521526 }
522527 this . capeTexture = new CanvasTexture ( this . capeCanvas ) ;
528+ this . capeTexture . colorSpace = SRGBColorSpace ;
523529 this . capeTexture . magFilter = NearestFilter ;
524530 this . capeTexture . minFilter = NearestFilter ;
525531 this . playerObject . cape . map = this . capeTexture ;
@@ -531,6 +537,7 @@ export class SkinViewer {
531537 this . earsTexture . dispose ( ) ;
532538 }
533539 this . earsTexture = new CanvasTexture ( this . earsCanvas ) ;
540+ this . earsTexture . colorSpace = SRGBColorSpace ;
534541 this . earsTexture . magFilter = NearestFilter ;
535542 this . earsTexture . minFilter = NearestFilter ;
536543 this . playerObject . ears . map = this . earsTexture ;
@@ -676,6 +683,7 @@ export class SkinViewer {
676683 if ( mapping !== undefined ) {
677684 this . backgroundTexture . mapping = mapping ;
678685 }
686+ this . backgroundTexture . colorSpace = SRGBColorSpace ;
679687 this . backgroundTexture . needsUpdate = true ;
680688 this . scene . background = this . backgroundTexture ;
681689 } else {
0 commit comments