使用固定管道的人均对比度控制
我正在使用固定的Pipeline渲染,并希望以每个像素方式控制图像的对比度(即与背景的差异)。换句话说,如果C为r/g/b,我想获得
c = a*cs +(1 -a)*c0,
其中c0是背景颜色,而a可以从像素到像素。如果背景为黑色(C0 = 0),我知道该怎么做:首先将flamebuffer中的alpha设置为我想要的每个像素,然后
glblendfunc(gl_dst_alpha,gl_zero,gl_zero)
>
如果背景不是黑色,则可以设置alpha,将颜色清除为背景,然后执行
glblendfunc(gl_dst_alpha,gl_one_one_minus_dst_alpha)
此操作仅在您绘制重叠的一个对象时才可行。在重叠的情况下,帧缓冲器值不再是背景颜色,因此您不再获得C = A*CS +(1-A)*C0。
我是否缺少一些明显的方法?也许我不应该使用alpha混合,而是其他东西?
I'm using fixed-pipeline rendering, and would like to control the contrast of my images (i.e., difference from background) in a per-pixel manner. In other words, if C is R/G/B, I'd like to get
C = A*Cs + (1 - A)*C0
where C0 is the background color, and A can vary from pixel to pixel. If the background is black (C0 = 0), I know how to do this: first set the alpha in the framebuffer to what I want on a per-pixel basis, then
glBlendFunc(GL_DST_ALPHA, GL_ZERO)
If the background isn't black, then you can set the alpha, clear the color to background, and do
glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA)
This works only if none of the objects you draw overlap; in case of overlap, the framebuffer value is no longer the background color, and therefore you no longer get C = A*Cs + (1 - A)*C0.
Is there some obvious way to do this that I'm missing? Maybe I shouldn't use alpha blending but something else?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论