| 1 |
attribute vec3 attr_Position; |
| 2 |
attribute vec4 attr_TexCoord0; |
| 3 |
|
| 4 |
uniform mat4 u_ModelViewProjectionMatrix; |
| 5 |
uniform vec3 u_ToneMinAvgMaxLinear; |
| 6 |
|
| 7 |
varying vec2 var_TexCoords; |
| 8 |
varying float var_InvWhite; |
| 9 |
|
| 10 |
float FilmicTonemap(float x) |
| 11 |
{ |
| 12 |
const float SS = 0.22; // Shoulder Strength |
| 13 |
const float LS = 0.30; // Linear Strength |
| 14 |
const float LA = 0.10; // Linear Angle |
| 15 |
const float TS = 0.20; // Toe Strength |
| 16 |
const float TAN = 0.01; // Toe Angle Numerator |
| 17 |
const float TAD = 0.30; // Toe Angle Denominator |
| 18 |
|
| 19 |
return ((x*(SS*x+LA*LS)+TS*TAN)/(x*(SS*x+LS)+TS*TAD)) - TAN/TAD; |
| 20 |
} |
| 21 |
|
| 22 |
void main() |
| 23 |
{ |
| 24 |
gl_Position = u_ModelViewProjectionMatrix * vec4(attr_Position, 1.0); |
| 25 |
var_TexCoords = attr_TexCoord0.st; |
| 26 |
var_InvWhite = 1.0 / FilmicTonemap(u_ToneMinAvgMaxLinear.z - u_ToneMinAvgMaxLinear.x); |
| 27 |
} |