Wednesday, December 19, 2007

Workflow and tips on keeping the scene clean

This thread has some good advice about how to work with clean and organized scenes. Basically, it boils down to dividing your shot into multiple scenes, and then combining the rendered passes in compositing (among other things).

Saturday, November 10, 2007

L-Systems, part II

In the last post, we looked at L-Systems and the basic principles of an L-System. This time we will take a quick look at how to use that in computer graphics.

An L-System can based on a string of characters, as seen in the previous post. Now, consider the following statement:
Each letter in this string represents an action.

Lets say that the system consists of three letters, D,R and L. Each of these letters represent an action.

D: Draw a line 1 unit long
R: Turn 90 degrees right. Do nothing else
L: Turn 90 degrees left. Do nothing else

So, the combination DRD would mean "Draw a line, turn right, and then draw another line in the new direction."

DRDRDRD would mean Draw a line, turn right, draw a line, turn right, draw a line, turn right and draw a final line. This would result in a cube.

Now, let's say we use rules to transform a string of these commands.

Example:

Starting string: DRD

Rules: D = D
R = DRDLDRD
L = DLDRDLD

As a small excerscise, draw the shapes DRD and it's "child" DDRDLDRDD.

As you see, small corners are added to each corner. For each generation, more corners are getting "cut out".

This is a simple start on how to use L-Systems for drawing. There are more advanced examples, and we will get back to those in a later post.


Powered by ScribeFire.

Tuesday, November 06, 2007

L-Systems pt I

L-Systems are commonly used to create complex patterns and constructs.

This and following posts are my attempt to understand these L-Systems more.

First of all, what is an L-System?

An L-system consists of two parts (roughly speaking). A chain (or a text string) and rules.

The chain can consist of any pre-defined components. To demonstrate I will use a chain of letters. The string AABA could be such a chain.

The rules describe how this chain should change. For instance

A = A
B = AB

You let the chain grow or change by running it through the rules, one component at a time. Let's consider the example above:

Chain: AABA
Rules: A=A
B=AB

First run:
First letter: A, becomes an A
Second letter: A, becomes an A
Third letter: B, becomes AB
Fourth letter: A, becomes A

The result is A+A+AB+A = AAABA

Second run:
First letter: A, becomes an A
Second letter: A, becomes an A
Third letter: A, becomes an A
Fourth letter: B, becomes AB
Fifthletter: A, becomes A

The result is A+A+A+AB+A = AAAABA

In this example, the chain was put through the same set of rules twice. In theory an L-System could be run any number of times, applying the rules over and over again.

Which each iteration, the string evolves and changes according to the rules.

There are a couple of basic patterns that is worth mentioning.

The first one is where you add complexity in the middle of the string.
Example:
Chain: ABA
Rules A = AB, B = A

First run: AB+A+AB = ABAAB
Second run: AB+A+AB+AB+A = ABAABABA
Third run: AB+A+AB+AB+A+AB+A+AB = ABAABABAABAAB

and so on. As can be seen, the string grows longer, and more complex all the time.

Consider instead this string, and in this case, I'll use three letters. The basic principle is the same.

Chain ABX
Rules, A=A, B=B, X=ABX

First run A+B+ABX = ABABX
Second run: A+B+A+B+ABX = ABABABX
Third run: A+B+A+B+A+B+ABX = ABABABABX

In this example, the inner structure isn't changed, instead a tail is added to the end for each run. This is accomplished with a tail component that adds a string+the tail component for each run.

These L-systems can use an indefinite number of rules and components. I could have an L-System with all the letters of the alphabet and a multitude of rules, creating something very complex.

So, what can we do with this then?


Wednesday, August 15, 2007

Interactive Creation in Maya

One of the things Autodesk introduced in Maya was the interactive creation. In it's normal workmode, that means that you click and drag on the grid to place and scale your object. However, there are some extra little details that can be worth remembering.

First of all, remember that planes and cubes are created differently than other primitives. With the first click, the corner is placed and then you drag out the other corner. With the other primitives, you place the center with the first click, and then drag out the radius.

If you press the control-button when creating a cube or a plane, it is placed as above, but when you drag out the height, it grows so that it's center is at the ground plane (as compared to having it's base on the ground plane normally).

If you press the shift-button when dragging (regardless of object) it is created equally large in all directions, and it's base rests on the ground plane.

Finally, Ctrl+Shift makes a cube behave just like the other primitives in that it is created with the same dimensions in all directions, and it's center is on the ground plane.

You can also double-click instead of click-and-drag, and that creates a primitive with size (for cubes and planes) or radius (for spheres and similar) 1 in all directions, with it's center on the ground plane at the spot you double clicked.

Another little nice detail: In the menu Create -> XXXX Primitives there is an option Exit on completion. If this option is unchecked, you don't leave the creation mode when a primitive is created. This way, you can rapidly create a large number of primitives just by clicking and dragging.

From Maya 8.5 there is also a tool option that let's you adjust different parameters after creation. Create -> Polygon Primitives -> Cube (as an example) and click the square to open the options window. There should be a heading After Creation Settings. If you activate Adjust Subdivisions, you can set the number of subdivisions by click and drag when you have created your primitive.

Finally, you can activate the Snapping-funtions to snap your primitives to a grid or a live object, for instance.

Friday, July 13, 2007

Constraints in Blender

Using constraints in Blender can be a bit of a hassle, but here is a method I have found works quite nicely.

The setup: You have got two objects, A and B. You want B to follow A around, but with the following conditions.
  • The connection can be toggled on or off (that is: keyframed)
  • The connection should work like a parent-child-relationship. If A rotates, B should rotate with A as it's centre.
  • You want control over the offset between A and B
First of all, create A and B and center their center points. Place them exactly where you want them to be the moment the connection is created or released.
Select object B, that is, the "child" or "slave" object. Snap the 3d cursor to that object (shift-S).
Create an empty object at that place and give it an appropriate name. You may want to set it's rotation to the same as your object B.

Parent the empty object to object A. Finally, constraint B to the empty object (location, and rotation if needed). Voila!

The connection works like a parent-child-relationship, but where you can keyframe the weight. You can alter the offset by simply translating/rotating the empty object. And, since everything was set up at the "connection-point", there should be no sliding whatsoever when keyframing the weight-value.

With this setup it's also possible to make multiple connection, for instance, if you have an object handed over from one hand to another. Just make the setup twice, and keyframe the weight-values of each locRot-constraint-pair.

Easy and quite powerful.