https://github.com/hypesio/unity-l-system-parsing-and-interpretation-tool
Easy to use Unity tool to parse and interprete L-System grammar
https://github.com/hypesio/unity-l-system-parsing-and-interpretation-tool
destruction l-system unity unity3d-plugin vegetation
Last synced: 26 days ago
JSON representation
Easy to use Unity tool to parse and interprete L-System grammar
- Host: GitHub
- URL: https://github.com/hypesio/unity-l-system-parsing-and-interpretation-tool
- Owner: Hypesio
- Created: 2022-03-16T15:39:59.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-07T16:30:33.000Z (over 3 years ago)
- Last Synced: 2025-03-16T14:49:26.654Z (about 1 year ago)
- Topics: destruction, l-system, unity, unity3d-plugin, vegetation
- Language: C#
- Homepage:
- Size: 24 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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 :
- :heavy_check_mark: Simple grammar
- :heavy_check_mark: Stochastic grammar (probability)
- :heavy_check_mark: Parametrical grammar
- :heavy_check_mark: Defines variables
- :heavy_multiplication_x: Context sensitive grammar
## Vegetation Generation and destruction :deciduous_tree: :boom:
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
- :heavy_plus_sign: Include shapes
- :heavy_plus_sign: Textures
#### Generation examples
Simple bush and flower made with simple grammar | Trees made with parametrical grammar | Growing plant
:-------------------------:|:-------------------------:|:-------------------------:|
 |  |
#### 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
:-------------------------:|:-------------------------:|:-------------------------:
|
|
## How to use parser for your own scripts
```csharp
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
}
```