Topics: User Forum
Feb 25, 2007 at 2:55 PM
I followed Riemers tutorial on point sprites and got it almost working. This is how it looks like:

I am using the the Animation Components sample and this is where I think the problem lies. The Zdepth sorting works fine with ordinary objects but the objects from the sample doesn't work. I guess there is something with the World Matrix that screws things up.

I have no idea how to fix it.

Riemers tutorial:
Feb 26, 2007 at 10:19 AM
I'd need to see the entire project source code to fix it. I can probably afford to spend a few minutes looking at it if you send it to my email, but I've been quite busy recently. This is why why I haven't made the next release yet (which I'm planning on making the first beta release). If the sprites are closer to the camera than the model in terms of world/view/projection matrices, they zbuffer won't be helpful.

On a sort of related note, once you are ready for it, I would suggest using vertex buffer hardware instancing to draw 3D spheres as bullets instead of billboarding 2D sprites. The statement "drawing lots of 3D spheres is hard on the 3D card" is only true if you use effect instancing to do it. However, I won't get into the details of vertex buffer hardware instancing since you are a beginner.
Feb 26, 2007 at 11:21 AM
I mailed you the code. Why I use pointsprites is because I want to create a particle system for smoke and explosions.
I guess I'll have to read up on Vertex Buffers now.

Thanks a million times !
Feb 26, 2007 at 2:45 PM
So, do you want these bouncing balls to render behind or in front of the dwarf?
Feb 26, 2007 at 2:58 PM
Edited Feb 26, 2007 at 3:05 PM
I don't see what the problem is; you are using models for all your classes, and z buffering works fine (setting z = 100 or so shows object in front of the dwarf, -100 or so shows it behind).

The reason you are getting clipping problems with the dwarf and projectiles is because their z value is the same.
Feb 26, 2007 at 4:34 PM
But I get a blue square, like in the screenshot, even if the projectile is in front of the dwarf and ground(z = 100). The blue square doesn't appear with the sphere that aren't ModelAnimators. I offsets the pointsprites in z:
foreach (Projectile p in projectiles)
spritecoordsarrayprojectiles.IndexOf(p) = new ourspritevertexformat(p.position + new Vector3(0, 0, 2), 5000000.0f);

And the bouncing balls are models, not pointsprites.

Thanks again for your time
Feb 26, 2007 at 5:04 PM
oh, this has nothing to do with the z buffer... it's alpha blending.

To fix it you'll have to manually call draw on the dwarf and set the alpha blend functions.

1. Set dwarfAnimator.Visible to false
2. In your player.Render() method,
RenderState render =;
render.PointSpriteEnable = true;
render.AlphaBlendEnable = true;
render.SourceBlend = Blend.SourceAlpha;
render.DestinationBlend = Blend.InverseSourceAlpha;
dwarfAnimator.Draw(new GameTime());
Feb 26, 2007 at 9:13 PM
Oh, it works. I am so happy.

Thanks Dastle, you and your team are great.

P.s. The German dude at mentions your components.D.s.
Feb 26, 2007 at 9:26 PM
Edited Feb 27, 2007 at 11:07 PM
Yah, unfortunately he does not seem to like the content pipeline and .fbx/.x format. The main thing that caught my eye is that he said the library has a lot of problems with complex animated models, which I think is simply not true, unless by complex he means models with more than 56 bones. I have tested a large variety of models, including some extremely complex 25,000 vert models, and they all work fine.