XNA 与 SlimDX 的离屏渲染器
我意识到这里有很多关于在 XNA 和 SlimDX 之间进行选择的问题,但这些都与游戏编程有关。
一点背景知识:我有一个从 XML 描述渲染场景的应用程序。目前我正在使用 WPF 3D,这大部分都有效,除了 WPF 无法在屏幕外渲染场景(即在服务器上,而不在窗口中显示它们),并且渲染到位图会导致 WPF 回退到软件渲染。
所以我面临着必须编写自己的渲染器。以下是要求:
- 3D 和 2D 元素的混合。
- 每个场景的元素相对较少(数十个网格,数十个 2D 元素)。
- 大场景(打印最大 3000 像素平方)。
- 仅渲染单个帧(即 FPS 不是问题)。
- 不透明蒙版。
- 像素着色器。
- 软件后备(服务器可能有也可能没有像样的 gfx 卡)。
- 被渲染到屏幕外的可能性。
正如您所看到的,这是非常简单的事情,WPF 可以很好地管理它,除了无法导出场景的问题。
特别是我不需要游戏开发中通常需要的很多东西。考虑到这一点,您会选择 XNA 还是 SlimDX?代码的非渲染部分已经用 C# 编写,因此要坚持使用。
I realise there are numerous questions on here asking about choosing between XNA and SlimDX, but these all relate to game programming.
A little background: I have an application that renders scenes from XML descriptions. Currently I am using WPF 3D and this mostly works, except that WPF has no way to render scenes offscreen (i.e. on a server, without displaying them in a window), and also rendering to a bitmap causes WPF to fallback to software rendering.
So I'm faced with having to write my own renderer. Here are the requirements:
- Mix of 3D and 2D elements.
- Relatively few elements per scene (tens of meshes, tens of 2D elements).
- Large scenes (up to 3000px square for print).
- Only a single frame will be rendered (i.e. FPS is not an issue).
- Opacity masks.
- Pixel shaders.
- Software fallback (servers may or may not have a decent gfx card).
- Possibility of being rendered offscreen.
As you can see it's pretty simple stuff and WPF can manage it quite nicely except for the not-being-able-to-export-the-scene problem.
In particular I don't need many of the things usually needed in game development. So bearing that in mind, would you choose XNA or SlimDX? The non-rendering portion of the code is already written in C#, so want to stick with that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我没有使用过 SlimDX,但根据我使用 XNA 的经验以及阅读有关 SlimDX 目标的信息。我建议使用 SlimDX。 XNA 虽然可以用于其他用途,但它主要是一个游戏引擎,而不是渲染引擎。它有很多具体的优化和功能。面向游戏的方法论。
另外,如果您正在处理动态文件,XNA 喜欢将其资源预先构建到 DirectX 文件 (.x) 中,我认为 SlimDX 是您的最佳选择。
I haven't used SlimDX, but based on my experience with XNA and reading about SlimDX's objective. I'd suggest SlimDX. XNA while it can be used for other things is primarily a Game Engine, not a Rendering Engine. It's got lots of specific optimizations & methodology geared towards Games.
Also, XNA likes to pre-build it's resources into DirectX Files (.x) if you're working with dynamic files, I think SlimDX is the best choice for you.
XNA 和 SlimDX 本质上非常接近,但也存在一些差异:
XNA 需要具有最少像素/顶点着色器 1.1 的 GPU,而我认为 SlimDX 不需要。
SlimDX 支持 DirectX10 和 11,而 XNA 仅支持 DirectX 9。
XNA 是 Windows、Xbox 360、Zune 和 Windows 之间的跨平台Phone 7,而 SlimDX 不是。
XNA 拥有强大的社区 (creators.xna.com),提供大量教程和帮助材料。
我会选择 XNA。
XNA and SlimDX are very close in nature, but there are some differences:
XNA requires a GPU with a least pixel/vertex shaders 1.1 while I think SlimDX does not.
SlimDX supports DirectX10 and 11, while XNA only supports DirectX 9.
XNA is a cross platform between Windows, Xbox 360, Zune and Windows Phone 7, while SlimDX is not.
XNA has a strong community (creators.xna.com) with tons of tutorials and help materials.
I would go with XNA.