GPGPU Particle Wall

I experimented more with sorted particles on GPU, ended up with this weird thing not sure what it is, so I called it GPGPU Particle Wall :slight_smile:

1 Like

If I remember correctly, you’re the one whose “productivity increased a lot since AI”.

This is apparently one of those products: some random visual “solution” in search of a problem.

1 Like

… sorting particles on the GPU is not a “random visual solution in search of a problem.”. It’s a vital enabling component of a large class of graphics problems.. (something which I haven’t implemented efficiently on my own, even after reading a lot of the literature.)

You want to work with gaussian splats ? you need sorted particles… You want to do nice particle smoke trails? you need sorted particles…
You want to prevent overdraw in large amounts of instanced data? … the list goes on…

You can debate the ethics of using AI in software.. but denying the utility of it is a bit naive at this point… (imho).

2 Likes

It’s ok I don’t mind :slight_smile: some of us are in Grinch mode during this time of the year…

That said, I do use AI, and that’s not a bad thing. This technology is here to stay, and it will get better and better. For senior devs like me, it can be a real force multiplier: I can apply my visual ideas 100× faster and solve issues that would’ve taken a lot more time or even imoissible to trancode because shaders and threejs are hard is no joke.

But I always know exactly what I’m doing and I stay fully in control of the result. I once built a project entirely with AI, and the code became unreadable—even to me—so I decided I’ll never do that again.

However this was not made with AI at all. It’s purely a GPU particle system, sorted on the GPU and driven by multiple noise layers. The result is what you see—and yes, it’s random. When you combine several noises, you naturally get these strange, organic patterns.

Below is the noise logic I was talking about, applied to the particles using a GPGPU technique. In this particular case, it could have been done without GPGPU, but the GPU particle sorting creates a visually magical effect.

I’ll be creating more experiments like this for the community, to showcase the real power of this approach—because most particle simulations I see out there don’t use this technique at all, I was not awared that this even existed until I saw a course created by SimonDev some time back and it got me hooked.

void main() { float time = uTime; float timeElappsed = uTimeElapsed; vec2 uv = vUv; vec4 particle = texture(uCurrentBuffer, uv); vec4 base = texture(uDataTexture, uv);
vec4 newPos = base;

newPos.y -= mod(time * 0.2, 2.0);
float progress = smoothstep(-2.0, 4.0, newPos.y);
float progress1 = smoothstep(-2.0, 8.0, newPos.y);

// Keep a stable per-particle seed for color. Base.w is initialized once in JS (Math.random()).
newPos.w = base.w;

// newPos.x += cnoise(vec4(newPos.xyz, time));
newPos.z +=  progress * pow(newPos.y, 3.0) ;

vec3 noise1 =  1.0 * (base.xyz * vec3(1.0, 3.0, 1.0) + time * vec3(0.0, 0.4, 0.0) * vec3(2.0, 2.0, 1.0));
vec3 noise2 =  (base.xyz + time * vec3(0.0, 0.5, 0.0)) * vec3(3.0, 2.0, 11.0);

newPos.x += .4 * progress*  cnoise(vec4(noise1.xyz , time)) ;
newPos.yz += 1.7 * progress1 *( cnoise(vec4(noise2.xyz  *2. , time)) + 1.0);


gl_FragColor = newPos;

}

1 Like

Yes—and visually, this is where the fun really starts. Sorting particles on the GPU makes it possible to use custom blend modes, such as alpha blending, which allows the particles to glow and produce vibrant, rich colors. It’s really cool.

1 Like

I stopped resisting AI some time ago. I realized it’s here to stay, and if we embrace it correctly, it’s like having a specialized team at your back—giving you real superpowers.

As developers we need to find the good balance of the way we use this, personally I use it for concetrated tasks and for stuff that I know how to do and I don’t want to waste two days redoing it again, but for new stuff my brain is on fire all the time and boy I learned a lot lately things that I had no idea even existed!

1 Like

Is it just me who sees a slight contradiction between the two statements?

1 Like

No comment is pointless anyway!

Come to the dark side vielzutun.ch !!!

Google Antigravity :smiley:

1 Like