Skip to content

Commit 372a98c

Browse files
committed
feat(postprocessing)!: replace linearToSRGB with linearToneMapping
1 parent 17ece66 commit 372a98c

File tree

7 files changed

+18
-27
lines changed

7 files changed

+18
-27
lines changed

lib/playground/src/pages/post-processing/bloom.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Layout from "../../layouts/Layout.astro";
33
---
44

55
<script>
6-
import { useWebGLCanvas, loadTexture, bloom, linearToSRGB } from "usegl";
6+
import { useWebGLCanvas, loadTexture, bloom, linearToneMapping } from "usegl";
77
import { fragment } from "../../shaders/bloom";
88
import { incrementRenderCount } from "../../components/renderCount";
99

@@ -17,7 +17,7 @@ import Layout from "../../layouts/Layout.astro";
1717
// { colorSpace: "srgb" }
1818
// ),
1919
// },
20-
postEffects: [bloom(), linearToSRGB()],
20+
postEffects: [bloom(), linearToneMapping()],
2121
});
2222

2323
onAfterRender(incrementRenderCount);

lib/playground/src/pages/post-processing/tonemapping.astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import Layout from "../../layouts/Layout.astro";
88
useWebGLCanvas,
99
loadTexture,
1010
acesToneMapping,
11+
reinhardToneMapping,
1112
hableToneMapping,
1213
neutralToneMapping,
1314
agxToneMapping,
1415
cineonToneMapping,
16+
linearToneMapping,
1517
} from "usegl";
1618
import { incrementRenderCount } from "../../components/renderCount";
17-
import { reinhardToneMapping } from "usegl";
18-
import { linearToSRGB } from "usegl";
1919

2020
const testShader = /* glsl */ `
2121
uniform float uExposure;
@@ -68,6 +68,7 @@ void main() {
6868
uExposure: 1.5,
6969
},
7070
postEffects: [
71+
// linearToneMapping(),
7172
// reinhardToneMapping(),
7273
// acesToneMapping(),
7374
// cineonToneMapping(),

lib/src/effects/linearToSRGB/index.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

lib/src/effects/linearToSRGB/linearToSRGB.frag

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "./_common.glsl"
2+
3+
vec3 toneMapping(vec3 color) {
4+
return color;
5+
}
6+
7+
#include "./_main.glsl"

lib/src/effects/toneMapping/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useEffectPass } from "../../hooks/useEffectPass";
22

3+
import linearFragment from "./glsl/linear.frag";
34
import acesFragment from "./glsl/aces.frag";
45
import reinhardFragment from "./glsl/reinhard.frag";
56
import hableFragment from "./glsl/hable.frag";
@@ -53,6 +54,10 @@ export function reinhardToneMapping(params: ReinhardToneMappingParams = {}) {
5354
});
5455
}
5556

57+
export function linearToneMapping(params: ToneMappingParams = {}) {
58+
return createToneMappingPass(linearFragment, params);
59+
}
60+
5661
export function hableToneMapping(params: ToneMappingParams = {}) {
5762
return createToneMappingPass(hableFragment, params);
5863
}

lib/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export { usePingPongFBO } from "./hooks/usePingPongFBO";
2020
export { useTransformFeedback } from "./hooks/useTransformFeedback";
2121

2222
export { bloom } from "./effects/bloom";
23-
export { linearToSRGB } from "./effects/linearToSRGB";
2423
export {
24+
linearToneMapping,
2525
reinhardToneMapping,
2626
hableToneMapping,
2727
acesToneMapping,

0 commit comments

Comments
 (0)