diff --git a/shader/toneshader.cpp b/shader/toneshader.cpp index 2d41223..d616eda 100644 --- a/shader/toneshader.cpp +++ b/shader/toneshader.cpp @@ -121,20 +121,22 @@ Color ToneShader::shade(const Scene &scene, const Ray &ray) const { float transition = (brightness - MIDTONE_HIGHLIGHT_THRESHOLD) / (HIGHLIGHT_THRESHOLD - MIDTONE_HIGHLIGHT_THRESHOLD); - if (randomDistribution(dev) < transition) - tone = highlightColor; - else - tone = midtoneColor; + tone = highlightColor * transition + midtoneColor * (1 - transition); +// if (randomDistribution(dev) < transition) +// tone = highlightColor; +// else +// tone = midtoneColor; } else if (brightness > MIDTONE_THRESHOLD) { tone = midtoneColor; } else if (brightness > SHADOW_MIDTONE_THRESHOLD) { float transition = (brightness - SHADOW_MIDTONE_THRESHOLD) / (MIDTONE_THRESHOLD - SHADOW_MIDTONE_THRESHOLD); - if (randomDistribution(dev) < transition) - tone = midtoneColor; - else - tone = shadowColor; + tone = midtoneColor * transition + shadowColor * (1 - transition); +// if (randomDistribution(dev) < transition) +// tone = midtoneColor; +// else +// tone = shadowColor; } else { tone = shadowColor;