A new version of Cineversity has been launched. This legacy site and its tutorials will remain accessible for a limited transition period

Visit the New Cineversity
   
 
Formulas for Square and Sawtooth
Posted: 02 February 2012 05:39 AM   [ Ignore ]  
Avatar
Total Posts:  95
Joined  2006-07-27

Hello,

  So, you know how the default settings for the Formula Object produce an undulating sine wave?  So, basically, I want to accomplish the exact same thing, only with a square wave and a sawtooth wave.  I figure the best way to do this is to make a single spline and give it 3 Formula Objects as deformers, animating the strength values to make smooth transitions between the shapes.  So, it would seem that all I need are formulas for Square and Saw waves.  Well, I posted this question elsewhere and was quickly given a couple of formulas, but they don’t quite work.

  They are as follows
      • Square: 100*ceil(Sin(t*pi)*.999)

      • Sawtooth:  100*abs(mod(t;2))

Now, both of these formulas for me, when replacing completely the default deformer produce the exact same result.  First, when in infinite falloff all the points move up together uniformly, rather than in contagion.  If I give the falloff a shape, while it will affect only the points within the falloff, it does not resemble a square or sawtooth, and it only moves on +Y rather than undulate like the default sine.  The result is exactly the same for both formulas. 

This tells me there are a couple of possibilities.  Perhaps I need to retain part of the default formula, replacing only part of it with the one’s provided, or perhaps the formulas are simply incorrect.  Now, I know it comes as second nature to some, but I just don’t speak the language of formula, so while I know I am missing something here, I just don’t know what it is.

If worse comes to worse, I figure I can accomplish what I am after with PLA or morphs, or even other deformers, but a procedural approach with formula seems like it would be the most elegant, least clunky solution.

Thanks in advance for any help -

Will

 Signature 

These pretzels are making me thirsty.

Profile
 
 
Posted: 02 February 2012 01:30 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
Total Posts:  365
Joined  2006-05-17

Well the quick reply is that is definitely an issue in the formula.
The formula you have is correct in that it produces the expected results when used with the formula spline.
The issue with the formula effector is that you have to factor in the clones themselves (that’s what ID/count is doing in the default formula.)

I’m not really a math guy, but square is = ceil(sin(((id/count)+t)*180))(more or less, pretty much it takes the default spline and just adds the ceil() function to limit the top and bottom value…since values are on/off the results may be undesireable since there is 0 slope between peak/valleys)

I’m assuming that the “sin((id/count)+t” is the same as “sin(t*pi)” where in some world t*pi == id/count.
perhaps the plan would be go back to the math forums and let them know the full scope of your equation rather than just the formula for the shape, as you are dealing with extra variables.

Hopefully that helps a bit, otherwise, good hunting!

Profile
 
 
Posted: 02 February 2012 04:14 PM   [ Ignore ]   [ # 2 ]  
Avatar
Total Posts:  70
Joined  2006-04-04

You have no u or v in your formula, so the mesh is not recognized at all as a spatial object.

... you might check these versions.  Change the size of the Deformer to change the result, which is the simplest way. Both are animated of course.
For an equal “Square” time use ((Sin((u+t)*5)*0.2)>0.03)?(0.2;u*0). You might change some numbers to explore the formulas so they fit to your target.

P.S.: lots of nice formulas are here
http://www.3d-meier.de/

File Attachments
CV_r11_drs_13_MAfo_01.c4d.zip  (File Size: 53KB - Downloads: 348)
 Signature 

This is one of my old accounts please do not use it for PMs or other communications. I will not receive it. Sorry. Check the avater of teh newer posts in the forum, that should always work nicely.

Profile