All Projects → nylki → aframe-lsystem-component

nylki / aframe-lsystem-component

Licence: MIT license
L-System/LSystem component for A-Frame to draw 3D turtle graphics. Using Lindenmayer as backend.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to aframe-lsystem-component

ofxLSystemGrammar
openFrameworks addon that implements most of the string rewriting grammars described in the book "The Algorithimic Beauty of Plants"
Stars: ✭ 36 (+9.09%)
Mutual labels:  lsystem, turtle-graphics
Dungeontemplatelibrary
🌏: Dungeon free resources (terrain & roguelike generation)
Stars: ✭ 595 (+1703.03%)
Mutual labels:  procedural-generation, fractal
DrawSpace
Space-game oriented rendering engine
Stars: ✭ 20 (-39.39%)
Mutual labels:  procedural-generation
aframe-globe-component
3D Globe data visualization component for A-Frame
Stars: ✭ 27 (-18.18%)
Mutual labels:  aframe
forma
A Lua toolkit for computational geometry on a grid
Stars: ✭ 34 (+3.03%)
Mutual labels:  procedural-generation
caves
2D Cave Exploration Game with Procedurally Generated Levels
Stars: ✭ 29 (-12.12%)
Mutual labels:  procedural-generation
CellForest
A cellular-automaton forest simulation set to live data-driven music.
Stars: ✭ 19 (-42.42%)
Mutual labels:  procedural-generation
aframe-fit-texture-component
A fit-texture component for A-Frame VR.
Stars: ✭ 22 (-33.33%)
Mutual labels:  aframe
aframe-resonance-audio-component
🅰️ Google Resonance Audio (omnitone) for A-Frame
Stars: ✭ 33 (+0%)
Mutual labels:  aframe
iterated-function-systems
Iterated Function Systems fractals with OCaml.
Stars: ✭ 33 (+0%)
Mutual labels:  fractal
landscape
Procedural landscape
Stars: ✭ 17 (-48.48%)
Mutual labels:  procedural-generation
poisson-disk-sampling
Poisson disk sampling in arbitrary dimensions
Stars: ✭ 147 (+345.45%)
Mutual labels:  procedural-generation
aframe-bmfont-text-component
A-Frame component for rendering bitmap fonts.
Stars: ✭ 62 (+87.88%)
Mutual labels:  aframe
Road-Generator-Unity3d
Procedural road generator for Unity3d
Stars: ✭ 33 (+0%)
Mutual labels:  procedural-generation
virtual-reality-tour
📍 Virtual reality travel in Google Street View.
Stars: ✭ 34 (+3.03%)
Mutual labels:  aframe
gpu mandelbrot
Interactive Mandelbrot set on GPU with Python
Stars: ✭ 33 (+0%)
Mutual labels:  fractal
civarium
isometric software vivarium that simulates a mini civilization
Stars: ✭ 18 (-45.45%)
Mutual labels:  procedural-generation
voxigen
Voxel handling library for game development, threaded generation/io/meshing with openGL rendering.
Stars: ✭ 47 (+42.42%)
Mutual labels:  procedural-generation
aframe-keyboard
An Aframe component that renders a fully functional 3D keyboard, that works on mobile, desktop browers, and VR headsets!
Stars: ✭ 23 (-30.3%)
Mutual labels:  aframe
aframe-speech-controls-component
alternative form of inputs for in-VR interaction with the content of a scene
Stars: ✭ 13 (-60.61%)
Mutual labels:  aframe

aframe-lsystem-component

A L-System component for A-Frame which use the L-System library lindenmayer as backend. It renders L-Systems via the turtle graphic technique to create procedurally generated geometry.

Properties

