20081209

A New Foliage



As I wasn’t satisfied with the simple square-based foliage I created a while ago I wrote a new script yesterday, based on my previous work with triangles. Instead of creating flat squares at the intersection points, it creates a set of two triangles, each one rotated along their shared axis, according to the distance to the nearest attractor point. This creates layers of varying transparency, allowing light to partly pass through the foliage and create a pattern on the ground. Each set of triangles is connected to the wires with a two-parted joint that also keeps the triangles at the right angle.

Pseudo code:

Create a point grid
Input attractors (trees)
Input end surface, and foliage surfaces
Project points to start surface/mesh
For each point
- project to end surface, create end point
- create wire in-between points
- scale according to distance to attractors
For each wire
- intersect with foliage surface
- create two triangles from four points, derived from grid size
rotate each triangle around same axis, rotation angle according to distance from attractors

// download script: create-foliage-triangles.rvb

No comments: