Strange graphic glitch

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
dweeb
Posts: 14
Joined: Tue Jul 15, 2008 11:17 pm

Strange graphic glitch

Post by dweeb »

Hi

I've been having some issues with graphical glitches.

I've loaded a model (.x file) which is a basic landscape and I use it instead of the playground model.

But when an active entity hits the model it creates a number of triangles (glitches) in different colors. Where are the triangles comming from and how do I get rid of them?

I've attached and image that shows the glitch in action.

Thanks for the help.
Attachments
glitch
glitch
Graphics problem.jpg (45.34 KiB) Viewed 6086 times
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Strange graphic glitch

Post by Norbo »

That's... very odd. Is this in the latest v0.9.0 using the default display systems? Did you notice any unusual collision behavior?
dweeb
Posts: 14
Joined: Tue Jul 15, 2008 11:17 pm

Re: Strange graphic glitch

Post by dweeb »

I'm using the default display systems.

I've managed to track down the exact line that causes the problem.

In your playground demo you set the models worldmatrix by using this code:
group.worldMatrix = Matrix.CreateFromYawPitchRoll((float)Math.PI, 0, 0) * Matrix.CreateTranslation(0, -10, 0);

I changed that to (I wanted the model to be placed on the "ground"):
group.worldMatrix = Matrix.CreateFromYawPitchRoll((float)Math.PI, 0, 0) * Matrix.CreateTranslation(0, 0, 0);

This causes the glitch. If I change the value to anything else but 0 it works just fine.

However I do not think that this should cause any graphical glitches, it should just change the word matrix of the model right?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Strange graphic glitch

Post by Norbo »

That's correct, it shouldn't cause any issues. I can't seem to replicate it; have you seen it happen when using the default playground model?

The only thing I can think of that would cause the spontaneous creation of new triangles is if new entities are being added to the EntityDrawer. Try checking to see if there are any calls to EntityDrawer.addEntity/addDisplayObject after initialization. If you aren't observing any collision issues, it's unlikely that this is the cause but it's worth testing.

Have you tried forcing the EntityDrawer to use CPU instancing instead of shader instancing by passing in false for the third parameter to the EntityDrawer constructor (near the top of the startSimulation method)? Does it still happen?
dweeb
Posts: 14
Joined: Tue Jul 15, 2008 11:17 pm

Re: Strange graphic glitch

Post by dweeb »

I've attached a .x file for you to try.

Replace your playground model with this one and see if you also get the glitches.

This is not a big issue for me since I've translated the model slightly to avoid the problem.
Attachments
test.zip
(197.14 KiB) Downloaded 314 times
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Strange graphic glitch

Post by Norbo »

Unfortunately no, the problem isn't replicated when I use that model.
Post Reply