Property Description Default Value
axiom (string) Initiator/initial string/axiom. 'F'
productions (string) Productions from:to. Separate by acomma. eg: productions: F:FF, X:F+X+F 'F:F'
iterations (int) How many times the productions should be applied 1
angle (number) Degree change to apply for rotation symbols like, +, -, >, < etc. 45.0
segmentMixins (list) For any symbol you want to be rendered, you need to assign them mixins here. Let's say you want F and X to be rendered, then you could write segmentMixins: F:blue line X:big sphere. You may define multiple mixins per symbol if you plan to use ! and ' in your L-System to increment/decrement the mixin index, which directly relates to your segmentMixins. Eg. F: red line,blue line,green line with an Axiom F!F!F will produce exactly three lines with those colors. Be sure though to actually define mixins you want to use in you assets. Take a look at some of the examples to get a better idea how this works, eg. the multi-mixin example.
scaleFactor (number) If you use ! and ' in your L-System (see also segmentMixins above), this factor controls the size decrease/increase of subsequent segments. 1.0

advanced properties

Usually you don't need to touch the following, but in some situations, you might need or want to.

Property Description Default Value
translateAxis (string) 'x', 'y' or 'z', defines the axis on which to translate along when adding a segment (or moving the turtle via lowercase symbols of segments). Changing this to 'x' is often necessary if you 1:1 copy examples from a textbook. 'y'
mergeGeometries (boolean) Set false if you want an Object3D per segment. Degrades rendering performance when false! true

Usage

A very basic L-System entity could look like:

<a-entity lsystem="axiom: F; productions: F:F-F++F angle:40 iterations:3 segmentMixins: F:line"></a-entity>

Please refer to the examples for some practical usage examples.

If you want to learn more about L-Systems in general, I recommend the overview article at wikipedia. And if you want to dive deep in, you can read the Algorithmic Beauty of Plants, the classic by Aristid Lindenmayer and Przemyslaw Prusinkiewicz.

In case you are already familiar with L-Systems or turtle graphics, here is a list of all supported symbols and their interpretation in this component:

  • + rotates Y around defined angles
  • - rotates Y around defined -angles
  • & rotates Z around defined angles
  • ^ rotates Z around defined -angles
  • \ rotates X around defined -angles
  • < rotates X around defined -angles
  • / rotates X around defined angles
  • > rotates X around defined angles
  • | rotates Y around defined 180 degree
  • ! increments segment index (next segmentMixin per symbol if defined). Also applies scaleFactor to next segments.
  • ' decrements segment index (previous segmentMixin per symbol if defined). Also applies 1.0 / scaleFactor to next segments.
  • [ starts branch
  • ] ends branch

Besides those turtle graphic symbols, you define your own symbols like F for drawing actual geometry like lines or flowers. However if you want your symbol to be rendered, you need to define an entry in segmentMixins, like so:

<a-entity lsystem="axiom: A; productions: A:A+B; segmentMixins: A:line B:blue sphere"></a-entity>

Be sure that you define your mixins in your <a-assets> at the beginning of your scene. A fallback geometry and material if you don't define your segmentMixins is not yet implemented, but will be soon :)

It's also possible to use context sensitive productions like:

<a-entity lsystem="axiom: AABC; productions: A<A>B:A+A segmentMixins: A:line B:small line C:big line"></a-entity>

Parametric and stochastic productions are not yet implemented in the component. Native JS function parsing for productions, as the backend library allows, might added to this component, but is not yet done.

Please take a look at the examples to get an idea how to use the component. PRs are welcome! :)

Browser Installation

Install and use by directly including the browser files:

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script>
  <script src="https://raw.githubusercontent.com/nylki/aframe-lsystem-component/master/dist/aframe-lsystem-component.min.js"></script>
</head>

<body>
  <a-scene>
  
   <a-assets>
     <a-mixin id="line" geometry="primitive: box; height: 0.2; width: 0.4; depth: 0.2;"></a-mixin>
     <a-mixin id="blue" material="color: #45b5c8;"></a-mixin>
   </a-assets>
    
    <a-entity lsystem="axiom: F+F; productions: F:F-F++F" segmentMixins: F:blue line></a-entity>
    
  </a-scene>
</body>

NPM Installation

Install via NPM:

npm install aframe-lsystem-component

Then register and use.

require('aframe');
require('aframe-lsystem-component');
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].