Multi Textured Particles

i'm just getting into jme's particle world (using jme cvs) and ran into some questions

a) what would be the best way to have multiple textures (various particle shapes) on a single particle system? (like multiple snowflake textures)

b) i'm also working on something like a foliage/leaves simulation (leaves dont 'die', they just lie around with some physical interaction, it needs to run at 60fps min with 3000-4000 particles) - what is the best practice here: is it better to create multiple texturemapped quads or use a particlesystem to make use of the fast batch-geometry? i'd naturally would go for the quads because the jme particle system seems to complicate things here / although i cant seem to get decent framerates with the multiple quad variant. what do you think?

Building a Million Particle System entirely on the GPU.

Abstract of the paper:

Particle systems have long been recognized as an essential building block for detail-rich and lively visual environments. Current implementations can handle up to 10,000 particles in realtime simulations and are mostly limited by the transfer of particle data from the main processor to the graphics hardware (GPU) for rendering.

This paper introduces a full GPU implementation of both the simulation and rendering of a dynamically-growing particle system. Such an implementation can render up to 1 million particles in real-time on recent hardware. It helps you to dramatically increase the level of detail and allows you to simulate much smaller particles. Thus it goes back again towards the original idea of a particle being a minimal geometry element.

The massively parallel simulation of particle physics on a GPU can be a flexible combination of a multitude of motion and position operations, e.g. gravity, local forces and collision with primitive geometry shapes or texture-based height fields. Additionally, a parallel sorting algorithm is introduced that can be used to perform a distance-based sorting of the particles for correct alpha-blended rendering.

uh, with 3k-4k particles you might need to put that entirely into shaders, which would get tough to have some physics in . . . I have seen such demos from havok, which were entirely computed on the gpu… maybe you should lower your requirements a bit here?

thanks irrisor, i was probably a bit mislead by renanses particle editor which seemed to run alright with lots of particles.

in fact i had written some tests that run at 80fps with 3000 particles on my macbook pro… but may have to reconsider that …

still, what would be the best performing way to create a foliage simulation (as many leaves as possible, with various textures, with some physics interacting)? can jme's particle system be tweaked to allow per object physics?

the physics part is allready possible with renanse's particle system. have a look at the classes implementing the ParticleInfluence interface. Then just add your own influence type.

Texturing is a bit harder but one possible solution would be to pack several textures into one and having the texturecoords map out the texture to use per particle.

it all really depends on what kind of foliage simulation you are after. if you just need a small waving(sine) motion it could be done through a vertex shader for speed…

You can extend ParticleGeometry or ParticleMesh to create your own type of particle. You could use this to apply different textures to particles, for example by giving different particles different texture coordinates, or having different batches with different TextureStates (might need to adapt ParticleMesh a bit for effective code reuse in that case).

3k/4k is a lot of particles to update each frame, however if you disable updates for most of these particles (particles have a status property for this) maybe it can be done with a decent framerate.

thanks guys for the good input!

i'm going to give the extended particlemesh idea a try. the foliage effect i'm looking for should behave like normal leaves lying randomly on the ground and being whirled around when the player goes through it.

on another note, we really need to add pointsprites to jME…

i have to admit i never did anything with particles, but can't you aggregate more particle systems in one (or use more than just one particle system)? then you could set the texture of each system and you would have the desired effect.

i'm pretty sure that this would work, but i was more after a 'clean' solution…

also i was thinking about ~50 different textures which makes using 50 different particle systems a bit arbitrary.

aggregation is a "clean" OO concept :stuck_out_tongue:

it just depends on how you implement it. it would even bring some advantages as you could control "how much" of some particular(as in texture) particle you want.

Mojo recommended a good solution of using a single texture with multiple subtextures and controlling the uv coords in a single particle system.  I think that's a great idea and to take that a step further, I think adding a particle definition object of some kind that describes a single type of particle, color, uv coords on a texture, rate of occurance, and so forth would be a great direction to go.  Then you could basically add these definitions to a single particle system (ParticleGeometry).  Think snow with several different types of flakes, or falling leaves of different kinds (perhaps even different weights or air resistances since you could test which definition the particle is using in your custom influences.)

Very exciting.  :slight_smile:

PS: Quad particles winding bug should be fixed in cvs anytime now.

that particle definition thingy sounds really great

renanse said:

Mojo recommended a good solution of using a single texture with multiple subtextures and controlling the uv coords in a single particle system.

Oh, well who reads anyhow?  :stuck_out_tongue: