开发者

C# XNA - Render(?) 3D object when off/half off screen. (Culling?)

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 i开发者_Go百科t 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.


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).


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