Jump to content
  • Advertisement
Sign in to follow this  
Sc4Freak

D3DXSprite instead of textured quads for particles?

This topic is 4271 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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]

Share this post


Link to post
Share on other sites
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
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!