C# XNA - 在关闭/半关闭屏幕时渲染(?)3D 对象。 (剔除?)
非常大的对象,比如游戏地图,如果它们的原点不在屏幕上,那么它们将完全不会显示在 XNA 中。
我在这方面找不到任何该死的东西。我研究了剔除,并尝试以几种形式将其添加到项目中以抵消此问题,但无济于事。
我想绘制起源于屏幕之外的对象,这样,如果它们部分位于屏幕上,它们仍然会显示。我将如何实现这一目标?
从我读到的文档中 cull 应该这样做,不是吗?我可怜的大脑(._.)
顺便说一句,如果有人有在 XNA 的 Ox 引擎中创建原语的经验,我会很高兴收到您的来信。
编辑:地狱火...我很确定这个问题只是 Ox 造成的。 该死的牛。 我所有的仇恨。
Objects that are really large like, lets say a game map will outright not show up in XNA if their origin point is not on the screen.
I can't find a bloody thing on this. I have looked into culling and attempted to add it in a few forms to the project to counteract this but to no avail.
I want to draw objects who have origins off screen so that if they are partially on the screen they are still displayed. How would I achieve this?
From the documentation I read cull should do this, shouldn't it? My poor brain matter (._. )
On a side note if anyone has any experience creating primitives within the Ox Engine for XNA, I'd be thrilled to hear from you.
Edit: Hellfire... I'm pretty sure this problem is just Ox's doing. Goddamn ox. ALL OF MY HATE.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
剔除是一个概念,是的。
您可能遇到的问题是用于剔除几何图形的计算。系统不会自动知道对象有多大,因此在许多情况下(不确定 XNA 如何处理它),它将使用原点作为剔除点并假设对象无限小(如果原点位于视口内)该对象是可见的,如果不可见则不可见)。
如果您可以告诉引擎生成或更新该对象的边界框(可能是 AABB),则可能会解决问题。还要检查是否有任何其他因素(例如距离)产生影响(尽管适当的界限通常也可以解决距离问题)。
Culling is the concept, yes.
What you may be running into issues with are the calculations used to cull the geometry. The system doesn't automatically know how big an object is, so in many cases (not positive how XNA handles it), it will use the origin as the culling point and assume the object is infinitely small (if the origin is within the viewport the object is visible, if not then it isn't).
If you can tell the engine to generate or update the bounding box (possibly an AABB) for that object, that may solve the problem. Also check to see if any other factors, such as distance, are contributing (although proper bounds will usually fix distance issues as well).
XNA 框架为您提供了一个 BoundingFrustum 类。它是一个边界结构,包含相机可以看到的体积。它在此类中具有方法来确定哪些其他对象完全在内部、外部或部分在内部和外部。出去。
它与另一个对象的起源无关。它针对其他对象的边界结构进行测试。
这些测试返回“包含、不相交、相交”的枚举。您只需剔除那些不相交的(完全在截锥体之外),并且“半进/半出”的仍将被绘制。
The XNA framework gives you a BoundingFrustum class. It is a bounding structure that contains the volume that the camera can see. It has methods in this class to determine what other objects are wholly inside, outside, or partially in & out.
It has nothing to do with where the other object's origins are. It tests against the other object's bounding structure.
These tests return an enum of 'Contains, disjoint, intersects'. you merely cull the ones that are disjoint (completely outside the frustum) and the 'half in/half out' ones will still be drawn.