Skip to content

Commit 0d8676b

Browse files
authored
Examples: More sRGB and color management fixes. (#26090)
* Examples: More sRGB and color correction fixes. * Examples: Update screenshots. * Examples: Update screenshots.
1 parent eb4eca3 commit 0d8676b

15 files changed

+28
-23
lines changed

examples/jsm/cameras/CinematicCamera.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import {
99
WebGLRenderTarget
1010
} from 'three';
1111

12-
import { BokehShader } from '../shaders/BokehShader2.js';
13-
import { BokehDepthShader } from '../shaders/BokehShader2.js';
12+
import { BokehShader, BokehDepthShader } from '../shaders/BokehShader2.js';
1413

1514
class CinematicCamera extends PerspectiveCamera {
1615

examples/jsm/loaders/PDBLoader.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import {
22
BufferGeometry,
33
FileLoader,
44
Float32BufferAttribute,
5-
Loader
5+
Loader,
6+
Color
67
} from 'three';
78

89
class PDBLoader extends Loader {
@@ -114,6 +115,8 @@ class PDBLoader extends Loader {
114115

115116
// atoms
116117

118+
const c = new Color();
119+
117120
for ( let i = 0, l = atoms.length; i < l; i ++ ) {
118121

119122
const atom = atoms[ i ];
@@ -128,7 +131,9 @@ class PDBLoader extends Loader {
128131
const g = atom[ 3 ][ 1 ] / 255;
129132
const b = atom[ 3 ][ 2 ] / 255;
130133

131-
colorsAtoms.push( r, g, b );
134+
c.set( r, g, b ).convertSRGBToLinear();
135+
136+
colorsAtoms.push( c.r, c.g, c.b );
132137

133138
}
134139

examples/jsm/misc/VolumeSlice.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
Mesh,
66
MeshBasicMaterial,
77
PlaneGeometry,
8-
Texture
8+
Texture,
9+
SRGBColorSpace
910
} from 'three';
1011

1112
/**
@@ -68,6 +69,7 @@ class VolumeSlice {
6869
const canvasMap = new Texture( this.canvas );
6970
canvasMap.minFilter = LinearFilter;
7071
canvasMap.wrapS = canvasMap.wrapT = ClampToEdgeWrapping;
72+
canvasMap.colorSpace = SRGBColorSpace;
7173
const material = new MeshBasicMaterial( { map: canvasMap, side: DoubleSide, transparent: true } );
7274
/**
7375
* @member {Mesh} mesh The mesh ready to get used in the scene

examples/jsm/shaders/BokehShader2.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ const BokehShader = {
345345
346346
gl_FragColor.rgb = col;
347347
gl_FragColor.a = 1.0;
348+
349+
#include <tonemapping_fragment>
350+
#include <encodings_fragment>
348351
}`
349352

350353
};
-130 Bytes
Loading
-503 Bytes
Loading
-654 Bytes
Loading
-581 Bytes
Loading
-1.86 KB
Loading
-911 Bytes
Loading

0 commit comments

Comments
 (0)