D3DXSprite instead of textured quads for particles?

Started by
3 comments, last by Sc4Freak 17 years, 5 months ago
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?
NextWar: The Quest for Earth available now for Windows Phone 7.
Advertisement
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]
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)?
NextWar: The Quest for Earth available now for Windows Phone 7.
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.
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.
NextWar: The Quest for Earth available now for Windows Phone 7.

This topic is closed to new replies.

Advertisement