Lightroom白色滑块算法解析及GLSL复现技术问询
复现Lightroom白色滑块调增效果的GLSL实现问题
我正在GLSL着色器里复现Lightroom白色滑块调增时的效果,目前已经做出接近的结果,但总觉得缺了色相或饱和度的调整(只关注滑块调增的情况)。试过很多变体都没成功,对比编辑前后的阶梯梯度图得到了几个“魔法数字”,还发现差异图呈现源图像的部分反转效果,推测反转源图可能是实现里的关键——不用的话就会出现色偏。
以下是我当前的实现代码:
// color is rgb input // whites is 0 - 1 amount of effect. vec3 adjustWhites(vec3 color, float whites) { // Create inverted version vec3 inverted = 1.0 - color; // Get luminance of original color float luminance = dot(color, vec3(0.2126, 0.7152, 0.0722)); // Create gradient - using some magic numbers here float grad = smoothstep(0.6, 0.0, abs(luminance - 0.62)); grad = pow(grad, 1.8); // Blend bright colors back in return color * vec3(1.0 + grad * inverted * whites); }
我猜测他们可能在计算中用到了动态白点或黑点,但没找到相关文献。希望有人能解释这个滑块的数学原理,或者给出相关的博客、白皮书参考。
内容的提问来源于stack exchange,提问作者aferriss
相关产品推荐
相关产品推荐

