Add proper tonemap, although disabled.
It currently generates way too much HDR.
This commit is contained in:
parent
1d40851600
commit
8947242de4
@ -205,43 +205,18 @@ void main()
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
||||||
//#define AUTO_EXPOSURE
|
|
||||||
|
|
||||||
uniform sampler2D tex;
|
uniform sampler2D tex;
|
||||||
uniform sampler2D dtex;
|
uniform sampler2D dtex;
|
||||||
uniform vec3 inlevel;
|
uniform vec3 inlevel;
|
||||||
uniform vec2 outlevel;
|
uniform vec2 outlevel;
|
||||||
uniform mat4 invprojm;
|
uniform mat4 invprojm;
|
||||||
uniform sampler2D logluminancetex;
|
|
||||||
|
|
||||||
#if __VERSION__ >= 130
|
|
||||||
in vec2 uv;
|
in vec2 uv;
|
||||||
out vec4 FragColor;
|
out vec4 FragColor;
|
||||||
#else
|
|
||||||
varying vec2 uv;
|
|
||||||
#define FragColor gl_FragColor
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vec3 getCIEYxy(vec3 rgbColor);
|
|
||||||
vec3 getRGBFromCIEXxy(vec3 YxyColor);
|
|
||||||
|
|
||||||
float exposure = .1;
|
|
||||||
float whitePoint = 2.5;
|
|
||||||
float delta = 0.0001;
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 col = texture(tex, uv);
|
vec4 col = texture(tex, uv);
|
||||||
#ifdef AUTO_EXPOSURE
|
|
||||||
float avgLuminance = textureLod(logluminancetex, uv, 10.).x;
|
|
||||||
avgLuminance = exp(avgLuminance) - delta;
|
|
||||||
|
|
||||||
vec3 Yxy = getCIEYxy(col.xyz);
|
|
||||||
float a = max(0, 1.5 - 1.5 / (avgLuminance * .1 + 1)) + .1;
|
|
||||||
float Lp = Yxy.r * a / avgLuminance;
|
|
||||||
Yxy.r = (Lp * (1. * Lp / (whitePoint * whitePoint))) / (1. + Lp);
|
|
||||||
col.xyz = getRGBFromCIEXxy(Yxy);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float curdepth = texture(dtex, uv).x;
|
float curdepth = texture(dtex, uv).x;
|
||||||
vec4 FragPos = invprojm * (2.0 * vec4(uv, curdepth, 1.0f) - 1.0f);
|
vec4 FragPos = invprojm * (2.0 * vec4(uv, curdepth, 1.0f) - 1.0f);
|
||||||
|
@ -3,7 +3,7 @@ uniform sampler2D tex;
|
|||||||
in vec2 uv;
|
in vec2 uv;
|
||||||
out vec4 FragColor;
|
out vec4 FragColor;
|
||||||
|
|
||||||
float delta = 0.0001;
|
float delta = .1;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
26
data/shaders/tonemap.frag
Normal file
26
data/shaders/tonemap.frag
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#define AUTO_EXPOSURE
|
||||||
|
|
||||||
|
uniform sampler2D tex;
|
||||||
|
uniform sampler2D logluminancetex;
|
||||||
|
|
||||||
|
in vec2 uv;
|
||||||
|
out vec4 FragColor;
|
||||||
|
|
||||||
|
vec3 getCIEYxy(vec3 rgbColor);
|
||||||
|
vec3 getRGBFromCIEXxy(vec3 YxyColor);
|
||||||
|
|
||||||
|
float exposure = .4;
|
||||||
|
float whitePoint = 1.5;
|
||||||
|
float delta = .1;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 col = texture(tex, uv);
|
||||||
|
float avgLuminance = textureLod(logluminancetex, uv, 10.).x;
|
||||||
|
avgLuminance = exp(avgLuminance) - delta;
|
||||||
|
|
||||||
|
vec3 Yxy = getCIEYxy(col.xyz);
|
||||||
|
float Lp = Yxy.r * exposure / avgLuminance;
|
||||||
|
Yxy.r = (Lp * (1. * Lp / (whitePoint * whitePoint))) / (1. + Lp);
|
||||||
|
FragColor.xyz = getRGBFromCIEXxy(Yxy);
|
||||||
|
}
|
@ -234,7 +234,6 @@ void renderColorLevel(GLuint in)
|
|||||||
glUniform1i(FullScreenShader::ColorLevelShader::uniform_tex, 0);
|
glUniform1i(FullScreenShader::ColorLevelShader::uniform_tex, 0);
|
||||||
glUniform1i(FullScreenShader::ColorLevelShader::uniform_dtex, 1);
|
glUniform1i(FullScreenShader::ColorLevelShader::uniform_dtex, 1);
|
||||||
setTexture(2, irr_driver->getRenderTargetTexture(RTT_LOG_LUMINANCE), GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST);
|
setTexture(2, irr_driver->getRenderTargetTexture(RTT_LOG_LUMINANCE), GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST);
|
||||||
glUniform1i(FullScreenShader::ColorLevelShader::uniform_logluminancetex, 2);
|
|
||||||
glUniformMatrix4fv(FullScreenShader::ColorLevelShader::uniform_invprojm, 1, GL_FALSE, irr_driver->getInvProjMatrix().pointer());
|
glUniformMatrix4fv(FullScreenShader::ColorLevelShader::uniform_invprojm, 1, GL_FALSE, irr_driver->getInvProjMatrix().pointer());
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
@ -524,6 +523,18 @@ static void renderGodRay(GLuint tex, const core::vector2df &sunpos)
|
|||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void toneMap(GLuint fbo, GLuint rtt)
|
||||||
|
{
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||||
|
glUseProgram(FullScreenShader::ToneMapShader::Program);
|
||||||
|
glBindVertexArray(FullScreenShader::ToneMapShader::vao);
|
||||||
|
setTexture(0, rtt, GL_NEAREST, GL_NEAREST);
|
||||||
|
setTexture(1, irr_driver->getRenderTargetTexture(RTT_LOG_LUMINANCE), GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST);
|
||||||
|
FullScreenShader::ToneMapShader::setUniforms(0, 1);
|
||||||
|
|
||||||
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
}
|
||||||
|
|
||||||
static void averageTexture(GLuint tex)
|
static void averageTexture(GLuint tex)
|
||||||
{
|
{
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
@ -533,6 +544,7 @@ static void averageTexture(GLuint tex)
|
|||||||
|
|
||||||
static void computeLogLuminance(GLuint tex)
|
static void computeLogLuminance(GLuint tex)
|
||||||
{
|
{
|
||||||
|
glViewport(0, 0, 1024, 1024);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, irr_driver->getFBO(FBO_LOG_LUMINANCE));
|
glBindFramebuffer(GL_FRAMEBUFFER, irr_driver->getFBO(FBO_LOG_LUMINANCE));
|
||||||
glUseProgram(FullScreenShader::LogLuminanceShader::Program);
|
glUseProgram(FullScreenShader::LogLuminanceShader::Program);
|
||||||
glBindVertexArray(FullScreenShader::LogLuminanceShader::vao);
|
glBindVertexArray(FullScreenShader::LogLuminanceShader::vao);
|
||||||
@ -541,6 +553,7 @@ static void computeLogLuminance(GLuint tex)
|
|||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
averageTexture(irr_driver->getRenderTargetTexture(RTT_LOG_LUMINANCE));
|
averageTexture(irr_driver->getRenderTargetTexture(RTT_LOG_LUMINANCE));
|
||||||
|
glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessing::applyMLAA()
|
void PostProcessing::applyMLAA()
|
||||||
@ -624,60 +637,65 @@ void PostProcessing::render()
|
|||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
|
/* computeLogLuminance(in_rtt);
|
||||||
|
toneMap(out_fbo, in_rtt);
|
||||||
|
std::swap(in_rtt, out_rtt);
|
||||||
|
std::swap(in_fbo, out_fbo);*/
|
||||||
|
|
||||||
PROFILER_PUSH_CPU_MARKER("- Bloom", 0xFF, 0x00, 0x00);
|
PROFILER_PUSH_CPU_MARKER("- Bloom", 0xFF, 0x00, 0x00);
|
||||||
if (UserConfigParams::m_bloom)
|
if (UserConfigParams::m_bloom)
|
||||||
{
|
{
|
||||||
glClear(GL_STENCIL_BUFFER_BIT);
|
glClear(GL_STENCIL_BUFFER_BIT);
|
||||||
|
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, irr_driver->getFBO(FBO_COLORS));
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, in_fbo);
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, irr_driver->getFBO(FBO_BLOOM_1024));
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, irr_driver->getFBO(FBO_BLOOM_1024));
|
||||||
glBlitFramebuffer(0, 0, UserConfigParams::m_width, UserConfigParams::m_height, 0, 0, 1024, 1024, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
glBlitFramebuffer(0, 0, UserConfigParams::m_width, UserConfigParams::m_height, 0, 0, 1024, 1024, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, irr_driver->getFBO(FBO_BLOOM_512));
|
glBindFramebuffer(GL_FRAMEBUFFER, irr_driver->getFBO(FBO_BLOOM_512));
|
||||||
glViewport(0, 0, 512, 512);
|
glViewport(0, 0, 512, 512);
|
||||||
renderBloom(irr_driver->getRenderTargetTexture(RTT_BLOOM_1024));
|
renderBloom(irr_driver->getRenderTargetTexture(RTT_BLOOM_1024));
|
||||||
|
|
||||||
// Downsample
|
// Downsample
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, irr_driver->getFBO(FBO_BLOOM_512));
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, irr_driver->getFBO(FBO_BLOOM_512));
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, irr_driver->getFBO(FBO_BLOOM_256));
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, irr_driver->getFBO(FBO_BLOOM_256));
|
||||||
glBlitFramebuffer(0, 0, 512, 512, 0, 0, 256, 256, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
glBlitFramebuffer(0, 0, 512, 512, 0, 0, 256, 256, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||||
|
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, irr_driver->getFBO(FBO_BLOOM_256));
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, irr_driver->getFBO(FBO_BLOOM_256));
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, irr_driver->getFBO(FBO_BLOOM_128));
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, irr_driver->getFBO(FBO_BLOOM_128));
|
||||||
glBlitFramebuffer(0, 0, 256, 256, 0, 0, 128, 128, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
glBlitFramebuffer(0, 0, 256, 256, 0, 0, 128, 128, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
// Blur
|
// Blur
|
||||||
glViewport(0, 0, 512, 512);
|
glViewport(0, 0, 512, 512);
|
||||||
renderGaussian6Blur(irr_driver->getFBO(FBO_BLOOM_512), irr_driver->getRenderTargetTexture(RTT_BLOOM_512),
|
renderGaussian6Blur(irr_driver->getFBO(FBO_BLOOM_512), irr_driver->getRenderTargetTexture(RTT_BLOOM_512),
|
||||||
irr_driver->getFBO(FBO_TMP_512), irr_driver->getRenderTargetTexture(RTT_TMP_512), 512, 512);
|
irr_driver->getFBO(FBO_TMP_512), irr_driver->getRenderTargetTexture(RTT_TMP_512), 512, 512);
|
||||||
|
|
||||||
glViewport(0, 0, 256, 256);
|
glViewport(0, 0, 256, 256);
|
||||||
renderGaussian6Blur(irr_driver->getFBO(FBO_BLOOM_256), irr_driver->getRenderTargetTexture(RTT_BLOOM_256),
|
renderGaussian6Blur(irr_driver->getFBO(FBO_BLOOM_256), irr_driver->getRenderTargetTexture(RTT_BLOOM_256),
|
||||||
irr_driver->getFBO(FBO_TMP_256), irr_driver->getRenderTargetTexture(RTT_TMP_256), 256, 256);
|
irr_driver->getFBO(FBO_TMP_256), irr_driver->getRenderTargetTexture(RTT_TMP_256), 256, 256);
|
||||||
|
|
||||||
glViewport(0, 0, 128, 128);
|
glViewport(0, 0, 128, 128);
|
||||||
renderGaussian6Blur(irr_driver->getFBO(FBO_BLOOM_128), irr_driver->getRenderTargetTexture(RTT_BLOOM_128),
|
renderGaussian6Blur(irr_driver->getFBO(FBO_BLOOM_128), irr_driver->getRenderTargetTexture(RTT_BLOOM_128),
|
||||||
irr_driver->getFBO(FBO_TMP_128), irr_driver->getRenderTargetTexture(RTT_TMP_128), 128, 128);
|
irr_driver->getFBO(FBO_TMP_128), irr_driver->getRenderTargetTexture(RTT_TMP_128), 128, 128);
|
||||||
|
|
||||||
glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height);
|
glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||||
|
|
||||||
// Additively blend on top of tmp1
|
// Additively blend on top of tmp1
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, irr_driver->getFBO(FBO_COLORS));
|
glBindFramebuffer(GL_FRAMEBUFFER, in_fbo);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE);
|
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE);
|
||||||
glBlendEquation(GL_FUNC_ADD);
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
glBlendColor(.125, .125, .125, .125);
|
glBlendColor(.125, .125, .125, .125);
|
||||||
renderPassThrough(irr_driver->getRenderTargetTexture(RTT_BLOOM_128));
|
renderPassThrough(irr_driver->getRenderTargetTexture(RTT_BLOOM_128));
|
||||||
glBlendColor(.25, .25, .25, .25);
|
glBlendColor(.25, .25, .25, .25);
|
||||||
renderPassThrough(irr_driver->getRenderTargetTexture(RTT_BLOOM_256));
|
renderPassThrough(irr_driver->getRenderTargetTexture(RTT_BLOOM_256));
|
||||||
glBlendColor(.5, .5, .5, .5);
|
glBlendColor(.5, .5, .5, .5);
|
||||||
renderPassThrough(irr_driver->getRenderTargetTexture(RTT_BLOOM_512));
|
renderPassThrough(irr_driver->getRenderTargetTexture(RTT_BLOOM_512));
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
} // end if bloom
|
} // end if bloom
|
||||||
|
|
||||||
PROFILER_POP_CPU_MARKER();
|
PROFILER_POP_CPU_MARKER();
|
||||||
|
|
||||||
@ -760,8 +778,6 @@ void PostProcessing::render()
|
|||||||
PROFILER_POP_CPU_MARKER();
|
PROFILER_POP_CPU_MARKER();
|
||||||
}
|
}
|
||||||
|
|
||||||
computeLogLuminance(in_rtt);
|
|
||||||
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, out_fbo);
|
glBindFramebuffer(GL_FRAMEBUFFER, out_fbo);
|
||||||
renderColorLevel(in_rtt);
|
renderColorLevel(in_rtt);
|
||||||
std::swap(in_fbo, out_fbo);
|
std::swap(in_fbo, out_fbo);
|
||||||
|
@ -86,7 +86,6 @@ RTT::RTT()
|
|||||||
RenderTargetTextures[RTT_NORMAL_AND_DEPTH] = generateRTT(res, GL_RGBA16F, GL_RGBA, GL_FLOAT);
|
RenderTargetTextures[RTT_NORMAL_AND_DEPTH] = generateRTT(res, GL_RGBA16F, GL_RGBA, GL_FLOAT);
|
||||||
RenderTargetTextures[RTT_COLOR] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
|
RenderTargetTextures[RTT_COLOR] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
|
||||||
RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, GL_SRGB, GL_BGR, GL_UNSIGNED_BYTE);
|
RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, GL_SRGB, GL_BGR, GL_UNSIGNED_BYTE);
|
||||||
RenderTargetTextures[RTT_LOG_LUMINANCE] = generateRTT(res, GL_R16F, GL_RED, GL_FLOAT);
|
|
||||||
RenderTargetTextures[RTT_SSAO] = generateRTT(half, GL_R16F, GL_RED, GL_FLOAT);
|
RenderTargetTextures[RTT_SSAO] = generateRTT(half, GL_R16F, GL_RED, GL_FLOAT);
|
||||||
RenderTargetTextures[RTT_DISPLACE] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
|
RenderTargetTextures[RTT_DISPLACE] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
|
||||||
|
|
||||||
@ -105,6 +104,7 @@ RTT::RTT()
|
|||||||
RenderTargetTextures[RTT_TMP_256] = generateRTT(shadowsize2, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
RenderTargetTextures[RTT_TMP_256] = generateRTT(shadowsize2, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
||||||
RenderTargetTextures[RTT_BLOOM_128] = generateRTT(shadowsize3, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
RenderTargetTextures[RTT_BLOOM_128] = generateRTT(shadowsize3, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
||||||
RenderTargetTextures[RTT_TMP_128] = generateRTT(shadowsize3, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
RenderTargetTextures[RTT_TMP_128] = generateRTT(shadowsize3, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
||||||
|
RenderTargetTextures[RTT_LOG_LUMINANCE] = generateRTT(shadowsize0, GL_R16F, GL_RED, GL_FLOAT);
|
||||||
|
|
||||||
FrameBuffers[FBO_SSAO] = generateFBO(RenderTargetTextures[RTT_SSAO]);
|
FrameBuffers[FBO_SSAO] = generateFBO(RenderTargetTextures[RTT_SSAO]);
|
||||||
// Clear this FBO to 1s so that if no SSAO is computed we can still use it.
|
// Clear this FBO to 1s so that if no SSAO is computed we can still use it.
|
||||||
|
@ -317,6 +317,7 @@ void Shaders::loadShaders()
|
|||||||
FullScreenShader::GodFadeShader::init();
|
FullScreenShader::GodFadeShader::init();
|
||||||
FullScreenShader::GodRayShader::init();
|
FullScreenShader::GodRayShader::init();
|
||||||
FullScreenShader::LogLuminanceShader::init();
|
FullScreenShader::LogLuminanceShader::init();
|
||||||
|
FullScreenShader::ToneMapShader::init();
|
||||||
FullScreenShader::MLAAColorEdgeDetectionSHader::init();
|
FullScreenShader::MLAAColorEdgeDetectionSHader::init();
|
||||||
FullScreenShader::MLAABlendWeightSHader::init();
|
FullScreenShader::MLAABlendWeightSHader::init();
|
||||||
FullScreenShader::MLAAGatherSHader::init();
|
FullScreenShader::MLAAGatherSHader::init();
|
||||||
@ -2061,9 +2062,31 @@ namespace FullScreenShader
|
|||||||
glUniform1i(FullScreenShader::BloomShader::uniform_texture, TU_tex);
|
glUniform1i(FullScreenShader::BloomShader::uniform_texture, TU_tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLuint ToneMapShader::Program;
|
||||||
|
GLuint ToneMapShader::uniform_tex;
|
||||||
|
GLuint ToneMapShader::uniform_logluminancetex;
|
||||||
|
GLuint ToneMapShader::vao;
|
||||||
|
|
||||||
|
void ToneMapShader::init()
|
||||||
|
{
|
||||||
|
Program = LoadProgram(
|
||||||
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||||
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getRGBfromCIEXxy.frag").c_str(),
|
||||||
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getCIEXYZ.frag").c_str(),
|
||||||
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/tonemap.frag").c_str());
|
||||||
|
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||||
|
uniform_logluminancetex = glGetUniformLocation(Program, "logluminancetex");
|
||||||
|
vao = createVAO(Program);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ToneMapShader::setUniforms(unsigned TU_tex, unsigned TU_loglum)
|
||||||
|
{
|
||||||
|
glUniform1i(uniform_tex, TU_tex);
|
||||||
|
glUniform1i(uniform_logluminancetex, TU_loglum);
|
||||||
|
}
|
||||||
|
|
||||||
GLuint ColorLevelShader::Program;
|
GLuint ColorLevelShader::Program;
|
||||||
GLuint ColorLevelShader::uniform_tex;
|
GLuint ColorLevelShader::uniform_tex;
|
||||||
GLuint ColorLevelShader::uniform_logluminancetex;
|
|
||||||
GLuint ColorLevelShader::uniform_inlevel;
|
GLuint ColorLevelShader::uniform_inlevel;
|
||||||
GLuint ColorLevelShader::uniform_outlevel;
|
GLuint ColorLevelShader::uniform_outlevel;
|
||||||
GLuint ColorLevelShader::vao;
|
GLuint ColorLevelShader::vao;
|
||||||
@ -2077,7 +2100,6 @@ namespace FullScreenShader
|
|||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getCIEXYZ.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getCIEXYZ.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/color_levels.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/color_levels.frag").c_str());
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||||
uniform_logluminancetex = glGetUniformLocation(Program, "logluminancetex");
|
|
||||||
uniform_dtex = glGetUniformLocation(Program, "dtex");
|
uniform_dtex = glGetUniformLocation(Program, "dtex");
|
||||||
uniform_inlevel = glGetUniformLocation(Program, "inlevel");
|
uniform_inlevel = glGetUniformLocation(Program, "inlevel");
|
||||||
uniform_outlevel = glGetUniformLocation(Program, "outlevel");
|
uniform_outlevel = glGetUniformLocation(Program, "outlevel");
|
||||||
|
@ -520,11 +520,22 @@ public:
|
|||||||
static void setUniforms(unsigned TU_tex);
|
static void setUniforms(unsigned TU_tex);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ToneMapShader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static GLuint Program;
|
||||||
|
static GLuint uniform_tex, uniform_logluminancetex;
|
||||||
|
static GLuint vao;
|
||||||
|
|
||||||
|
static void init();
|
||||||
|
static void setUniforms(unsigned TU_tex, unsigned TU_logluminance);
|
||||||
|
};
|
||||||
|
|
||||||
class ColorLevelShader
|
class ColorLevelShader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLuint Program;
|
static GLuint Program;
|
||||||
static GLuint uniform_tex, uniform_invprojm, uniform_dtex, uniform_inlevel, uniform_outlevel, uniform_logluminancetex;
|
static GLuint uniform_tex, uniform_invprojm, uniform_dtex, uniform_inlevel, uniform_outlevel;
|
||||||
static GLuint vao;
|
static GLuint vao;
|
||||||
|
|
||||||
static void init();
|
static void init();
|
||||||
|
Loading…
Reference in New Issue
Block a user