Growing Neural Cellular Automata Differentiable Model of Morphogenesis

39 views
Skip to first unread message

Dan Wills

unread,
Feb 13, 2020, 5:26:32 AM2/13/20
to reaction-...@googlegroups.com
G'day!
Haven't read very far down the page yet but even just playing with the live embedded example at the top was fascinating! Golly gosh I'm Ready for this! ;D

(It's double-click to put down seed points, drag to erase)


Amazing, I love how some of them (butterfly, say and with nonzero rotation) can keep changing quite dynamically for ages! I got the spiderweb one to generate some fronts that grew out leaving webby trails, delightful!

As an initial step towards perhaps one day being able to run things like this in Ready, what would be involved if we wanted to add an rgb-valued cell mode? Guess you could kinda think of it as just a special way to display 3-reagents of a regular simulation.. but maybe it might be more efficient to actually make the cell values vectors while simulating? Could even make it RGBA while we're at it, and composite the reagents in a stack (that you can order, like photoshop layers?) vector4's should go pretty well under OpenCL I reckon. My mind is drooling at the possibilities :).

Hope you find it interesting too! :D
Have a choice one,
Dan



Tim Hutton

unread,
Feb 13, 2020, 11:31:00 AM2/13/20
to reaction-...@googlegroups.com
Hi Dan,

Could your Houdini stuff interpret three chemicals as RGB for rendering?

Ready currently uses float4 by default (do Action > View Kernel on a formula rule in an image-based pattern like heat_equation.vti) in a block pattern of 4x1x1. This means that each kernel call works on 4 horizontal-neighboring cells at a time, for speed.

For more options, see the kernel element: https://gollygang.github.io/ready/Help/formats.html#kernel

So inside the kernel, when you get the current block ( float4 a = a_in[i_here]; ) you could treat those four floats (a.x, a.y, a.z, a.w) as the RGBA values for a single cell and do the update based on those. To support this we'd need a way to render (e.g. mapping [0.0, 1.0] onto [0, 255]) a single chemical image as a color image at a smaller size (divided by the block size). For example, with a block size of 4x1x1, a single chemical image of 1024x256x1 would be rendered as a 256x256 color image.

Alternatively you could have four chemicals and then (a.x, b.x, c.x, d.x) would be your RGBA values for one cell. We'd need to add a way to render those four channels as a single color image (of the same size in this case).

The downside of both of these approaches is that the CA has to store its data in the RGBA colorspace. A more general approach might be to allow kernels to write char4 RGBA values directly into an output image, using an extra parameter to the kernel function. This would free up the CA to represent the data however it wanted, and would support any complex mapping you could imagine, defined by the user in the kernel code. It would also allow you to render e.g. Gray-Scott with whatever color mapping you fancy. I think we spoke about this idea once but making things look pretty has never been my focus with Ready.

Tim



--
You received this message because you are subscribed to the Google Groups "reaction-diffusion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reaction-diffus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reaction-diffusion/CAKnjVK2DpUPZp18Xkcq%3D2%2BQNdfwrpG%3D478daKUdOsW4XzSSwUg%40mail.gmail.com.


--

Dan Wills

unread,
Feb 15, 2020, 4:49:38 AM2/15/20
to reaction-...@googlegroups.com
G'day Tim,
Thanks heaps for your thoughts! I really appreciate hearing your perspective on this.

You're absolutely right I can do this type of mapping in Houdini, but I'm always keen to see if we can do things that might make Ready more useful and fun to play with for those with a taste for RDs/CAs. I don't think we would want it to get too big, but I do reckon a couple more capabilities might potentially make it a lot more flexible and powerful in terms of what can be visualised, both from a scientific/academic perspective and also creatively. The limitation that all reagents are fit using the same max/min could be easily lifted with a customisable colouring method as you described. I think it's a great idea!

I really liked the sound of the last option you described where (with an option enabled, say) the kernel could be allowed to write to an additional rgb(a) output buffer as part of its execution. I agree that sounds like it would be a very flexible and powerful way to do things. Perhaps this could even be done similarly to 'Formula' mode, where there is an additional block of user-provided code with a standard kind of globals/input context and expected output vars-to-write-to that could be inlined in a similar way that the formula does, to do the colouring part? That would be really really cool!.

I agree that forcing reagent values to be directly expressed as being in the RGBA color space would be a pretty severe limitation that you wouldn't want to impose generally. I think it might work well for formulas similar to the one in the url I posted, but that's a bit of an outlier in terms of how it works with pixel values directly. Also it's merely a special (simple) case under the general coloring solution that you proposed: Just copy 4 reagents into R, G, B and A.

It sounds like something I might be able to start blocking out, perhaps with some assistance from you if I get stuck. If you're ok with trying the idea I'll make a branch and get tinkering! :D
Have an ace one mate! :)
Dan

Reply all
Reply to author
Forward
0 new messages