Linux Format

Making grass look natural

-

You might think that grass is easy to depict: just draw some bent green lines. The reality is that it seldom looks natural and you certainly don’t want to draw multiple blades of grass yourself.

Fortunatel­y, the mathematic­s are fairly simple which makes it perfect for using the computer to calculate the grassy lawn for us. Adding some randomness completes the natural look.

Each straw will be defined by a few angles between the ends, called control points, of an open triangle. When you design the straw you will have two lines connected in the middle, where the ends of the lines are the control points that you can manipulate. The maths element calculates the midpoint of a reference line between the two lines.

The reference lines ends are always ‘t’ units from end A and 1-t from end C, where the ends are named from point A at one end, to B in the intersecti­on and further to C at the far end.

You can try this out on a piece of paper by drawing two lines at an angle, which will determine the bend of the straw. To do this, find the middle of the two lines and mark them, and then continue to cut the line in half until you have eight points on each line. Number them from one to eight, starting at point A, and after point B, start over at one. Now connect the number 1 dots, then number 2 all the way to number 8. Do you see a parabola appear?

Newspapers in English

Newspapers from Australia