fix an issue where the reinhard tonemapper reacted to the rendering progress indicators

metadata
Wenzel Jakob 2013-10-01 12:21:21 +02:00
parent f02f0ac801
commit cd435d8166
2 changed files with 21 additions and 12 deletions

View File

@ -1727,6 +1727,9 @@ void MainWindow::onWorkBegin(const RenderJob *job, const RectangularWorkUnit *wu
void MainWindow::drawVisualWorkUnit(SceneContext *context, const VisualWorkUnit &vwu) {
int ox = vwu.offset.x, oy = vwu.offset.y,
ex = ox + vwu.size.x, ey = oy + vwu.size.y;
if (vwu.size.x < 3 || vwu.size.y < 3)
return;
const float *color = NULL;
/* Use desaturated colors to highlight the host
@ -1754,17 +1757,22 @@ void MainWindow::drawVisualWorkUnit(SceneContext *context, const VisualWorkUnit
break;
}
if (vwu.size.x < 3 || vwu.size.y < 3)
return;
float scale = .7f * (color[0] * 0.212671f + color[1] * 0.715160f + color[2] * 0.072169f);
drawHLine(context, ox, oy, ox + 3, color);
drawHLine(context, ex - 4, oy, ex - 1, color);
drawHLine(context, ox, ey - 1, ox + 3, color);
drawHLine(context, ex - 4, ey - 1, ex - 1, color);
drawVLine(context, ox, oy, oy + 3, color);
drawVLine(context, ex - 1, oy, oy + 3, color);
drawVLine(context, ex - 1, ey - 4, ey - 1, color);
drawVLine(context, ox, ey - 4, ey - 1, color);
float ncol[3] = {
color[0]*scale,
color[1]*scale,
color[2]*scale
};
drawHLine(context, ox, oy, ox + 3, ncol);
drawHLine(context, ex - 4, oy, ex - 1, ncol);
drawHLine(context, ox, ey - 1, ox + 3, ncol);
drawHLine(context, ex - 4, ey - 1, ex - 1, ncol);
drawVLine(context, ox, oy, oy + 3, ncol);
drawVLine(context, ex - 1, oy, oy + 3, ncol);
drawVLine(context, ex - 1, ey - 4, ey - 1, ncol);
drawVLine(context, ox, ey - 4, ey - 1, ncol);
}
void MainWindow::onWorkCanceled(const RenderJob *job, const Point2i &offset, const Vector2i &size) {

View File

@ -3,9 +3,10 @@ uniform float multiplier;
void main() {
vec4 color = texture2D(source, gl_TexCoord[0].xy);
float luminance = multiplier * (color.r * 0.212671 + color.g * 0.715160 + color.b * 0.072169);
if (luminance < 0.0 || luminance != luminance || luminance == 1024.0)
float luminance = color.r * 0.212671 + color.g * 0.715160 + color.b * 0.072169;
if (luminance < 0.0 || luminance != luminance || luminance == 1024.0 || abs(luminance-.7) < 1e-4)
luminance = 0.0; // catch NaNs, negatives, and the Mitsuba banner
luminance = luminance * multiplier;
float logLuminance = log(1e-3 + luminance);
gl_FragColor = vec4(logLuminance, luminance, 0.0, 1.0);
}