我在做一个项目。所有的2D都使用spriteBatch。
我让像爆炸这样的东西使用自定义效果,而这些效果不适用于图像的其余部分。到目前为止,我的流程如下:
1)清除背景
2)绘制所有爆炸精灵
3)捕获该图像并将我的效果实现到一个单独的RenderTarget2D中
4)画我的背景
5)绘制步骤3中创建的RenderTarget2D
6)画出其他所有东西
我遇到的问题是创建的RenderTarget2D在没有绘制的区域中是不透明的。因此,不会显示在步骤4中绘制的背景。
我在任何对SetRenderTarget(空)的调用之后尝试过GraphicsDevice.Clear(Color.Transparent)。然而,我仍然得到了紫色的背景。
有什么想法吗?
我想写代码,但是有太多的东西需要你们去解析。
发布于 2013-05-05 02:38:08
如果你遵循这个流程,它应该是有效的;
GraphicsDevice.SetRenderTarget(renderTarget);
GraphicsDevice.Clear(Color.Transparent);
// Draw stuff to texture
GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(BackgroundColor); // Important to clear here
// Draw background
// Draw texture
// Draw stuffhttps://stackoverflow.com/questions/16350500
复制相似问题