Hi folks. Here I am again with another model problem I don’t understand.
In Blender I created a simple object just for testing. It’s an icosphere surrounded by 5 other smaller icospheres, it looks like a few joined bubbles. I Joined all the objects, CTRL+J so there is only one mesh and exported them. So far so good.
When I get the model into my code it draws ok, but no matter what the orientation of the model the smaller spheres display behind the larger. So as I’m spinning the object the orbiting spheres always draw behind the larger.
The larger sphere was created first in Blender, but there are no parents or children or anything slightly complicated.
You want to have a depth buffer so the gpu can test if objects are behind others and skip the pixels that aren’t visible. If you use SpriteBatch it will by default disable the depth testing. Try putting the following code before rendering your meshes:
So, I only have SpriteBatch in the code because it’s in the cobbled template I’m using, are you saying I shouldn’t be using it with a 3D environment? It’s part of the LoadContent and Draw routines. Handy in the draw routine as I want 2D text, but the mesh drawing is outside of the batch.