APE - A 3d particle engine for GLBasic.

Previous topic - Next topic

Hemlos

Youre right, and thinking along the same lines as i am...

There is almost no difference in speed as far as i can tell.
Its extremely efficient, each emitter has a a list of pointers. Each time a particle is moved, it checks itself against the next one in the list. Thats it, a single distance test per particle.
....a reversed bubble sort is basically merged into the loop.
Bing ChatGpt is pretty smart :O

kanonet

Only a single test? That would mean that you wont sort it properly when the particle needs to get moved more than one position. This means in case you did move it, you need to check it again and again till you dont need to move it anymore. But this means in worst case your sorting would need O(n^2) which is not very efficient (its a form of bubble sort then).
In my opinion it would be more efficient to move all particles 1st and then sort them right before you render everything and maybe use a more efficient sorting algorithm (no sure which would be best in this case).
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Hemlos

The emitters are already O(n) to start with. Bubble sorting all particles on each pass...very ineficient and definetly not needed.

In the case the camera moves and particles lives too long(more than a second or two): The quality of the sorting will not be perfect.
These wont even need to be sorted anyhow, chances for a majority of thier life they are no where near the thickest area where the problem exists.

In the case where particles are short lived, this is good enough, and provides higher quality results.

As it is, in all cases: no performance drop, and there is always some chance of quality being increased.
IMO this is a great tradeoff.

Bing ChatGpt is pretty smart :O

Hemlos

#63
This feature only slightly increases quality where alphatesting is looking odd in some situations.
And it can be totally omitted to maintain maximum performance of the emitter.

Edit:
This feature forces the closest particles to the camera to always be rendered last.
Not all particles will benefit in all situations, only the closest to camera are guaranteed sorted in all situations.
Bing ChatGpt is pretty smart :O

Hemlos

Ok test programs are uploaded..

There are 2 version, the campfire is the focus in these tests.
The executables are named sorted and unsorted.
The sorting is done only to the fire and smoke of the campfire.

The explosions in both demos are NOT sorted.



[attachment deleted by admin]
Bing ChatGpt is pretty smart :O

mentalthink

Nice, NIce--- I don't look from today... I only see in the middle of the xplosion the yellow sprite turns very faster...
Sometime Ago I send to MrTatoad a guide for make a particle system in 2D i found in somewhere (sorry I don't have bookmarked), but I think pass this to 3d can be too much complex...

I like a lot, and the last part the little sparkles are very very nice...  :good:

SnooPI

I know the difficulty of 3D development. It is necessary that you stay motivated Hemlos.  :)

It seems that this is a good LIB. I tested a demo some time ago, it was very good (maybe a bit slow) you just need to optimize it.
Maybe using the INLINE function for mathematical calculations.

You have my encouragement Hemlos.  :good:

erico

I have tried some stuff Hemlos did in 3d and also a bit of this lib, it is great work.
I also noticed it has been a while since you are around.

Welcome back. Yep every development is hard. You did a great job so far.
You have my support too Hemlos, and don´t go away for too long! :good:

Maybe we should strike an IRC soon?

Hemlos

thanks for the compliments

snoop, it was a bench test, yes slow, overloaded.
inline might not work on some devices.
however, many improvements have been made, it is really a solid lib now.
I think the lib will be ultra fast and seamless for nay software, typically a game will use a VERY limited amount of particles at any given time...
...you will be able to use hundreds, if not thousands, of these APE particles with very little notice in fps.

thanks erico, im not discouraged, just strapped for time and cant wait any longer to release APE!
i had a prospect for a release in a game with a game maker, but he kinda disappeared and so i will just have to release it without him.
the plan was to release it with a game, showing it off, but i just dont have the time to do one myself.

ill hit IRC on friday as soon as i get out of work (will try my best)
-Love you guys
-Neil
Bing ChatGpt is pretty smart :O

erico

Great Neil!

There are some chaps working on games on the board right now, maybe contact them or they contact you to get a showcase going?
It would be really nice to see it in action that way, I agree! :good:

mentalthink

Hi think Neil put whit a price the Lib it's a good idea.. 3 years it's a lot of time... I think this works or very explaned tutorials,  or another interesting thing have to be a price... The forum it's like a family but I think this contribute to the people make more things and perhaps make very huge GLbasic...

Another example, I think it's very valid for this it's the port of physics Bullet 3D, now don't works but put a good price for this can be very interesting...

Unity it's a good program but another good point it's the huge market, I sell some models, and I have to use it... perhaps GLbasic only have interest in some people for develop code , models 3d, Sprites or sounds... I think open a Market can be very very good for glbasic.

SnooPI


kanonet

Hemlos are you aiming at mobile devices or only desktop systems with this? My libSPRITE only works with OpenGL (so only on desktop systems) but not with OpenGL ES (so not on mobile devices). But I could create you a version that works on both, desktop and mobiles (only tested android, but all OpenGL ES systems should work). PM me about this issue if needed.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Hemlos

..Back...

I dont know kano, the underlying structure(aka guts) that drives the pixels to the screen is your baby LOL. :P

My plan is still to release open sourced this year.
I want to make a few tweaks, and review the help file for editing.
The code will be "AS IS", i dont plan on changing the code style again.
Christoph, That said, you can take this project and FLY with it.

I do want to make a GUI/EDITOR for this particle system(eta next year?), with a code generator....shouldnt be too time consuming, yet it is an afterthought.
Dont worry though..the help file i created is extensive, almost worthy of a book ( hint hint nik :) )
Bing ChatGpt is pretty smart :O

kanonet

Nice to see that you are working on this again. I updated my libSPRITE several weeks ago, so if you use the current version, android (and propably all other mobile stuff too) is working: www.glbasic.com/forum/index.php?topic=7992.0
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64