Log In  


Updated: much higher res at 60fps, thanks to indexed userdata copies!

Cart #picotron_smoke-2 | 2024-10-18 | Embed ▽ | License: CC4-BY-NC-SA
23

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.

23


3

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
3


is this using perlin noise or another algo?


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


@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?


1

That looks awesome!


2

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

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



[Please log in to post a comment]