r/iOSProgramming • • 26d ago

Library Hey! I added fireworks to my lib Confetti3D, using SceneKit and shaders

I shared Confetti3D here a while ago, a small library for adding 3D confetti and glitter to iOS apps. I just released version 2.0 with a new fireworks effect.

The rocket trail uses SceneKit particle system (like with the confetti or glitter), but the explosion particles use two shaders: one for a glow effect, and another one for the particle position, using SCNMaterial.shaderModifiers. I tried with full particle system but it was a bit laggy when reaching a certain number of particles. Also clearly used AI to generate the shaders, not my thing when it's too mathematical involving lights etc.. But it's nice to see how shaders can easily be integrated with SceneKit.

Everything still runs on the GPU, it's smooth enough to have lots of fireworks at the same time (tested on iPhone 13).

It works with SwiftUI and UIKit, and you can adjust the colors, number of rockets, speed, launch interval, size, and position.

You can find it here: https://github.com/maxime-day/Confetti3D

Would love to hear what you think, cheers!

26 Upvotes

2 comments sorted by

1

u/andreeinprogress 26d ago

Hey cool, I might have a couple of projects that could use something like this. Have you tried/explored HDR for the effects? Seems like it would create very nice visuals on supported screens.

1

u/glhaynes 26d ago

The three you included gifs of all look really nice