Jump to content

random sineblip wave help


Linguininess

Recommended Posts

Hi,

You can write something like this:

float radius = ch("radius");
float amp = ch("amplitude");
float seed = ch("seed");
int count = chi("count");
for ( int i = 0; i < count; ++i )
{
    float r = rand ( i + 34.13 + seed );
    vector p = primuv ( 0, "P", 0, r );
    float d = distance ( p, @P );
    float d2 = fit ( d, 0, radius, 0, PI );
    float y = amp + sin ( d2 + 0.5 * PI ) * amp;
    
    if ( d < radius )
        @P.y += y;
}

image.thumb.png.bc89870541ab7a646c6d1730ed0eda0d.png

  • Like 1
Link to comment
Share on other sites

There are many ways, but the easiest is to sample the resulting curve using a float parameter like this:

primuv("../attribwrangle1/", 0, "P", 1, ch("pos"), 0)

This would be the expression you use in your parameter. Then you can control where to sample using another float parameter (normalized) called pos for example. This could be the current time also if you want, or you can animate the curve while sampling the same location on the curve.

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