Jalava, Moderator Posted: 20 July 2011 10:58 PM Total Posts: 20
Some of you might know that I’m working on Away3d 4.0 particle system.
Now, I’ve already solved most of the particle system problem for additive and multiply blended particles, but all other blending modes require z-sorting.
Any idea on how to quickly sort 10k particles or so?
My current method uses multiple vertexbuffers and of course, most of the streams need to be resorted every frame if I move particles. Because this is extremely slow to do, I’m thinking about options I have.
One way would be to have static buffers and all particle positions, colors etc are sent as constants, using “vc[va4.x+”+partPos+”]” style agal.
This however requires setting program constants every frame. Though it might be faster than uploading the whole vertex data every frame after sorting.
Any ideas?
Stephen Hopkins, Sr. Member Posted: 21 July 2011 12:25 AM Total Posts: 110
[ # 1 ]
Not quite understanding the technique you are using.
How many vertex buffers? and particles per vertex buffer? Do you group particles into vertex buffers based on their depth value?
Jalava, Moderator Posted: 21 July 2011 12:57 AM Total Posts: 20
[ # 2 ]
My current system just forgets about the sorting and works like this:
VertexBuffer 0: Particle positions, 4 vertices per particle. All have same values (FLOAT_3)
VertexBuffer 1: UV Coordinates for Particle corners (FLOAT_2)
VertexBuffer 2: Contains Particle Corner Index (FLOAT_1)
VertexBuffer 3: Contains Particle Spawn time, Particle life, Start Alpha and End Alpha (FLOAT_4)
VertexBuffer 4: Contains Particle Speed (FLOAT_3)
VertexBuffer 5: Contains Particle Color (FLOAT_4)
Now if I want to spawn particle, I just update the buffers and next time particles are rendered, new particle is positioned. This means that GPU will calculate the buffer size always regardless of “alive” particles. “Dead” particles are rendered just as alpha = 0.
Problem with this one is that my volumetric sort fails for somereason in certain angles. And because I need 48 different indicelists, memory consumption is HUGE. that is 50x50x50 particles, with some nonvisible (scaled to 0)
Actually, this type of effects are better done with distance fields / ray marching, but that is effect for completly different type of engine.
Here is other much more simple stateless particle engine with gpu based particle moving. 32k alpha blended particles. No sorting done, no depthwriting etc. Can easily push out million particles if you really need to.
SasMaster, Sr. Member Posted: 22 July 2011 09:28 AM Total Posts: 127
[ # 4 ]
Nice work .BTW ,Do you know that me and Richard Lord have been working already for several months on Molehill engines integration into his FLINT particles framework? We currently have Away4 ,Alternativa3D and Flare3D integrations.If you ask about performance I implemented particle pool system where you recycle the particles instead of spawning them each time anew.Still the performance is not that optimal and this is due to the 3d engines drawing calls approach.If you wanna get the maximum like FunkyPants and RINGO did where they both showed some more than 50000 particles generated with a descent FPS you have to hack the core of the render engine and push all the particles into as less buffers as possible. That would be entirely non trivial and I currently can’t see the way how such a thing could be interfaced smoothly into Away4 architecture.
Good luck with the project.
Concept Z, Sr. Member Posted: 22 July 2011 10:08 AM Total Posts: 124
[ # 5 ]
really niece things ,jalava!
Ringo Blanken, Administrator Posted: 23 July 2011 05:25 AM Total Posts: 120
[ # 6 ]
Great start Javala!
I’ll try it out asap.
felix, Newbie Posted: 09 November 2011 07:20 PM Total Posts: 4
[ # 7 ]
Sounds interesting, however both the demos posted above give a black screen and hang my browser.
Alejandro Santander, Administrator Posted: 16 November 2011 12:13 PM Total Posts: 414
[ # 8 ]
Great work! I can’t see your demos tho… just a black screen on each. Any ideas why?