@@ -23,68 +23,68 @@ export const ACESFilmicToneMappingShader: IACESFilmicToneMappingShader = {
23
23
} ,
24
24
25
25
vertexShader : /* glsl */ `
26
- varying vec2 vUv;,
26
+ varying vec2 vUv;
27
27
28
- void main() {,
28
+ void main() {
29
29
30
- vUv = uv;,
31
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );,
30
+ vUv = uv;
31
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
32
32
33
- },
33
+ }
34
34
` ,
35
35
fragmentShader : /* glsl */ `
36
- #define saturate(a) clamp( a, 0.0, 1.0 ),
36
+ #define saturate(a) clamp( a, 0.0, 1.0 )
37
37
38
- uniform sampler2D tDiffuse;,
38
+ uniform sampler2D tDiffuse;
39
39
40
- uniform float exposure;,
40
+ uniform float exposure;
41
41
42
- varying vec2 vUv;,
42
+ varying vec2 vUv;
43
43
44
- vec3 RRTAndODTFit( vec3 v ) {,
44
+ vec3 RRTAndODTFit( vec3 v ) {
45
45
46
- vec3 a = v * ( v + 0.0245786 ) - 0.000090537;,
47
- vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;,
48
- return a / b;,
46
+ vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
47
+ vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
48
+ return a / b;
49
49
50
- },
50
+ }
51
51
52
- vec3 ACESFilmicToneMapping( vec3 color ) {,
52
+ vec3 ACESFilmicToneMapping( vec3 color ) {
53
53
54
54
// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
55
- const mat3 ACESInputMat = mat3(,
56
- vec3( 0.59719, 0.07600, 0.02840 ),, // transposed from source
57
- vec3( 0.35458, 0.90834, 0.13383 ),,
58
- vec3( 0.04823, 0.01566, 0.83777 ),
59
- );,
55
+ const mat3 ACESInputMat = mat3(
56
+ vec3( 0.59719, 0.07600, 0.02840 ), // transposed from source
57
+ vec3( 0.35458, 0.90834, 0.13383 ),
58
+ vec3( 0.04823, 0.01566, 0.83777 )
59
+ );
60
60
61
61
// ODT_SAT => XYZ => D60_2_D65 => sRGB
62
- const mat3 ACESOutputMat = mat3(,
63
- vec3( 1.60475, -0.10208, -0.00327 ),, // transposed from source
64
- vec3( -0.53108, 1.10813, -0.07276 ),,
65
- vec3( -0.07367, -0.00605, 1.07602 ),
66
- );,
62
+ const mat3 ACESOutputMat = mat3(
63
+ vec3( 1.60475, -0.10208, -0.00327 ), // transposed from source
64
+ vec3( -0.53108, 1.10813, -0.07276 ),
65
+ vec3( -0.07367, -0.00605, 1.07602 )
66
+ );
67
67
68
- color = ACESInputMat * color;,
68
+ color = ACESInputMat * color;
69
69
70
70
// Apply RRT and ODT
71
- color = RRTAndODTFit( color );,
71
+ color = RRTAndODTFit( color );
72
72
73
- color = ACESOutputMat * color;,
73
+ color = ACESOutputMat * color;
74
74
75
75
// Clamp to [0, 1]
76
- return saturate( color );,
76
+ return saturate( color );
77
77
78
- },
78
+ }
79
79
80
- void main() {,
80
+ void main() {
81
81
82
- vec4 tex = texture2D( tDiffuse, vUv );,
82
+ vec4 tex = texture2D( tDiffuse, vUv );
83
83
84
- tex.rgb *= exposure / 0.6;, // pre-exposed, outside of the tone mapping function
84
+ tex.rgb *= exposure / 0.6; // pre-exposed, outside of the tone mapping function
85
85
86
- gl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );,
86
+ gl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );
87
87
88
- },
88
+ }
89
89
` ,
90
90
}
0 commit comments