# Drawing parametric waves (and learning maths with it)

## Recommended Posts

Hey everybody, I want to get better at maths and houdini seems like a fun way to do that. So, (ocean) waves are interesting and I want to make a tool that can draw stylized waves.

Alright, I think I got the a classic cycloid:

float x = @P.x + cos(2 * PI / wave_length * @P.x) * scale;
float y = sin(2 * PI / wave_length * @P.x) * amplitude;
float z = @P.z;

@P = set(x, y, z);

And now it gets interesting: Well, how about barrel waves? What should I be looking at to make the peaks curl, parametrically? Fourier? - which I find fascinating, but know nothing in practice.

I graphed a squared cosine and my intuition is that if the blue line function were to be known... (and here it gets fuzzy) do something to the wave. Done. :))

Wave and trigonometry experts out there? A little help?

Cheers!

Edited by haki

##### Share on other sites

I Have this In mine Collection Maybe you can just rewrite to (Wrangle ) . Hope it Helps.

Edited by Librarian
• 3

##### Share on other sites

Very interesting! Thanks for the hip. I'm looking at the VOP and to be honest I'm not good at 'reading' vop networks. I'll convert it to a wrangle see if I can get a better understanding of what's going on.
The wavy lines aren't coming out of that vop, are they?

Cheers!

##### Share on other sites

That its just attribute transfer and some Play with Spiral and combining with this technique .
Just having Fun.

• 1

##### Share on other sites
On 19/05/2020 at 3:25 PM, Librarian said:

Insane! Thanks!

Wrote the vop sop to a wrangle:

matrix xform = detail(1, "xform");
matrix rot = ident();
float z_bias = chf("z_bias");
float range = chf("range");

@P *= invert(xform);

vector domain = set(@P.x, @P.y, @P.z * z_bias);
float dangle = length(domain) / range;

dangle = exp(-dangle) * angle;

rotate(rot, dangle, 4);

@P *= rot;
@P *= xform;

I'll see how to build on top of that.

wavelike_deform.hiplc

• 1

##### Share on other sites

Hi,

just if interested, you can also capture the geometry along a curve an perform rotations using the captured attributes (like distance to curve and curve u). The results are smilar to the previous examples.

Here is a file.

curve_wave.hipnc

• 1

##### Share on other sites

I love the curve capture idea! I adapted your VEX a bit to control front and back of the wave.

Do you know how to stack those rotations? I mean, chain them so that you get 2-3 waves with 2-3 extra curves? See my v1 geo - I do like the xform matrix approach there although matrices confuse me to hell most of the time.

Anyway, I appreciate you help. Cheers!

##### Share on other sites

Hi,

you can capture every curve independently for example and store all attributes into arrays, but I'm not sure, if this working well.

I've substituted the nearpoint values of your example by the xyzdist() values, because it can use the primgroup restriction directly.

All attributes are used as arrays in a for loop.

wavelike_deformA.hipnc

• 1

## Create an account

Register a new account