Skip to content

Commit aa26635

Browse files
committed
Temporarily added linearToRelativeLuminance.
Fixes #63.
1 parent 3751aa3 commit aa26635

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

src/materials/glsl/bokeh2/shader.frag

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
#include <common>
22

3+
// https://en.wikipedia.org/wiki/Relative_luminance
4+
float linearToRelativeLuminance(const in vec3 color) {
5+
6+
vec3 weights = vec3(0.2126, 0.7152, 0.0722);
7+
8+
return dot(weights, color.rgb);
9+
10+
}
11+
312
uniform sampler2D tDiffuse;
413
uniform sampler2D tDepth;
514

src/materials/glsl/film/shader.frag

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ varying vec2 vUv;
2020

2121
#include <common>
2222

23+
// https://en.wikipedia.org/wiki/Relative_luminance
24+
float linearToRelativeLuminance(const in vec3 color) {
25+
26+
vec3 weights = vec3(0.2126, 0.7152, 0.0722);
27+
28+
return dot(weights, color.rgb);
29+
30+
}
31+
2332
uniform float greyscaleIntensity;
2433

2534
#elif defined(SEPIA)

src/materials/glsl/luminosity/shader.frag

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
#include <common>
22

3+
// https://en.wikipedia.org/wiki/Relative_luminance
4+
float linearToRelativeLuminance(const in vec3 color) {
5+
6+
vec3 weights = vec3(0.2126, 0.7152, 0.0722);
7+
8+
return dot(weights, color.rgb);
9+
10+
}
11+
312
uniform sampler2D tDiffuse;
413
uniform float distinction;
514
uniform vec2 range;

src/materials/glsl/tone-mapping/shader.frag

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
#include <common>
22

3+
// https://en.wikipedia.org/wiki/Relative_luminance
4+
float linearToRelativeLuminance(const in vec3 color) {
5+
6+
vec3 weights = vec3(0.2126, 0.7152, 0.0722);
7+
8+
return dot(weights, color.rgb);
9+
10+
}
11+
312
uniform sampler2D tDiffuse;
413
uniform float middleGrey;
514
uniform float maxLuminance;

0 commit comments

Comments
 (0)