You are browsing as a guest. Sign up (or log in) to start making projects!

blobbingblobb

@blobbingblobb

Joined May 31st, 2026

  • 13Devlogs
  • 3Projects
  • 0Ships
  • 0Votes
Open comments for this post

3h 49m 46s logged

So, the first idea was to implement shared memory into the smooth shader, and I did so. That brought down the average run time of the pressure solve shader from 15.4 ms to 13.87ms. Only 1.5 ms improvement.. why? Well, there was a halo of cells that had to be still fetched from global memory. So I thought to load those too to shared memory, but that introduced a ton of branching, which brought the average runtime to 29.7 ms… immediatelly reverted the change. At this point, unhappy with only 1.5 ms of change I didn’t stop here: fixing barrier bits brought down 13.87ms to 13.74ms, and changing the pressure and residual images from r32f to r16f (as that much precision is anyways not needed) brought it further down to 13.62ms. The biggest improvement was batching the gauss seidel calls: that allowed the GPU to better use the cached values and avoid CPU overhead. This brought the execution down to 8.93ms! This initial optimization sped up the pressure solve shader of a whooping 42%! And there is still the compute residual, prolong pressure, restrict residual and restrict solid shaders which too affect the pressure solve runtime!

TLDR:

  1. Initial runtime (avg) - 15.4ms
  2. Shared memory - 13.87ms (-1.53)
  3. Barrier bit fix - 13.742ms (-1.66)
  4. r32f to r16f - 13.62ms (-1.78)
  5. Batching smooth calls - 8.93ms (-6.47)
0
0
2
Open comments for this post

2h 13m 33s logged

took a long enough break from coding to forget a few things of my project, but that was helpful to rewrite the benchmarking logic: it was a complete mess. It now logs data correctly and makes a proper csv file! Now, I can cleanup the benchmark setup code and then I can finally start optimizing my shaders and seeing the effects of what I’m doing! (Gotta make benchmark enviroment end at a set amount of frames + skip first initial frames)

0
0
2
Open comments for this post

1h 50m 5s logged

this took a while! Figured out the smoke output was weird due to a small issue with one of the preprocessor macros and not because of using complex math. Next up I have to make it runnable on the browser so people don’t have to download it!

0
0
4
Open comments for this post

1h 2m 25s logged

I don’t fully like how complex numbers instead of vec2 changed the smoke behaviour, but that’s the tradeoff to make the code even less straight forward. I am happy with the written preprocessors and I’m now gonna start making this thing a mess to read! Video of new smoke behaviour attached

0
0
1
Open comments for this post

1h 56m 27s logged

I know code screenshots aren’t allowed, but that’s the core of my project so I hope an eye can be closed. That said, I finally started the obfuscation process! Slowly moving to preprocessor macros (in the meanwhile even accidentally deleted all my project files but thankfully had the main.c saved in a discord chat..). Created a repository too! So far works well.

0
0
1
Open comments for this post

1h 15m 20s logged

Took a long while to understand the issue, but now files are correctly parsed! Had some issues with solid boundary checks and some other issues with the parsing functions, but it’s all fine now. I think I’m gonna refine it a tiny bit and then move to obfuscating the code

0
0
4
Open comments for this post

17m 22s logged

Fixed it! was actually an issue with how smoke was being drawn. Now I can finally add temperature effect and I’m technically done with the base smoke sim. Will follow some file parser or something and then obfuscation!

0
0
9
Open comments for this post

29m 51s logged

I don’t think advection is happening correctly. It looks very, very weird to me. That said, it’s a start! I’m still missing temperature but first I wanna figure out if there is a problem with advection or I’m just dreaming it.

0
0
7
Open comments for this post

1h 8m 16s logged

Implemented pressure solve, velocities update and smoke advection to see everything in action (still missing velocities advection but that should be pretty easy to implement as it uses the same functions as smoke advection). Tried testing it but it just explodes. Gotta figure out what’s wrong! But first, gotta limit fps. This is too fast.

0
0
8
Open comments for this post

34m 44s logged

It’s obviously gonna be heavily stripped down and not refined as my original Smoke Sim project. Will run on console etc. Got some display down for now, now to write pressure solve function! Can’t wait to get to the end of this so I can start obfuscating the code :). All of this because I’m on vacation with my Mac and can’t code OpenGL on it to continue my main project…

0
0
8
Open comments for this post

1h 31m 29s logged

Started making a benchmark enviroment that saves the GPU times on a .csv to allow me to calculate how changes on the shaders impact performance. It is pretty messy for now, and that will be improved next, but at least I have some code to work on now.

0
0
3

Followers

Loading…