LSystems


#21

Some more work done on the scripts (originally created by Zuzzabuzz) I have been playing with. Zuzz, feel free to add any of it that you want to the scripts you are working on. I was bored and stuck away from my home computer… so I tinkered. :shrug:

Added and Fixed:
-Function to grow axiom (initial symbol state) into final lcode based on defined rules and iterations.
-Above function will choose randomly from available growth rules assigned to a symbol (a->aa OR a->ab). Many options may be defined, one can be more likely to occur if it is defined more than once.
-Documented new code and features.
-Fixed lcode to produce smoother curves when not involved in branching.
-Fixed source mesh mangling. Selected polygons will not be rotated or moved by the script currently.

Not done:
-Will not read anything (rules, axiom, settings, lcode) from file.
-Error checking is still very minimal.
-Early termination not supported. Don’t set iterations too high (6 is the most I tested and I have see 4 crash modeler), and do not operate on too many polygons at the same time.
-Will not output anything to file (but the object created can be saved).

Attached (should be) is an images and the (for me) updated script. The image started out as a cube. All polygons were selected and the iteration count in the script was set to six. Took modeler less than four minutes to compute. Render in layout took less than 15 seconds. In the structure you can see random selections made by the rules during generation (compare branching to non-branching areas).

Darn. The image was too big to attach. I will have to set it up with a link and won’t be able to do that until late Tuesday (December 21st). But it is a nifty image… :sad:


#22

Argh! More stuff to integrate. I’m glad you’re out for a week. Now I can catch up.

The rotation is still faulty in this script, but I’m getting there…I think. I’ve plugged in the previous version of SirReality’s parser…changed the vocabulary (added a help tab detailing the commands). Added the GUI code, so now you can tweak stuff within lightwave, rather than in a text editor. It can now handle polygons with 3 or more points. It has variable scaling that works “ok”. Should allow for consistent results regardless of polygon size. Fixed some bugs in my original script. It will operate on one or more selected polygons(thanks SirReality). if no polygons are selected, it will clear the layer and create a base polygon to work with (good for debugging/experimenting. Thanks for the idea/code SirReality)

Despite the rotation issues, it’s still fun to play with. Press ESCAPE to abort it while it’s running. Enjoy.

Going to shift into math-brain over Christmas break and fix these issues, but if anyone wants to spare me some pain, that’d be great. I need to keep track of my relative axes (Forward, Left, Up). I plan to use the polygons initial normal to help determine these. I need a way to figure out the perpendicular vectors… need a non-paradoxical way of determining “up” and “left” (much the way people laying on sides of hills, suspended from cables, or in stunt jets do. :slight_smile: )

Here is the link to the file.


#23

Well, maybe I can save you some headaches…

Attached is the lsys script with the GUI with the following additions:
-load axiom from file (axiom file is chosen with the setaxiom.ls)
-load rules from file (rule file is chosen with the setrule.ls)
-lcode is generated from axiom, rules, and the iteration setting

Also included in the zip:
test.axi - sample axiom (starting state for the l-system)
test.rul - sample rule set (more symbols and rules may be added)

test.rul breaks down as follows:
#a <- this line defines a symbol and is begun with the “#” character
[+Fa]-Fa <- this line defines the first rule, only one rule must be defined

test.axi and test.rul were created with notepad in windows. Any text editor should work.

Lscript is sorta funny about a few of the things I had wanted to do and the three scripts were what I did for a quick work-around. I don’t have any new nifty pictures to include at this moment.

Create your own axioms! Create your own rules! Have fun while these scripts get spiffied up and Zuzzabuzz’s idea becomes a cool addition to any lightwaver!


#24

Thanks for the integration. I’ll check it out.
Here’s a little something I made, with the recipe included (sort of)

Made minor changes to the version I posted last night:
You can get the file here.


#25

From the other evening:

And something new:

The above snow-flakey looking object was created with the axiom and rule files attached. Iterations were set to 5 and the length ratio was 200. I did a merge points after the lsystem script finished running and deleted one polygon.

The scripts work quite well at the moment with geometry in the “right” viewport and using the + and - lcode commands. Work is ongoing to improve results with the other bending commands.

If you use these scripts please post questions or images here! We would love to see other things these scripts are used to create and would be more than happy to answer questions. Also, if anyone is an LScript rotate-around-normal programming diety we might have a couple of questions for you! :smiley:


#26

More cheese. The following demonstrates rules with more than one option. The script had a choice of “branching” one way or the other, plus this randomness was used to add “wiggle” to the somewhat straight parts. Attached is the axiom and rule file. Iterations were set to about 5 and the angle was 10-ish. It was applied to an eight-sided disk with two segments.

