Topics: User Forum
Feb 25, 2007 at 1:55 PM
I followed Riemers tutorial on point sprites and got it almost working. This is how it looks like:
http://www.karlfredberg.se/cgtalk/pointSprites.jpg

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:
http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2/Point_sprites.php
Coordinator
Feb 26, 2007 at 9: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 10: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 !
Cheers
Alfons
Coordinator
Feb 26, 2007 at 1:45 PM
So, do you want these bouncing balls to render behind or in front of the dwarf?
Coordinator
Feb 26, 2007 at 1:58 PM
Edited Feb 26, 2007 at 2: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 3: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
Coordinator
Feb 26, 2007 at 4: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 = Game1.graphics.GraphicsDevice.RenderState;
render.PointSpriteEnable = true;
render.AlphaBlendEnable = true;
render.SourceBlend = Blend.SourceAlpha;
render.DestinationBlend = Blend.InverseSourceAlpha;
dwarfAnimator.Draw(new GameTime());
Feb 26, 2007 at 8:13 PM
Oh, it works. I am so happy.

Thanks Dastle, you and your team are great.

P.s. The German dude at http://abi.exdream.com/ mentions your components.D.s.
Coordinator
Feb 26, 2007 at 8:26 PM
Edited Feb 27, 2007 at 10: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.