Skip to Page Content

L-Studio Tips

From WolfWikis

Jump to: navigation, search

back to Procedural Design

Including lessons learned here, so future students can prosper.

Contents

Start with an existing example

Find something in the examples with a feature you want to include and start from there. Setting up lighting and the rest of the parameters within the VIEW file can be tedious. Starting with a working VIEW file allows you to trim away and refine the contents of the VIEW file, which is easier than starting from scratch.

Grammar Specification (L-System) file

Generalized cylinders look good and are fun to play with. At a minimum, a generalized cylinder should have a beginning and an end. Additional control points can be placed on the central line being used to draw the generalized cylinder, which allow for resizing, branching, and orientating the cylinder.

Example: Create an L shaped cylinder

An L shaped generalized cylinder

Turtle Parameters Used:

    @Gs – start a new generalized cylinder
    !(n) – set current line width to n
    f(n) – move turtle forward by n (NOTE: does not draw anything, used for GC’s)
    @Gc(n) – Place a new control point with n sides
    +(n) – turn the turtle left n degrees
    @Ge(n) – End a generalized cylinder with n sides

S(size, n) -->

@Gs /* Start a generalized Cylinder */
!(0.1) /* Set a beginning size for the cylinder */
f(size) /* Move the turtle a distance of size */
@Gc(n) /* Place a control point with n sides */
+(90) /* Turn left 90 degrees */
f(size) /* Move the turtle forward a distance of size */
!(0.01) /* set an ending size for the cylinder */
@Ge(n) /* close the generalized cylinder with n sides */

Coloring

You can use a colormap or materials to color your creations. You can switch between colormap mode and materials mode in the Colors tab of L-Studio. Two items relating to color that you should include in your view file are:

1) initial color: x y – x and y are integers that correspond to colors or materials. NOTE: y is optional and defines the color or material to paint onto the back of the surface being colored. <-- Surface specific?

2) color increment: 1 – This is the amount used to by color increment parameters, although it is usually easier to specify explicitly which color or material you wish to select.

Turtle Parameters for color:

 ;(n) = ,(n) – set the current color index explicitly using n
 @;(n) = @,(n) – set the current color index of the back of the surface to n
 ; - increment the current color index by <color increment> (see 2) above)
 , - decrement the current color index by <color increment>

Texturing

The only textures I was successful in adding to my project were those that I saves as .rgb files. Gimp, on most Linux machines, was able to export my .jpg’s as SGI .rgb files and they worked fine. The format is important because it is specified in the texture declaration (VIEW file).

Example: Use textures and surfaces in productions

L-system file

A -->
@Tx(1) /* set current texture index to 1 */
~l(0.1,0.1,0.1) /* draw the surface labelled l in the VIEW file */
^(90) /* increase turtle pitch by 90 degrees */
@Tx(2) /* set current texture index to 2 */
~m(0.1,0.1,0.1) /* draw the surface labelled m in the VIEW file */
@Tx(0) /* turn texturing off */

VIEW file

surface: l leafWide.s 1 4 8
surface: m leafNormal.s 1 4 4
texture: F: leafTex1.rgb H:l L:l E:m S: R:1 /* textures start at 1 (i.e. this is @Tx(1)) */
texture: F: leafTex2.rgb H:l L:l E:d R:10

In the texture declarations above, H:l and L:l are pretty standard (refer to manual for further details)

The E: subcommand sets the texturing mode, which is modulate(m), decal(d), or blend(b).
The S: subcommand, included with the first declaration, tells the texture to be applied per surface instead of per patch.
The R: subcommand sets the aspect ratio of the texture

Surfaces

The above texturing example demonstrates how surfaces are accessed in the (L-system) file as well as how surfaces are declared in the VIEW file.

(VIEW file)

surface l leafWide.s 1 4 8

In the declaration above, a surface will be defined with a scaling factor of 1 having 4 polygons per row and 8 polygons per column on surface patches. This surface will be referenced in the (L-system) file by the name l. Notice that leafWide.s is the file created by the surface design tool in the L-Studio surfaces tab.

Miscellaneous

Tropism is fun. Set some direction vector for your plants to grow toward and play with the initial elasticity (E:[0-1]). (VIEW file) tropism: T: 0.0 1.0 0.0 E:0.9

Functions Function sets are cleaner to use than lists of functions.

Go through the examples. Specifically start here ..\oofs\Tutorial\oofs-course-cpfg\2-Introduction, then ..\oofs\Examples\09-advanced-graphics, then finish perusing ..\oofs\Examples.

You will understand the manual the ninth time you read it.

Personal tools

Wiki Stats

Users:  7,047
Pages:  3,895
Uploads:  4,704
Views:  4,404,786
Edits:  90,612