D3DXSprite instead of textured quads for particles?
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?
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]
[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)?
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement