Code Monkey home page Code Monkey logo

3d-cellular-automata's Introduction

3D Cellular Automata

deploy

Live Demo of website here.

3D Cellular Automata

This is based on the youtube video by Softology. The article written by them can be found here, and their video linked below.

3D Cellular Automata

Explanation

Cellular automata involves updating a 3D grid of cells based on specific rules.

  1. Depending on the number of surrounding cells it can either:
    • Resurrect a dead cell
    • Kill a living cell
  2. Cells which have died will decay in multiple steps from alive to dead called the refractory period. Here the cell is:
    • Unable to be resurrected
    • Unable to be killed
    • Gradually goes from alive (1.0) to dead (0.0) in increments
  3. We can count the number of surrounding cells differently
    • Moore neighbourhood considers all surrounding 26 cells
    • Von Neumann neighbourhood considers the directly adjacent 6 cells

Using these rules we can get interesting patterns.

A more detailed explanation can be found here at Softology's article.

Instructions

  1. Press run to begin the simulation.
  2. You can pause, reset, and randomise the simulation.
  3. In the rules panel you can change it to a different cellular automata rule in realtime by clicking on them.
  4. In the randomiser panel, you can change how the world is populated.
    • Radius absolute places a blob in the middle with radius in blocks.
    • Radius relative places a blob in the middle with radius as a fraction of maximum radius.
  5. To change how the world is rendered you can change the parameters in the graphics panel.
    • You can select different colouring schemes.
    • Update the shader parameters in realtime.
    • To speed up the simulation you can disable rendering and re-enable it later.
  6. Use the size controls panel to adjust the width, length and height of the simulation.
    • For large sizes this can become very computationally and memory intensive.
    • For a 1024x1024x1024 with 1.07 billion cells it will use 4.29GB of VRAM.
    • VRAM usage = 4xyz bytes.
    • The volume data is stored in two 3D textures with red and green 1 byte channels.

The simulation is computed and rendered using webgl shaders. Therefore having a more powerful graphics card will enable higher simulation speeds.

Gallery

alt text

Default rules

445 678 678 Amoeba
445 678 678 Amoeba
Builder 1 Builder 2 Clouds 1
Builder-1 Builder-2 Clouds-1
Crystal Growth 1 Crystal Growth 2 Pyroclastic
Crystal-1 Crystal-2 Pyroclastic
Slow Decay Spikey Growth
Slow Decay Spikey Growth

Combining rules

You can also switch between the rules while it is running, which can create interesting patterns.

Crystal Growth 1 to Crystal Growth 2 445 to Crystal Growth 1
Crystal growth 1 to 2 Crystal growth 1 to 2

Build instructions

  1. Clone the repository and cd into it
  2. npm install
  3. npm run start

3d-cellular-automata's People

Contributors

williamyang98 avatar

Stargazers

Jonathan Conlin avatar  avatar Elie Makdissi avatar 崔善柱 avatar  avatar Shinichiro Kuwahara avatar fedix avatar Leonardo d'Angelico avatar Ilya Oleynikov avatar Viraj cz avatar  avatar  avatar Kevin Saltarelli avatar Şiyar Bahadır avatar Bruce Wayne avatar  avatar Colin Tenaguillo avatar  avatar exitsimulation avatar  avatar huang825172 avatar Marcello Fabrizio avatar Filippo Donati avatar Nick Chow avatar Tomáš Křen avatar Simon Shi avatar Tadej Fius avatar memolamogolloni avatar  avatar Kyle Weise avatar  avatar  avatar Griff avatar Felix Yu avatar  avatar Ego Alpha avatar Nicholas Williams avatar doodlewhale avatar Rob Maccallum avatar YujieWang avatar Mathias Gatti avatar Nux avatar  avatar Martin Milan avatar Jeremy avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.