Google Drive video link. (Not youtube b/c I was worried about compression making it unwatchable)
Writeup:
I originally based this tool on https://neuralpatterns.io/ tool. Although the name is a little icky, it is based on the idea of being able setup a custom convolution, and then performing a nonlinear activation function defined in WebGL code. However, I was obviously using WebGPU code. I originally built this out allowing user defined webgpu code, and (in the process attempted some simple highlighting for that code). But after doing this for a while, I realized that it just… wasn’t very fun to do this. And although it might’ve been technically kind of cool, it didn’t feel like enough of an improvement over the original neural-patterns website. Also I had been thinking more about visualizing (and better yet interacting) with pieces of code recently. I spent a bit of time poking around for how this could be done with something like this and realized that the answer to “how do I interact with something that is a generalized activation” was actually fairly simple. Just use splines. Because the amount of time that I had remaining in the project was a bit “lol, lmao” I did not in fact go back into my brain for the spline implementations I had made in past graphics courses, and just dug around for a simple interactive spline editor I could drop into the project. I picked https://github.com/jonathanlurie/canvasSpliner. (By the way, I apologize for the fact that sometimes its graphics are sometimes a bit glitchy if you zoom out. I probably should’ve gone with a different implementation or just made my own, I just didn’t have a lot of time to do so or to {look around, code that}.)
Oh btw, part of my initial apprehension that stopped me from going with splines was that I really didn’t want to have the spline code on the webgpu side which seemed like it might be bad for performance visa vi running it for every pixel every frame. Also, it didn’t seem great that splines generally have a variable number of points which seemed… not great for data transfer. So instead I just made a lookup table using the library’s .getValue method and lerped between the values in it.
After doing this, I realized that generating a fairly random activation function… often didn’t result in anything interesting and in the process of this remembered a remaining piece of the neural-patterns website: the ability to click and have cells come alive. Once I did that, if a simulation wasn’t interesting, I could often fix that by changing the activation function such that everything that was currently alive died, and then clicking in order to spawn new life that then propagated over the entire grid. [Noah’s Arc]-ahh strategy.
As a last quick detail, I realized that part of my implementation looking bland was the fact that the colors were always the same from run to run. So I yoinked the HSL to RGB from https://gist.github.com/mjackson/5311256, and dropped it into my code with minimal changes.