| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #START VS
- #version 330 core
- layout (location = 0) in vec2 in_position;
- layout (location = 1) in vec2 in_uv;
- out vec2 uv;
- void main()
- {
- gl_Position = vec4(in_position.x, in_position.y, 0.0f, 1.0f);
- uv = in_uv;
- }
- #END VS
- #START FS
- #version 330 core
- in vec2 uv;
- out vec4 color;
- uniform sampler2D u_texture;
- vec3 aces_tonemap(vec3 x) {
- float a = 2.51;
- float b = 0.03;
- float c = 2.43;
- float d = 0.59;
- float e = 0.14;
- return clamp((x*(a*x+b))/(x*(c*x+d)+e), 0.0, 1.0);
- }
- const vec3 u_white_point = vec3(0.75, 0.75, 0.75);
- void main()
- {
- vec3 tex_color = textureLod(u_texture, uv, 0.0).rgb;
- if (length(tex_color) <= 0)
- discard;
- tex_color = vec3(1.0) - exp(-tex_color / u_white_point);
- color = vec4(aces_tonemap(tex_color), 1.0);
- }
- #END FS
|