home *** CD-ROM | disk | FTP | other *** search
- ┌─────────┬────────────────────────────────┬───────────────────────────────┐
- │ Name: │ L-SYSTEM PARSER/MUTATOR │ (C) RenderStar Technology BV. │
- ├─────────┼────────────────────────────────┼──────────┬───────┬────────────┤
- │ Author: │ Laurens J. Lapre │ Version: │ 1.0 │ 1993-07-22 │
- ├─────────┴────────────────────────────────┴──────────┴───────┴────────────┤
- │ RenderStar Technology BV, Keizersgracht 448 │
- │ 1016 GD Amsterdam, the Netherlands │
- │ Fax (+31) 20 622 4939 │
- ├─────────┬─────────────────────┬───────────────────┬──────────────────────┤
- │ Email: │ 2:283/203.8@fidonet │ 'Lj Lapre' PCGnet │ │
- └─────────┴─────────────────────┴───────────────────┴──────────────────────┘
-
-
- Disclaimer
- ────────────────────────────────────────────────────────────────────────────
- This software is free and may be freely distributed, but is copyrighted by
- the company RenderStar Technology BV. This software is provided as is
- without any guarantees. The author and company assume no liability for
- damages, direct or consequential, which may result from the use of this
- software. The 'lparser.exe' file may not be used as part of any commercial
- package without the explicit written consent of the author or company.
-
-
- General
- ────────────────────────────────────────────────────────────────────────────
- An l-system is a rule like description of a 3d form. It contains
- descriptions of parts and how they should be assembeld together. The program
- reads a l-system description in and processes it into a 3d form which can
- then be outputed in several formats, including DXF and POV.
-
- The description is applied to itself a number of times (= recursion levels)
- so fractal and recursive forms are very easy to describe in an l-system.
- That's why they are used a lot for plants and natural looking organic forms.
- By increasing the recursion level the form slowly 'grows' and becomes more
- complex.
-
- This implementation of a l-system parser also allows 'mutations' to take
- place during the growing of the form. These mutations can change the form
- slightly or quite dramaticly. This allows you to create a form once and then
- create a whole series of forms all clearly 'descendant' from the original
- l-system.
-
- Too help people get started a lot of example l-systems and pov files have
- been included.
-
- The lparser.exe is a protected mode program using the royalty free
- Rational dos-extender (dos4gw.exe) supplied with Watcom 9. It needs a
- 386/387 or 486 with 4meg ram.
-
-
- Execute like this :
- ────────────────────────────────────────────────────────────────────────────
- lparser [options] [name]
-
- examples :
-
- lparser -x rcylin -d lsys03.ls
- lparser -v -t0.5 -u10 -i30000 -g lsys05
- lparser spider
-
- Name is an l-system file with the ls extension. It will standard generate a
- RenderStar compatible 'output.vol' file. Which can be shown and rendered
- directly in RenderStar with the command : rs2 l. The l.* files are
- RenderStar support files.
-
-
- Persistence of Vision (POV) output:
- ────────────────────────────────────────────────────────────────────────────
- Part off the pov file is setup by the user and the output.pov file is then
- attached to the user's file.
-
- -v make pov object file
-
- Generates a pov file format description. Only the body part of the file is
- generated with a series of a l_base objects and leafs as triangles. See the
- 'exam.pov' file for more explanation. One can change the object definition
- of the l_base element used in the l-system form to any one of the valid pov
- shapes as long as the shape can be scaled differently in all 3 directions.
-
- -b make pov blob file
-
- Instead of outputting objects, postionend components are written to the
- output.pov file. These can be used to create 'bloby' objects. See
- 'bloby.pov' for an example how to set this up. All triangles are skipped.
-
- -B make multiple pov blob files
-
- Each color part of the final form is written into its own output??.pov file.
- This allows you to have mutiple blob's each with its own color and material.
- See 'mbloby.pov' for an example. All triangles are skipped. The b*.pov files
- contain several different forms and setups done with pov's blob functions.
-
- -c output inc files instead of pov file
-
- The output files will now have the 'inc' extension for easier including in
- other pov files.
-
-
- DXF output:
- ────────────────────────────────────────────────────────────────────────────
- -d make dxf file (use with '-x cube' for fast dxf file writing)
-
- This creates AutoCad R12 polyline polyface meshes in dxf file format which
- can be used in Acad and 3DS. It's a much more efficient format then the
- 3dface format. It uses blocks and inserts. The most efficient dxf file (in
- size and write/load time) is generated with : lparser -x cube -d [name]. If
- you read the file into Acad12 make sure you have a new (no prototype) drawing
- since the file contains block definitions as well. The objects will have
- color and layer attributes set. By changing all object color attributes to
- BYLAYER one can use the layer overview for easy, by layer, color setting.
-
- -3 make dxf file
-
- This is a simple 3dface only dxf file format which will always work. It has
- no blocks or inserts but can become very large.
-
-
- Other options:
- ────────────────────────────────────────────────────────────────────────────
- -t [num] set minimum thickness
-
- This allows you to set the minimum thickness a form will get during
- recursive generation. It is to make sure the forms don't get too 'thin' to
- be seen and render correctly. It's typicly around 0.5 to 1.0.
-
- -u [num] mutate [num] times
-
- Mutate the l-system a number of times before starting the geometry generation
- fase and write the mutated l-system to disc as the file 'mutation.ls'. By
- re-using this file one can build mutation series of forms.
-
- -r [num] overrule recursion depth
- -a [num] overrule angle
-
- Overrule these values on the commandline. They are also set in the l-system
- file but they will not be used when an overrule option is used on the
- commandline. One can 'open' a form by starting with a angle of zero and
- increase it to the final angle. This makes nice animations. Doing the same
- with the -r option will slowly 'grow' the form into its final shape.
-
- -p [num] limit polygons to [num]
-
- Limit the total amount off polygons/objects outputed during the parsing of
- the final l-system production. After mutation the form may have grown very
- (VERY) large. The whole form could be inserted in each of its branches ! The
- default limit is 200.000 polygons/objects.
-
- -i [num] limit string length to about [num]
-
- Limit the length of the final production string. This is also a way of
- limiting the size and generation time of a form. When certain mutations
- occur the generating time can become very long. The -i option can limit this
- time. Use like : lparser -p50000 -i30000 lsys00. The default string limit
- is 500.000 chars. The program can handle final l-systems strings up to 1
- million chars.
-
- -x [name] use name.vol as base form
-
- Instead of a simple block a special object (*.vol) can be used as a base
- element. Example forms are ball, cube, cone, cylin8 (with 8 faces), cylin16
- (with 16 faces), rcylin (with rounded edges) and tube. This is for generating
- vol or dxf files only. Try : lparser -x ball lsys00. The changing of the base
- forms for pov output is done by the user in the pov headers. See *.pov for
- examples.
-
- -l show final L-string
-
- Prints the final l-system production to the screen. This is the final string
- which is then interpreted into a 3d form.
-
- -g add ground plane
-
- Adds a large ground plane (2 triangles) touching the lowest point of the
- form. This is for easy shadow projection and horizon.
-
-
- More info ...
- ────────────────────────────────────────────────────────────────────────────
- The book 'Evolutionary Art and Computers' by S. Todd and W. Latham was used
- to base the genetic 3d form mutation principles on. In here you'll find a lot
- of interesting ideas on how to 'grow' and 'evolve' organic looking 3d forms
- of your own.
-
- The implemented l-system is based on the one described in the book : 'The
- Algorithmic Beauty of Plants' by P. Prusinkiewicz and A. Lindenmayer (this
- is where the 'L' from l-systems come form). If you want more information on
- making your own l-systems you'll want to check out this book. A lot can be
- done by changing the l-systems suplied with the parser and seeing for
- yourself what changes in the final form.
-
- For this you can use the the following l-system files:
-
- From The Algorithmic Beauty of Plants:
-
- bop00.ls cordate leave pag 123
- bop01.ls plant pag 27
- bop02.ls bush pag 26
- bop03.ls form in 2d pag 25
- bop04.ls block form pag 20
- bop05.ls fractal pag 9
-
- Fractals from FractInt:
-
- fract00.ls 4 dragon curves
- fract01.ls space snake
- fract02.ls round triangle tiling
- fract03.ls pentagon tiling
- fract04.ls triangle tiling
-
- Free form experiments:
-
- lsys00.ls lobster form
- lsys01.ls " var 1
- lsys02.ls " var 2
- lsys03.ls " var 3
- lsys04.ls " var 4
- lsys05.ls spiral bush
- lsys06.ls tree base
- lsys07.ls half circle
- lsys08.ls " var 1
- lsys09.ls cello plant
- lsys10.ls circle form
-
- Mutations:
-
- mut00 - mut08 mutations of lsys00.ls
- mut09 - mut14 mutations of spider.ls
- mut15 - mut18 distant relatives of lsys02.ls
-
- Spiral forms:
-
- spiral00.ls overview of spiral types
- spiral01.ls spiral form
- spiral02.ls spiral tree
- spiral03.ls large spiral plant var 1
- spiral04.ls large spiral plant var 2
-
-
- Syntax
- ────────────────────────────────────────────────────────────────────────────
- For those who are already familiar with l-systems, here are the commands and
- their functions for this lparser's 'dialect'. All commands are 1 char only
- and simpler then for most lparsers. This is to keep them from getting
- 'broken' by the mutation process and speeds up the parsing.
-
- ┌─────────────────────────────────────────────────────────────────────┐
- │ Orientation commands │
- ├─────────────────────────────────────────────────────────────────────┤
- │ + turn left around up vector │
- │ - turn right around up vectos │
- │ & pitch down around left vector │
- │ ^ pitch up around left vector │
- │ < roll left around forward vector │
- │ > roll right around forward vector │
- │ | turn 180 deg around up vector │
- │ % roll 180 deg around forward vector │
- ├─────────────────────────────────────────────────────────────────────┤
- │ Movement commands when {} active │
- ├─────────────────────────────────────────────────────────────────────┤
- │ F move forward and draw full length record vertex │
- │ f move forward with full length record vertex │
- │ g move forward with full length don't record vertex │
- │ Z move forward and draw half length record vertex │
- │ z move forward with half length record vertex │
- │ . don't move record vertex │
- ├─────────────────────────────────────────────────────────────────────┤
- │ Structure commands │
- ├─────────────────────────────────────────────────────────────────────┤
- │ [ push current state │
- │ ] pop current state │
- │ { start polygon shape │
- │ } end polygon shape │
- ├─────────────────────────────────────────────────────────────────────┤
- │ Inc/Dec commands │
- ├─────────────────────────────────────────────────────────────────────┤
- │ " increment length │
- │ ' decrement length │
- │ ; increment angle │
- │ : decrement angle │
- │ ? increment thickness │
- │ ! decrement thickness │
- ├─────────────────────────────────────────────────────────────────────┤
- │ Additional commands │
- ├─────────────────────────────────────────────────────────────────────┤
- │ c increment color index │
- │ * reset color, thickness, length and angle │
- │ @ end of object │
- └─────────────────────────────────────────────────────────────────────┘
-
-
- This is an example of a simple form definition (spiral01.ls) :
- ────────────────────────────────────────────────────────────────────────────
- 20
- 10
- 100
- a
- a=Fs+;'a
- s=[::c!!!!&&[b]^^^^[b]]
- b=F!+F+;'b
- @
-
-
- This is an example of a complex form definition (spider.ls) :
- ────────────────────────────────────────────────────────────────────────────
- #-------------------------------------- "Octo Spider"
- #-------------------------------------- Header
- 15 # recursion depth level
- 10 # basic angle in degrees
- 60 # starting thickness in % of length
- C # axiom
- .-------------------------------------- Creature
- C=LABHT
- .-------------------------------------- Body
- B=[???????zZZZ]
- .-------------------------------------- Arms
- A=[zf&&&&&&&&&"""[pj>>>>>>>>>S]|[qj<<<<<<<<<S]]
- p=Ft+:'p # left
- q=Ft-:'q # right
- j=;"j
- .-------------------------------------- Claws
- S=['''!!r%^^r]
- r=[Z?Z?Zu] # claw assembly
- u=Z[co]!'^::u # claw tooth
- .-------------------------------------- Legs
- L=[c">>>>[s]>>>>[s]>>>>[s]>>>[s]>>>>>>[s]>>>[s]>>>>[s]>>>>[s]]
- s=+++li+++dccc??""FF # down legs
- l=Ft+:'l # upper leg
- d=FFF'd # lower leg
- i=;i
- .-------------------------------------- Head
- H=["">>>>>>>>>&&&&&&??FFFF!![???h][???k]%^^[??k]]
- k=[Z?Z?Za] # jaw assembly
- a=Z[co]!'a # jaw
- o=&&&&&&&&&!!!!!F # teeth
- h=[^^gcccc"Z][^^ecccc"Z] # eyes
- g=z!+z!+z!+z # left eye
- e=z!-z!-z!-z # right eye
- .-------------------------------------- Tail
- T=[f---------??""""""mccccF]
- m=Ft+;'m # curl
- t=['::c!!!&&[f<<<n]^^^^f>>>n] # spikes
- n=[c{--z++z++z--|--z++z++z}] # leaf
- .-------------------------------------- End
- @ # EOF marker
-