在XNA中将Post Render效果应用于SpriteBatch [英] Apply Post Render Effect to SpriteBatch in XNA

查看:151
本文介绍了在XNA中将Post Render效果应用于SpriteBatch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在XNA框架中,有没有一种方法可以使用典型的SpriteBatch方法渲染2D场景,然后在渲染帧之后将效果应用于整个图像?



例如,模糊,棕褐色或者甚至让整个事物看起来像一个旧时间的电影胶片,有颗粒,灰尘,线条等等?

解决方案

是的 - 您要做的就是将渲染目标设置为渲染到纹理,而不是将图形硬件移出。然后,一旦你的输出在纹理中,你就会应用你的像素着色器效果,并将其发送出去。

一些很棒的基本示例效果可以在这里找到(我衷心推荐订阅这个博客)
http://blogs.msdn.com/b/shawnhar/archive/2007/ 05/23 / transitions-part-four-rendertargets.aspx

Is there a way, in the XNA framework, to render your 2D scene using the typical SpriteBatch method and then, after that frame is rendered, apply effect to the whole image?

For example, blurring, sepia or even making the whole thing look like an old time movie film, with grain, dust, lines, etc?

解决方案

Yes - what you'll do is set the render target to render to a texture instead of out your graphics hardware. Then, once your output is in a texture you'll apply your pixel shader effects, and send it off.

Some great basic sample effects are available here (I heartily recommend subscribing to this blog as well) http://blogs.msdn.com/b/shawnhar/archive/2007/05/23/transitions-part-four-rendertargets.aspx

这篇关于在XNA中将Post Render效果应用于SpriteBatch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