XNA 中的 Photoshop 混合数学

发布于 2024-10-09 17:01:01 字数 278 浏览 0 评论 0原文

有一个很棒的页面,其中包含一些用于 Photoshop 中混合模式的 C 代码。我想要的是在我的 XNA 应用程序中使用其中一些模式。特别是叠加、色调和饱和度。您认为仅使用 XNA 混合函数和混合枚举就可能吗?或者我需要为这些效果创建一个着色器?

以下是 Photoshop 混合模式数学的链接:http://www.nathanm.com/photoshop-混合数学/

there's a great page with some c code for the blend modes in photoshop. What I want is to use some of these modes in my XNA application. In particular, overlay, hue and saturation. Do you think it is possible with just the XNA blend functions and blend enum or I will need to create a shader for these effects?

Here's the link for the photoshop blend modes math : http://www.nathanm.com/photoshop-blending-math/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你在我安 2024-10-16 17:01:01

首先,这是一个涵盖大部分相同内容的问题领土

问题在于现代 GPU 中的混合阶段仍然非常有限且功能固定。您可以选择以下函数: 添加、减去、最大值、最小值,您将得到 一些乘数

我很确定您想要使用的混合模式无法在该系统中实现。覆盖需要一个可能无法解决的条件,而色相和饱和度需要一个根本无法完成的 HSV 转换。

因此,正如您所说,答案是创建一个着色器,该着色器将两个纹理作为输入并使用自定义混合模式将它们组合起来。如果您想在整个场景之上应用此效果,您将需要使用渲染目标将场景渲染为可用作着色器输入的纹理。

First of all, here is a question that covers much of the same territory.

The problem is that the blend stage in a modern GPU is still very limited and fixed-function. You have these functions to choose from: add, subtract, max, min, and you have a few multipliers.

I'm pretty sure the blend modes you want to use cannot be implemented within this system. Overlay requires a conditional which probably cannot be worked around, and Hue and Saturation require a HSV conversion which cannot be done at all.

So the answer is - as you say - to create a shader that takes two textures as inputs and combines them using your custom blending mode. If you want to apply this effect on top of an entire scene, you will want to use render targets to render your scene to a texture that can be used as input to your shader.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文