implemented requested changes, fixed math error in filmic curve

This commit is contained in:
Anna 2019-07-01 17:05:13 -07:00
parent 95f2dfa551
commit f44bc52d58
3 changed files with 7 additions and 13 deletions

View file

@ -588,10 +588,9 @@ std::function<void(gpu::Batch&, const gpu::TexturePointer&)> OpenGLDisplayPlugin
hudEyeViewports[eye] = eyeViewport(eye);
});
return [=](gpu::Batch& batch, const gpu::TexturePointer& hudTexture) {
auto pipeline = hudPipeline;
if (pipeline && hudTexture) {
if (hudPipeline && hudTexture) {
batch.enableStereo(false);
batch.setPipeline(pipeline);
batch.setPipeline(hudPipeline);
batch.setResourceTexture(0, hudTexture);
if (hudStereo) {
for_each_eye([&](Eye eye) {

View file

@ -51,19 +51,16 @@ void main(void) {
int toneCurve = getToneCurve();
vec3 tonedColor = srcColor;
if (toneCurve == ToneCurveFilmic) {
vec3 rgbColor = pow(srcColor, vec3(GAMMA_22));
vec3 x = max(vec3(0.0), rgbColor-0.004);
tonedColor = (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06);
vec3 x = max(vec3(0.0), srcColor-0.004);
tonedColor = pow((x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06), vec3(GAMMA_22));
} else if (toneCurve == ToneCurveReinhard) {
tonedColor = srcColor/(1.0 + srcColor);
}
else if (toneCurve == ToneCurveGamma22) {
} else if (toneCurve == ToneCurveGamma22) {
// We use glEnable(GL_FRAMEBUFFER_SRGB), which automatically converts textures from RGB to SRGB
// when writing from an RGB framebuffer to an SRGB framebuffer (note that it doesn't do anything
// when writing from an SRGB framebuffer to an RGB framebuffer).
// Since the conversion happens automatically, we don't need to do anything in this shader
}
else {
} else {
// toneCurve == ToneCurveNone
// For debugging purposes, we may want to see what the colors look like before the automatic OpenGL
// conversion mentioned above, so we undo it here

View file

@ -159,8 +159,6 @@ void UpsampleToBlitFramebuffer::run(const RenderContextPointer& renderContext, c
const auto bufferSize = resampledFrameBuffer->getSize();
glm::ivec4 viewport{ 0, 0, bufferSize.x, bufferSize.y };
gpu::PipelinePointer pipeline = args->_renderMode == RenderArgs::MIRROR_RENDER_MODE ? _mirrorPipeline : _pipeline;
gpu::doInBatch("Upsample::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
@ -169,7 +167,7 @@ void UpsampleToBlitFramebuffer::run(const RenderContextPointer& renderContext, c
batch.setViewportTransform(viewport);
batch.setProjectionTransform(glm::mat4());
batch.resetViewTransform();
batch.setPipeline(pipeline);
batch.setPipeline(args->_renderMode == RenderArgs::MIRROR_RENDER_MODE ? _mirrorPipeline : _pipeline);
batch.setModelTransform(gpu::Framebuffer::evalSubregionTexcoordTransform(bufferSize, viewport));
batch.setResourceTexture(0, sourceFramebuffer->getRenderBuffer(0));