by timtimmy · 6y ago · 0 comments
Yesterday I got 0.5 million boids simulating in Unreal Engine at 45 fps on a GTX 1080 [0]. The bottle neck is rendering so many instanced cone meshes, the simulation without rendering can do 1 million boids at 120 fps. I'm borrowing a common data structure used in GPU fluid simulations, the dynamic hashed grid, to calculate the neighbourhood of each boid (cool tutorial here with full source code [1]). We need the neighbourhoods to calculate their urges. My code is a mess at the moment, but if there is interest I can post it to GitHub (Unity and Unreal).
Boids are an example of agent-based modelling and swarm systems. I used agent-based modelling in my PhD thesis to construct and simulate realtime, interactive 3D biomolecular models of mitochondria and neuromuscular synapses [2,3]. Now that I'm free (graduated), I'm building an iPad app to teach and communicate structural and molecular biology with immersive, and realtime simulations. Our vision is to make molecular and structural biology immersive and fun. It's not a textbook, it's a little more like Neil Stephenson's young lady's illustrated primer! :D
[0]: https://twitter.com/timd_ca/status/1243941167005192192?s=20
[1]: https://wickedengine.net/2018/05/21/scalabe-gpu-fluid-simula...
Sorry it's just this kind of thing pushed my buttons. I see someone showing their engine and claiming perf when their example is 99.999% GPU and 0.001% anything to do with their engine.
Did 10,000 to 20,000 agents at 60 fps. Puny compared to yours, but not bad for 14 years ago! https://www.youtube.com/watch?v=Jpy5rJSVLj8 https://www.youtube.com/watch?v=ZZoy-8xK0YI
It's unrelated to boids, but I would not recommend using the Poly6 and Spiky kernels. That design originates from "Particle-based fluid simulation for interactive applications" (2003) by Müller et al., and they choose the spiky kernel on the assumption that a zero gradient at the origin is the reason why particles sometimes get stuck together. However, the clumping phenomenon was more closely studied by Dehnen and Aly in "Improving convergence in smoothed particle hydrodynamics simulations without pairing instability" (2012) [https://doi.org/10.1111/j.1365-2966.2012.21439.x]. They showed that you can predict pairing instability based on neighbour count, and that kernel functions that are everywhere positive within the Fourier domain do not exhibit that instability.
The Wendland family of kernel functions are thus recommended, as they fulfill that criteria. Though, for low neighbour counts a quartic B-spline is a good alternative.
Also, congrats on escaping--err... graduating!
Amazing work! LifeBrush is Emacs for Cytoplasm! I've read that those little thing-a-ma-bobs in your cells move around at something like 30 miles an hour, bumping into each other. Is that accurate? Does that simulation show them slowed down a lot? Would it just be a blur in real time? Is that software available, please?
My simulation is inaccurate in terms of Brownian motion. It is slowed down and smoothed for illustrative purposes. It should be more violent. Nice idea with blurring, I'll think about that. The code is on GitHub. It requires a VR headset, and it is frankly a little clunky and "research code" in terms of the UI. But check it out :D [1]. The next version will support larger simulations on the GPU and a more friendly UI. I have friends at the Scripps institute who work on similar stuff, check them out [2].
[0]: David Goodsell (2009) The Machinery of Life https://www.amazon.ca/Machinery-Life-David-S-Goodsell/dp/038...
I really love the part in your interactive simulation overview, at 2:58:
LifeBrush - An overview of our illustrative simulation canvas
https://www.youtube.com/watch?v=5LBHRyGxLGI
2:58> The ribosome uses tRNA to match mRNA codons to amino acids. We paint a cloud of tRNA near the ribosome. tRNA, molecular agents, need amino acids. So we paint a cloud of of amino acids nearby. Brownian motion brings tRNA and ribosomes together. But that takes a long time. However, our system is interactive and immersive. So we grab the ribosome and move it around. Now we see how the ribosome marches along the mRNA, with tRNA depositing amino acids onto a growing poly-peptide chain in blue. We reach the end of the mRNA, and the mRNA and poly-peptide chains are released.
So in order to avoid waiting for brownian motion to do its thing over time, you just grabbed the ribosome's lazy ass and dragged him over near the mRNA, then threaded it into his jaws, and waved him around through a cloud of amino acids and tRNA to feed him, so he sucks up the tRNA pasta and mRNA meatballs and amino acid sauce, just like Lady and the Tramp eating spaghetti to Bella Notte, and then he pumps out useful proteins, just like the Golden Goose.
Lady and the Tramp (1955) Scene: 'Bella Notte'
https://www.youtube.com/watch?v=XNQWbZ9sO3Q
The immersive interactivity is (in a good way) like the Libertarian wet dream wish-fulfillment of the invisible hand of unobservable market forces, or the Intelligent Design pseudo-scientific fantasy of God directly intervening in the affairs of molecules! Ribosomes could be the next Tamagotchi! ;) Ribosomegotchi?
You obviously know this stuff well, but I want to mention that your videos "LifeBrush: Discrete element texture synthesis overview" and "LifeBrush: Bunny-planet design session" using Greg Turk's Stanford bunny impress me as an homage to his work on mapping bunnies with 2d textures, and Andy Witkin's work on reaction-diffusion textures, and also looks inspired by the Photoshop smart clone tool.
LifeBrush: Discrete element texture synthesis overview
https://www.youtube.com/watch?v=624F5iaCKco
LifeBrush: Bunny-planet design session
https://www.youtube.com/watch?v=L482dpH9S8o
Greg Turk
https://en.wikipedia.org/wiki/Greg_Turk
Stanford Bunny
https://en.wikipedia.org/wiki/Stanford_bunny
Andy Witkin
https://en.wikipedia.org/wiki/Andrew_Witkin
Andy Witkin's gallery
https://www.cs.cmu.edu/~aw/gallery.html
Reaction Diffusion Textures. (animation) 1991. Nonlinear partial differential equations as a means of artistic expression. Shown at SIGGRAPH '91 electronic theater. mpeg (209K).
https://www.cs.cmu.edu/~aw/mpg/rd.mpg
Reaction Diffusion Textures. 1991, with Michael Kass. Nonlinear partial differential equations as a means of artistic expression. This image won the Prix Ars Electronica '92 grand prix for computer graphics. postscript. pdf. citation.
https://www.cs.cmu.edu/~aw/pdf/texture.pdf
Using Particles to Sample and Control Implicit Surfaces. 1994, with Paul Heckbert. Quasi-physical particles that float on an implicit surface. We use mutual repulsion and fissioning to quickly obtain a good sampling of the surface, and to maintain it as the surface deforms. postscript. pdf. citation. mpeg(23K). BIG mpeg (868K.)
My neighbourhood implementation is the naive n^2 loop, so it's probably trivial to make it better. Quadtrees, or even just simple caching / zoning would probably allow me to dish out many more boids.
It also doesn't help that in order to be easy as a workshop, it's written in a way that's easy to implement, but slow to execute.
https://www.youtube.com/watch?v=Oh2oF-eZTD8&list=PLrBjj4brdI...
Your Bunny Planet design session really illustrates how wonderfully your work applies to computer games:
https://www.youtube.com/watch?v=L482dpH9S8o
https://www.youtube.com/watch?v=624F5iaCKco
Chaim Gingold (one of the developers of Spore) made "Earth: A Primer", a cool interactive educational simulation science book, also like your work, inspired by Neil Stephenson's young lady's illustrated primer, but on a somewhat different physical scale:
>Earth: A Primer is a science book you play with.
I sent Chaim some links to your work, and he loved it and said he has collaborator who will be delighted to learn about it too. He also teaches computer game design, and did his PhD thesis on "Play Design". You should work together, and fill in all the levels between planets and cytoplasm! ;)