Suggestion for next community challenge: do something with compute shader
Ok. I made something… interestingly @selimanac I was going to use compute shaders for this, since I think its more suited (I didnt, went the easy slow way ). Anyway, video and source provided.
What a big bada boom I’d love to compare the performance differences between this and a compute shader one.
I have no idea how to use compute shaders at all, but I’m planning to start learning the basics. This is why I suggested this subject. Also, this might encourage people to test the technical preview stuff.
Id expect a compute one to be substantially better. This has 20,000 go’s in it … it would work even better with 20,000 meshes instead (ie, I was lazy ). With compute (looking at it now) it looks like I could offload all the particle processing, and I think I could potentially use it for live mesh generation. Not sure. Will update if I get something going. Thanks for suggesting btw.
I’m planning to do an example or a tutorial on how to use compute for something like this, but maybe someone else gets there first
Still, it is surprising to see how well Defold is crafted. it literally iterates over 20k items in a loop. Yes, the result is not suitable for production, but it’s good to know the limits.
If you can find some spare time, please do. Even a simple math example would be a good starting point for me.
I think I have a compute shader running. Need to get the texture into a render output now. Have a look in the above repo (defold-explosion) and look for assets/compute and the additions in main/default.render_script. Will hopefully render the particles with it tomorrow.
About time to announce the results! And a next challenge I hope!
Yes, sorry about the delay. Vacation and some other things have come in the way of this. You can expect the results to be announced this week!
Thank you to everyone who participated in the challenge. I hope everyone enjoyed it and learned something new along the way! There were several great contributions but in the end we decided to award the following three contributions a Steam Gift Card:
Shooting Circles
by @Insality
Very nice looking explosions, and a very impressive game too!
Play: Shooting Circles 0.0.1
Source: https://github.com/Insality/shooting_circles
Post mortem: Shooting Circles - Defold ECS game example
Missile Commander
by @benjames171
Nice chunky retro style explosions w. debris. Baked into a nice little Missile Commander game to really show off the explosions.
Source: https://github.com/benjames-171/explosion-demo
Demo: https://6689244e4250ed862e5872f6--chipper-speculoos-2f9e45.netlify.app/
Explosions
by @NaakkaDev
Excellent remake of the original explosions. The demo also contains two other explosion styles.
Demo: community-challenges 1.0
Source: https://github.com/Temeez/defold-community-challenges
@Insality, @benjames171 and @NaakkaDev please ping me in a PM to arrange for transfer of your gift cards.
Yay, amazing! Thanks for the challenge and to every participant who joined in
Yes, it was very interesting to see what everyone came up with!
Wow. I just played shooting Circles and that thing feels great. Nice Job.
@jhonny.goransson - I updated and got a compute shader working and passed the output into a fullscreen render. Something does not feel right about it though. Will have a look later, thought you might be interested:
https://github.com/dlannan/defold-explosion
The texture is a data texture showing the pos and vel in that texture.
Nice! What doesn’t feel right?
Perf. Seems off. This is 256x256 (maximum compute cores I can run I think) and so its only 65K particles. And quite a small texture (in real terms). I think it should be possible to do much more than this. Going to look at multi-dispatches and see if that helps. Not now, but prob in a few weeks time.
Maybe I can take a look at the performance and see if I can find anything. I’ll let you know
The low performance isn’t because of the compute shader, it’s because of this loop happening in your “particle” shader:
That shader takes up something like 99.9% of the performance when I profile it in xcode
Yeah. I realized that would be an issue. Count = frag x image pixels.
However I have done many more than this in the past …
It is more of an arch issue I think. The compute prob should write particle ‘patches’ out to a number of textures with multiple dispatches (thats what I was referring to above). Then the patches are written directly rather than via the fullscreen shader.
Current version also could do with getting more ops in the compute shader too - ie each compute maybe handles the updates of a number of particles, and not just one
Anyway… will look at later. Thanks for the response.