实施后处理管理器

发布于 2024-09-13 16:01:49 字数 391 浏览 4 评论 0原文

我一直在考虑如何在我的引擎中实现后处理管理器 (Vanquish)。
< br>

我正在努力了解后处理技术的工作原理。我已经阅读并查看了 creators.xna.com 网站上的后处理示例,但这似乎重新 -应用后处理效果渲染模型。

我可以为静态模型添加此功能,但是当涉及到重新绘制蒙皮模型时,我会感到困惑,因为它们已经拥有自己的效果技术。< br>

有人可以帮助我理清思路,为我指明正确的方向吗?

I have been thinking about how to implement a PostProcessing manager into my engine (Vanquish).

I am struggling to get my head around how a Post Processing technique works. I have read and viewed the Post Processing sample on the creators.xna.com webiste, but this seems to re-render the model applying the Post Processing effect.

I can add this functionality for static models, but when it comes to redrawing the Skinned Models, I then get confused as they already have their own techniques to their effects.

Can someone help me straighten my thoughts by pointing me in the right direction?

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

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

发布评论

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

评论(1

攒一口袋星星 2024-09-20 16:01:49

通常,后处理在整个屏幕上进行。这真的很简单。

您要做的就是在设备上设置渲染目标(我假设您可以弄清楚如何从示例创建渲染目标):

GraphicsDevice.SetRenderTarget(renderTarget);

从此时开始,您渲染的所有内容都将渲染到该渲染目标。完成后,您可以将设备设置回绘制到后台缓冲区:

GraphicsDevice.SetRenderTarget(null);

最后,您可以使用渲染目标进行绘制,就好像它是纹理一样(这是 XNA 4.0 中的新功能,在 XNA 3.1 中您必须调用 GetTexture )。

因此,要制作后处理效果:

  • 将场景渲染到渲染目标
  • 切换回后台缓冲区
  • 使用将应用您的帖子的像素着色器全屏渲染渲染目标(使用 SpriteBatch 即可) - 处理效果。

您听起来像是想为每个模型执行此操作?这看起来有点奇怪,但肯定是可能的。只需确保您的渲染目标首先具有透明的 Alpha 通道,然后使用 Alpha 混合进行绘制即可。

或者你根本不是指后期处理?您是否真的希望更改绘制模型所用的像素着色器,同时保留蒙皮模型顶点着色器?

Generally post-processing works over the entire screen. This is pretty simple, really.

What you do is set a render target on the device (I assume you can figure out how to create a render target from the sample):

GraphicsDevice.SetRenderTarget(renderTarget);

From this point onward everything you render will be rendered to that render target. When you're done you can set the device back to drawing to the back buffer:

GraphicsDevice.SetRenderTarget(null);

And finally you can draw using your render target as if it were a texture (this is new in XNA 4.0, in XNA 3.1 you had to call GetTexture on it).

So to making a post-processing effect:

  • Render your scene to a render target
  • Switch back to the back buffer
  • Render your render target full screen (using SpriteBatch will do) with a pixel shader that will apply your post-processing effect.

You sound like you want to do this per model? Which seems kind of strange but certianly possible. Simply ensure your render target has a transparent alpha channel to begin with, and then draw it with alpha blending.

Or do you not mean post-processing at all? Do you actually wish to change the pixel shader the model is drawn with, while keeping the skinned model vertex shader?

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