Sign in to follow this  
Sc4Freak

D3DXSprite instead of textured quads for particles?

Recommended Posts

Sc4Freak    643
I wonder, instead of going through the trouble of using textured quads for a particle engine, could I just use D3DXSprite instead? It is much simpler, built-in, and simply works. Would it be possible to render the scene without particles, then use some kind of depth-testing to render the sprites as behind or in front of geometry in the scene?

Share this post


Link to post
Share on other sites
Scet    960
In the ID3DXSprite::Begin call there are a number of flags that can be set. You'll need D3DXSPRITE_OBJECTSPACE to render in 3D and probably D3DXSPRITE__BILLBOARD as well. I'm not sure what that last part was about custom depth testing, sprites rendered in object space use the same Z-Buffer as everything else.

[Edited by - Scet on November 6, 2006 7:52:49 PM]

Share this post


Link to post
Share on other sites
Sc4Freak    643
The depth-testing thing was because I thought that, once the scene is rendered the particles would just be drawn on top regardless of depth (above or behind another object)?

Share this post


Link to post
Share on other sites
Scet    960
The ID3DXSprite.Draw call takes a D3DXVECTOR3 which includes a z component. Like I said, when you draw the sprites in object space, it renders as if it where a normal 3D-quad. There's no need for any special depth-testing, just use the z-buffer as you normally would.

This is a 3D scene right? I've been assuming it's 3D, but it would be nice if you mentioned what it actually was.

Share this post


Link to post
Share on other sites
Sc4Freak    643
Ah, yes, it is a 3D scene.

So, basically, I can render all my meshes, and then after that just make the calls to ID3DXSprite to draw all the particles in the world, and when I Present() occlusion will be working fine?

If so, this makes things extremely easy.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this