Jump to content
  • Advertisement
Sign in to follow this  
yangyu

gpu particle with direct9 sample

This topic is 2607 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

hi guys:
i want implement a particle system running [font=Verdana, Helvetica, Arial, sans-serif]entirely on the GPU [/font] with directx9 in shader model 3.0.
i have read some article, but i still have some questions.

[font=Verdana, Helvetica, Arial, sans-serif]RVB is only available on ATI's card, so only way is use the render to target texture right?[/font]
[font=Verdana, Helvetica, Arial, sans-serif]store the particle's property( like position , velocity, size, life... ) in the texture.[/font]
[font=Verdana, Helvetica, Arial, sans-serif]using two pass:[/font]
[font=Verdana, Helvetica, Arial, sans-serif]pass1: update the particle's property.[/font]
[font=Verdana, Helvetica, Arial, sans-serif]pass2: render the particle[/font]
[font="Verdana, Helvetica, Arial, sans-serif"]
[/font]
[font="Verdana, Helvetica, Arial, sans-serif"]in my old system, i need to use the all the particle in the emitter to calculate the AABB of emitter for scene visibility culling.[/font]
[font="Verdana, Helvetica, Arial, sans-serif"]if move the calculate to GPU, i can't read it back to cpu.[/font]
[font="Verdana, Helvetica, Arial, sans-serif"]
[/font]
[font="Verdana, Helvetica, Arial, sans-serif"]do i miss some thing about how to implement the gpu partilce system, or is there have some solution to solve my problem.[/font]
[font="Verdana, Helvetica, Arial, sans-serif"]ps: is ther any c++ dx9 sample for this?[/font]
[font="Verdana, Helvetica, Arial, sans-serif"]
[/font]
[font="Verdana, Helvetica, Arial, sans-serif"]thanks!
[/font]

Share this post


Link to post
Share on other sites
Advertisement
Designing a GPU-based particle system is an extremely difficult task. Because, it's too difficult to perform collisions and/or collision detection (btw, some approaches deal with collision detection via volume textures but it's not an efficient way).

Frank Luna's book (Introduction to Game Programming with Direct3D 9.0c: A Shader Approach) introduces gpu-based particles system. But it only calculates velocity and position of a specific particle and renders.

I think most of the engines on the market still uses an approach similar to the above one.

hth.
-R

Share this post


Link to post
Share on other sites
thanks programci_84:

in our game, only very few particle effect do the collision test with the terrain, like 1%.


i read the source code of the book([color=#1C2837][size=2]Introduction to Game Programming with Direct3D 9.0c: A Shader Approach).
it also don't read the particle's position back, just use a fixed AABB for the demo.

in our game world, have many of the particle effect.
i need to calculate the AABB of each particle effect to figure out the visible set of the scene.

so gpu particle in Directx 9 is a dead way?

Share this post


Link to post
Share on other sites
No, this does not mean that it's a dead way to implement a gpu particle system in DX9. But it's too hard to do some physical processes (like collision detection and response) on the GPU. Still you can do accelerating, positioning, calculating the velocity and texturing the particle system in GPU. It's ideal to use GPU for these tasks. But if you want to implement some visibility algorithms or collision/physics processes, you have to do them on the CPU.

Other experts here can give you better ideas I think.

hth.
-R

Share this post


Link to post
Share on other sites
Also beware of anything that requires a readback from the GPU. Irrespective of bandwidth considerations, reading back from the GPU will stall the pipeline until the readback is finished, so it's generally a baaaaaaaad idea.

Have you looked at geometry instancing? Since you're targetting SM3.0 this is going to be available, and you'll be able to draw particles with the equivalent of one quarter the vertexes - one vertex per particle instead of 4 (as well as do billboarding on GPU).

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!