Simulating growth on meshes

calendar_today

03.07.2022

label

Vegetation

mouse

Houdini 19.0

1 Description

A polygon mesh gets iteratively displaced (and remeshed) based on surface features and normal orientation as well as light exposure.

2 Code discussion

Inside a solver we constantly measure the light exposure using "cast shadows" and "ambient occlusion" provided by the mask by feature-node. With an attribute wrangle we direct the growth amount and direction. This example is used in mushroomify.hip.

float h limits the height of the mesh to a world position of 0.5.
float d compares the surface normal to an up vector, returning angle values between 1 for up and -1 for down.
float a fits a cosine wave that changes over time into a values between -0.25 and 0.9.
float m defines the width of the band that allows growth by setting the cosine wave in relation to the angle d.

This lets the mesh grow upwards or sidewards / slightly downwards depending on the current amplitude of the cosine wave.

In the last line all these masks are multiplied along with an amplitude of 0.02 which scales the displacement along the normals. The appended remesh node is constantly updated as well. It makes sure we never run out of detail.

float h = max(0.5 - v@P.y, 0.0);
float d = dot(v@N, {0,1,0});
float a = cos(@Time * 0.5);
a = fit11(a, -0.25, 0.9);
float m = abs(d - a);
m = 1.0 - smooth(0.2, 0.3, m);

v@P += v@N * m * f@mask * h * 0.02;
download

Downloads

smart_display

Videos

Simulating Growth on Meshes – Houdini Tutorial