Jump to content
haki

Drawing parametric waves (and learning maths with it)

Recommended Posts

Posted (edited)

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

Share this post


Link to post
Share on other sites
Posted (edited)

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

derrrty745de41.gif

breaking_wave.hipnc

wave.gif

Edited by Librarian
  • Like 3

Share this post


Link to post
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 this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
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");
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

Share this post


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

  • Thanks 1

Share this post


Link to post
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!

wavelike_deform.hiplc

Share this post


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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×