Log In  

Cart #picotron_smoke-0 | 2024-03-16 | Embed ▽ | License: CC4-BY-NC-SA
15

Yup, it's a smoke simulation toy for Picotron! Use your mouse to play. Should run at a nice steady 60fps after the first ~1s.

Uses userdata to make pressure projection steps almost free. That's great, since those steps were super-expensive in the PICO-8 version! Unfortunately, advection still has to be done with loops in userspace Lua code, and so that part didn't really see any speed increases, and is the new bottleneck.

There might still be some rendering tricks to speed this up, and I need to see whether some tricks I gave up on in the PICO-8 sim, like a MAC grid or vorticity confinement, might be viable here. Unfortunately higher-order interpolation, which I know would help a lot, is probably not happening without major new userdata features.

P#143262 2024-03-16 05:20

2

this is really cool! I added some color and auto-motion to make a screensaver version:

Cart #smokesaver-0 | 2024-03-16 | Embed ▽ | License: CC4-BY-NC-SA
2

P#143273 2024-03-16 08:30

is this using perlin noise or another algo?

P#143333 2024-03-16 17:00
1

@pancelor: That's awesome! Makes me wish I had gotten this to be higher-res :)

@merwok: It's pretty much following Jos Stam's Stable Fluids method: https://pages.cs.wisc.edu/~chaol/data/cs777/stam-stable_fluids.pdf / http://graphics.cs.cmu.edu/nsp/course/15-464/Fall09/papers/StamFluidforGames.pdf

P#143339 2024-03-16 17:15 ( Edited 2024-03-16 17:43)

@zep: I'm not sure what your goals for userdata are, but this is perhaps a somewhat interesting "real"-ish test case for generalizing to more complex systems.

I think what would be necessary to completely vectorize this is:

  • min/max (and ideally abs - required for e.g. vorticity confinement)
  • float->int conversions, or a fast way to do fixed point (shifts?)
  • indexing userdata with userdata

... I think those three things would make it possible to implement the backtracing/sampling step without explicit loops?

P#143437 2024-03-17 04:13
1

That looks awesome!

P#144486 2024-03-26 01:31
1

This is awesome. Hope you don't mind, but I borrowed your colour re-mapping code and wrapped it in a function to map a palette entry to any RGB value.

function rgb(colorNum,r,g,b)
 r,g,b=flr(r),flr(g),flr(b)
 pal(colorNum, (r<<16) + (g<<8) + b, 2)
 return colorNum
end
P#146437 2024-04-12 04:51

@ozjerry I'm glad you're finding that code useful!

P#146459 2024-04-12 15:49

[Please log in to post a comment]