Jump to content

Drawing parametric waves (and learning maths with it)


haki

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);

classic.png.252557d335de6fa8ab5caa8978a476b4.png

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. :))

cos_squared_of_x.png.41c4d98bd2ac3f45019449cad25cf5c4.png

Wave and trigonometry experts out there? A little help?

Cheers!

Edited by haki
Link to comment
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!

Link to comment
Share on other sites

  • 2 weeks later...
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");
float angle = radians(chf("angle"));

@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;

wave.png.afd15eef16b9983e55d7b2ea913e5f76.png

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

wavelike_deform.hiplc

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

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!

wavelike_deform.hiplc

Link to comment
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

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...