HDR Renderer: gamma correction
This commit is contained in:
parent
1ca429ffba
commit
9d603fe5d9
@ -23,10 +23,12 @@ uniform sampler2D texture;
|
||||
|
||||
varying vec2 texCoord;
|
||||
|
||||
uniform float gamma;
|
||||
|
||||
void main() {
|
||||
vec3 color;
|
||||
color = texture2D(texture, texCoord).xyz;
|
||||
color = sqrt(color);
|
||||
color = pow(color, vec3(gamma));
|
||||
gl_FragColor = vec4(color, 1.);
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "../Core/Debug.h"
|
||||
#include <Core/Settings.h>
|
||||
|
||||
SPADES_SETTING(r_hdrGamma, "2.2");
|
||||
|
||||
namespace spades {
|
||||
namespace draw {
|
||||
GLNonlinearlizeFilter::GLNonlinearlizeFilter(GLRenderer *renderer):
|
||||
@ -45,15 +47,18 @@ namespace spades {
|
||||
|
||||
static GLProgramAttribute lensPosition("positionAttribute");
|
||||
static GLProgramUniform lensTexture("texture");
|
||||
static GLProgramUniform lensGamma("gamma");
|
||||
|
||||
dev->Enable(IGLDevice::Blend, false);
|
||||
|
||||
lensPosition(lens);
|
||||
lensTexture(lens);
|
||||
lensGamma(lens);
|
||||
|
||||
lens->Use();
|
||||
|
||||
lensTexture.SetValue(0);
|
||||
lensGamma.SetValue(1.f / (float)r_hdrGamma);
|
||||
|
||||
// composite to the final image
|
||||
GLColorBuffer output = input.GetManager()->CreateBufferHandle();
|
||||
|
Loading…
x
Reference in New Issue
Block a user