I know… chrome balls push 3D technology back to the stone age. But, come on, admit it. They really are fun sometimes. :argh: And I did use a little radiosity in the image when I rendered it… One of these days I’ll find something good and post an image as classy as Buzz’s “S”.


#27

Maybe a nice tutorial with some examples would be good, because I have no idea how to do interesting things with this plugin … I couldn’t even get the iterations to work :stuck_out_tongue:


#28

Karma,

You are absolutely right, a tutorial is a must. I will try to put something together today. I don’t know how long the tutorial will stay relevant because the scripts are changing pretty quickly right now. Buzz works on part of it and I’ve done work on other parts and this has resulted in two flavors of the script until it all gets integrated together. The tutorial I write will cover the scripts in the lsys20.zip. I will need to cover the following:

-Installing all needed scripts.
-Some quick basic terms.
-Axiom file.
-Rule file.
-Running the scripts.

Hopefully after I have that online it will be easier to get useful behavior from these scripts.


#29

I sneak in too! :wink:

I didn’t have time to test it but the tools are really interesting.

I played a lot with GENE (which seems no more in developing)… LSystems should be a more flexible way to generate something similar. :thumbsup:


#30

I think there might ultimately be two versions. Without a text-area widget, or some cleverness, i don’t know how we can offer a variable number of rules in the GUI. I planned to keep it simple…maybe 2 or 3 rules and the axiom. Really awesome/complex LSystems need lots of rules.
So, once we get the rotation/orientation stuff done, we should have a good engine to do the grunt work. It may be cool at that point to offer a simple version with text-entry GUI for quick doodles, and a minimal-GUI/non-GUI option that works on text files, so the power users can write their rules wherever, and run them in Lightwave.

I sometimes think it would be nice to have a GUI option for changing stuff, and a non-gui option for repeating the current lsystem rules on new polygons.

Those images are cool. I make lots of chrome-sphere images myself. I just keep them out of public view. :slight_smile:


Yeah, I played with GENE too, a little while back. It was fun, and made neat things. The randomization work that SirReality is doing should help lsystems provide similar results.


#31

Buzz, do you know if text widgets could be programmed into the GUI using the C SDK? And, I think you are right about a quick version and power version being a good idea. In total this will be a nice package.


#32

Here is my latest copy of the advanced l-system scripts. I integrated a script (ym_RotVect) which would roll a polygon around it’s normal. After integrating it I altered it to remove its gui and allow it to rotate a polygon’s heading and pitch. I made these alterations assuming that the pitch axis was defined by the polygon’s second and third points and the heading was defined by the polygon’s first and second points as follows:

This assumes the polygons are quads. It also assumes the polygon is constructed with points in the above order. When LW creates a box or any other primitive not all polys are correctly defined and those must be rebuilt to have the script behave correctly.

I know for this to be useful a tutorial is required. I will attempt to put one together in the near future, but cannot guarentee when this will take place. For those of you brave enough for some trial and error I think you will find this is a very powerful modeler tool and I look forward to reading your comments or questions here.


#33

Howdy. I’m happy to announce I’ve got the rotational issues sorted out. Also, I establish the “left” and “up” axes relative to the surface normal and the global “up”, so there are fairly predictable results with polys of any point-count/orientation. I hope to work on it a bit more, to make it more usable/enjoyable and will probably release an update next week.


#34

I just got pointed to this http://www.informatik.hu-berlin.de/~goetsch/Fertilizer/ Getting a great lsystem plugin working with this plugin would be fantastic :slight_smile:


#35

I think adding some options for Fertilizer should be possible. I’ll have to learn how to generate weight maps with LScripts, but once that’s done…I suppose the weight could be set based on the current iteration.

This is just a teaser image. I think I’m almost done with version 1 of the script (at least so it can be tested by others). I wound up porting Laurens Lapres’ growing code into it for a reduction of headaches and compatibility with other lsystem files. I hope to have something for you folks to play with in a week or two. I think it’s clever plugin name will be the “Germinator” :


Larger version here


#36

A L-system in LW! That’s great, i’ll be following this post :slight_smile: Nifty work guys!


#37

Here’s some example weight map code.

To make a new vmap you do this

vmap = VMap(VMWEIGHT, “vmap_name”, 1);

then to set the vmap values you use this

vmap.setValue(points[currentpoint], value );

I hope that helps …


#38

wow thats a really cool looking interface there zuzzabuzz!..im excited about lsystems


#39

I browsed through the thread but I’m still kinda stomped…what is LSystems? Some sort of parametric model creation thing?


#40

I’m fairly sure lsystems was created by a botanist to describe how plants grow. But yeah, it’s a form of parametric modeling, aimed more at the way things grow. For example, I remember hearing that the brain they fly through at the start of Fight Club was “grown” using Lsystems.