Directcompute + Physx particles

Hi all! I was wondering if anyone knows if it is possible to use Physx Particles with Direct Compute for the particles’ emission and lifetime management on GPU. I ask this because in all the Physx samples I have seen this is handled on CPU side, which limits the system’s particle amount.

If it is not possible with Physx, what about Apex? Any info is much appreciated!

Thanks in advance for your time

Ps. I already have a DirectCompute Emitter but what I don’t understand is how to pass the gpu buffer´s pointers where I have the particles to APEX and then back to hlsl to do the rendering. Any info is appreciated.

Hello!

Sorry, we currently don’t support creating particles through device buffers, neither in APEX nor in PhysX. Usually creation and deletion is not a huge overhead, but I understand that this could be different in your case. There is a trick to speedup lifetime management in general, by storing a deathtime, instead of a lifetime per particle. This way one doesn’t need to update any particle data, but can simply do comparisons against the current time. I know this is incidental to your issue, but migth help anyway.

Cheers

I understand, thank you so much for your time and advise!

One last question, I understand I can’t create the particles using GPU, but what about rendering them using custom hlsl vertex/geometry/fragment shaders? Do I have to copy the particle data from the Apex/physx simulation back to CPU and then send it back to the GPU for rendering inside a custom buffer?

Cheers

Hi,

From the User Guide section on particles:

Particle data can be read directly from the GPU device using PxParticleBase::lockParticleReadData(PxDataAccessFlag::eDEVICE) and PxParticleFluid::lockParticleFluidReadData(PxDataAccessFlag::eDEVICE). This can be used to render particles directly with CUDA Graphics Interop.

Hello Everybody.

I am starting to work on a big 3D simulation project together with Ural’s State University. Could you throw me into a decent book on DirectCompute and especially Ray-Tracing on DirectCompute. Something from Jason Vietnick will do fine.