Skip to content

Hypesio/Unity-L-System-Parsing-and-Interpretation-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity L-System parsing and interpretation tool

The goal of this project is to have a tool to parse and interprete L-System grammar that is easy to use and combine for any usage.

Parsing progress :

  • ✔️ Simple grammar
  • ✔️ Stochastic grammar (probability)
  • ✔️ Parametrical grammar
  • ✔️ Defines variables
  • ✖️ Context sensitive grammar

Vegetation Generation and destruction 🌳 💥

The only system actually available with this L-System tool can generate vegetation following the guidelines written in the paper The Algorithmic Beauty of Plants written by P. Prusinkiewicz, A. Lindenmayer.

The script allows to easily change rules and parameters. You can load or save preset using scriptables objects and save an object generated as a prefab in one click.

Improvement coming to vegetation generation

  • ➕ Include shapes
  • ➕ Textures

Generation examples

Simple bush and flower made with simple grammar Trees made with parametrical grammar Growing plant
LSystemSimpleBushAndFlower LSystem4SimpleTrees
plan_grow.mp4

Destruction

From the vegetation generation a data-tree will be made to represent the data. Each node represent a cylinder and hold triangles and vertex informations. It allows to easily find the node of a specific triangle when we hit the vegetation with a raycast. It doesn't "cut" the vegetation but will break at the closest previous intersection in the vegetation. It offers fast and simple way to break vegetation into pieces.

Before destruction After destruction Video of the process
destruction.mp4

How to use parser for your own scripts

    public int nbIteration;
    public string axiom;
    [SerializeField] public Rule[] rules;
    public Define[] defines;
 
    public string GenerateSomething()
    {
       string sentenceGenerated = GrammarInterpretation.ApplyGrammar(rules, defines, axiom, nbIteration);
       // ... Do your stuff with the sentence generated
    }

About

Easy to use Unity tool to parse and interprete L-System grammar

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors