Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以(在着色器中)更改与背景颜色相同的像素的颜色?
谢谢
编辑:背景颜色为白色。那么在像素着色器中将每个像素颜色与白色进行比较是不可能的,如果相等,那么只需将其替换为所需的颜色?
是的,但只是间接的方式。您必须将场景渲染到渲染目标上。然后,您在 backbuffer 上渲染一个 fullscreenquad,并将 rendertarget 作为输入纹理,从而运行像素着色器,它将通过着色器常量指定的颜色替换为另一种颜色。请记住,任何类型的多重采样都会导致边界出现光晕,因为那里的背景颜色不再是原始颜色。