Render problem

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
michaldawn
Posts: 5
Joined: Mon Dec 05, 2011 7:34 pm

Render problem

Post by michaldawn »

Hello all. I'm new in BEPUphysics, but I like it :) Now, my problem.

When you look at attachment, you can see one "small" box front of three boxes. But this is just optical illusion (and my problem). In fact, all boxes are same size and small one is physically behind those three boxes.
It is important in what order objects are rendered? I assume that not. I used FBX models from Demos. One difference between demo end my application is draw method. My entity model isn't DrawableGameComponent. I call EntityModel.Draw method in Game.Draw for each EntityModel in my private List<EntityModel>.

I hope you understand my problem... sorry for my english.
Regards.
Michal Dawn
render.png
render.png (2.94 KiB) Viewed 3404 times
michaldawn
Posts: 5
Joined: Mon Dec 05, 2011 7:34 pm

Re: Render problem

Post by michaldawn »

I still work on it. I found that it is related with SpriteBatch.Begin() and SpriteBatch.End(). I use those methods for drawing text like debug info... But when I delete those two methods from my Game.Draw() method problem solved.... But why? I guess that this is not BEPU engine problem and probably it is beginner question. But your replies are really welcome. Cheers
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Render problem

Post by Norbo »

The SpriteBatch does indeed change some things. Most noticeably, it disables regular depth testing. Without that, the order of drawing objects matters.

Here's more information about what exactly changes:
http://blogs.msdn.com/b/shawnhar/archiv ... o-4-0.aspx

But you are correct that this isn't related to the engine itself, and just for clarity, I should note that the BEPUphysicsDrawer is just a debugging and testing system. It's not a good choice for a primary renderer in a game.
michaldawn
Posts: 5
Joined: Mon Dec 05, 2011 7:34 pm

Re: Render problem

Post by michaldawn »

THX VERY MUCH! This line of code from your link solve my problem.
GraphicsDevice.DepthStencilState = DepthStencilState.Default;
Post Reply