Skip to content

gserena01/hw04-l-systems

 
 

Repository files navigation

L-systems Coral

Serena Gandhi (gserena)

Sample Images:

Using Defaults:

image

With Color and Decoration Size Change:

image

With Iterations and Angle Change:

image

The Tool in Action:

Homework.4_.L-System._.CIS.566.-.Google.Chrome.2021-11-10.08-00-51_Trim.mp4

How It All Went Down:

This project started with my inspiration, the coral. From here, I generated samples of my L-System grammar in the 2D L-System Visualizer (linked below) and in Houdini. Once my grammar was finalized, I moved on to coding.

Admittedly, I had to start and re-start this project, but my final version used the following pipeline:

First, I rendered out a single branch using the instanced shader. This helped me familiarize myself with instanced rendering, as well as ensure that, if my L-System is working properly, something will show up in my viewport.

Then, I started working on my L-System. I created Turtle, Expansion Rule, and Drawing Rule classes, which were all used in conjunction in the L-System Class. The Turtle class recorded and altered the current position and orientation of the "turtle." The expansion rule classes expanded the grammar I described, using some randomness. The Drawing Rule class selected drawing rules based on the provided grammar, using some randomness.

To start, I set my grammar to be two iterations of a simple "FF". This way, I could easily test whether my rules were working. Also, to start, I only included rotation in 2D.

Once my grammar was properly working, I added 3D rotation and expanded the grammar to the current version.

From here, I added the branch decoration and incorporated randomness in my grammar by adjusting each angle drawn by no more than 10 degrees in either direction (sampled on a curve, not uniformly, to ensure that larger angle changes are less common). I also added additional rules that could terminate the grammar with a branch decoration.

Next, I worked on the background, adding the various colors and animating them on a sine curve. I also added stripes to my tree shader for a little extra fun! The stripes are made using the current color's inverse, for a little extra POP!

Finally, I added the sand base and the gui elements to make my project a tool to make many corals!

Samples of L-System Using Tools:

2D L-System Visualizer:

image

Houdini:

Screenshot 2021-10-20 200324

Reference Images:

image

image

image

External Resources:

Using Callback Functions: https://stackoverflow.com/questions/14471975/how-can-i-preserve-lexical-scope-in-typescript-with-a-callback-function

L-System Visualizer: https://www.kevs3d.co.uk/dev/lsystems/

Color Palette: https://icolorpalette.com/color/ocean-blue

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 91.6%
  • GLSL 6.5%
  • JavaScript 1.1%
  • HTML 0.8%