We created a Blender addon that uses L-Systems with flexible (programmable) interpretations to generate 3D models.
Git link: https://git.impa.br/rodrigo.loro/s3d_blender.
Barnsley fern is the 2D L-System $B = (w_0, R)$ defined by the starting word $$ w_0 = (X) $$ and the set of rules $$ R = \{(X \to F+[[X]-X]-F[-FX]+X), (F \to FF)\}. $$ In the standard interpretation:
With a couple of iterations, I got the following result:
The script handles L-Systems as a separate entity from it's interpretation. If we just exchange $F$ in the example above for
We get the following:
A Turtle is an object that reads the instructions and converts them to a mesh - walking in 3D space. Instead of changing the instructions of each L-System to rotate while walking forward, for example, we can extend a standard Turtle to do this.
The following two animations were generated with fixed L-Systems - the only variable parameter is the angle given to the rotation Turtle.
OBS: An interesting application for this is finding angles that maximize some property. For example, if we put the camera above the Barnlsley fern we can try to maximize the light exposure of the leafs.
Given a force field $f: \mathbb{R}^3 \to \mathbb{R}^3$, the interaction is applied whenever the turtle walks forward. Here are some examples:
Definition. Given $w, h \in \mathbb{N}$, a cell can be defined as the 4-uple $$(x, y, z, t) \in V = [1:w] \times [1:h] \times \{0, 1\}^2.$$
Definition. Two cells $a$ and $b$ are called adjacent iff $$\sum_{i=i}^4 |b_i - a_i| = 1.$$
Definition. Let $K_A$ be the set of 2-subsets of $V$ that contains all the pairs of adjacent cells.
Definition. A 4D maze is a graph $G = (V, E)$, in which $E \subset K_A$.
To generate the maze, we used the depth-first search algorith, which can be generalized to n=4 dimensions.Temporary gdrive link: https://drive.google.com/file/d/1POdyHD3Q68goH9EnpdoN4Uscfwu9hkvz/view?usp=sharing
Usually, the player can only walk on the edges of the graph that represents the maze. However, our script can place destructible walls in place of the standard inner walls with a configurable probability.
In the example bellow, the chance of placing a destructible wall was set to 1/2.
An explosion is triggered when the player clicks on a fragment of a wooden wall. To make this animations, we used Unity's physics and particle systems.
The following video showcases the obstacles used to keep the player walking only on the edges of the graph that represents our maze:
In order to move to an adjacent cell in the 4th axis, the player must enter a portal. To differentiate a cell with t=0 from a cell with t=1, we painted the stone walls of the latter red. Note that the portal only works one way.
To draw the corresponding cell in the portal, an auxiliary camera that renders to a texture was used.
In the next video, we placed a cylinder that follows the auxiliary camera, so that the reader can see the tracking system in action. Note that the portal texture is updated every frame, which means that animations can be seen thru portals aswell.
Different values for $w$ and $h$ can be used to scale the maze. In the following video, we present an example with $w=15$ and $h=20$:
Currently, the number of dimensions can only be switched with code commentaries. This issue will be adressed this week.
Since this is an academic project, many gameplay and playability concepts weren't implemented. A few of them are listed bellow: