 # Request : some useful formulas for the formula deformer.

#1

Just started using the formula deformer. The default function is useful but of course just the tip of the iceberg. While I’m not completely mathematically illiterate, coming up with useful new formulas except by trial and error is beyond my abilities. I wondered if anyone had any nice formulas they’d like to share, or a link to some mathematics resource site with some likely candidates ?
Cheers for any suggestions.

#2

It’s in french, but the images should be self-explanatory: http://www.frenchcinema4d.fr/forum/index.php?topic=6896.0

#3

Thanks fluffouille - some good stuff in that thread. And I can give my rusty french a spin #4

Excellant fluffouille, lots of resources there. Thanks for posting.

#5

Wow, that’s a great resource, it’s like a formula wiki, thanks Sébastien. This may be a newbie question, but I tried replicating them with the formula deformer and it seems the deformer base80 uses is a bit different ( an older plugin perhaps?), and I don’t get any visible results.
Any ideas of how they should be translated into the formula deformer?

#6

yeah great references.
Merci

#7

Some of the most useful are the most basic

In r11.5 (with the new formula parser)

max(1-u;0)

this is just a linear falloff from the center of a radial effect

pow(max(1-u;o);2)

this is a falloff that’s curved in a nice quadratic shape. You can adjust the shape by changing the last number (the power) in the pow function from close to 0 to up to any value. 1 is linear, below curves out above curves in.

sin((u + t) * pi2)

a nice sine curve from the center moving over time (t), to apply a falloff just multiply it by one of the previous two, anythign you multiply it by will be it’s overall scale.

sin((u + t) * pi2 * 10)

the same thing but with 10 times the frequency of waves

finally a fun one to mess around with, set your formula deformer to manual mode then the formula to the following (and put a plane under it)

for x : sin(xpi2)sin(zpi2)
for y : cos(x
pi2)
for z : sin(x*pi2)cos(zpi2)

Then start messing a round with the size of the formula deformer. It’s also good fun to play with the values you multiply with to create more crazy shapes.

#8

thx Per-Anders .

#9

All these samples were produced with the Spline formula (it’s an old thread), so I’m not sure how much can be applied to the formula deformer.

#10

Per-Anders, thanks for the jump start on the newer Formula Object!
Very nice to play with falloffs this way.
Since the formula field is a string, I feed some settings from
UserData (on the DropFormula Object) with a few tostring() values.

Cheers
Lennart

SceneFile
QT Movie 1MB #11

Thanks Per!

#12

Thanks Lennart - Can you explain what you did with the coffee portion of this scene on the Drop Formula Objects?

#13

It’s a way to use the Userdata to animate/edit the Formula field.
For example, if I want to animate the t-parameter in this:

sin((u + t) * pi2)

I add a Userdata to the object. That becomes op#ID_USERDATA:1.

In the coffee tag I write:

``````
main(doc,op)
{
var t = op#ID_USERDATA:1;
var formula = "sin((u + " + tostring(t)+" * pi2)"; // Insert the value in the string

op#FORMULAOBJECT_DLT = formula; // Fill the formula field
}

``````

Cheers
Lennart

#14

How about some useful Coffee effector examples?

#15

Thanks for all the tips, guys. Some great stuff in here.

#16

however Per do you have any idea why this file seems to be broken in 11.5 as it works fine in 11 ?

p

#17

Nice example there Lennart. I havent had a chance to look at the 11.5 features or d-load the demo. Do ALL deformers have falloff now? (sounds like at least the formula deformer does now?) That would be very nice.

#18

Some nice formulas can be found on this german page:
http://www.3d-meier.de/

Chao
Mapache

#19

The formula field is a bit more strict now, in that file the second formula doens’t have enough closing braces, just change the coffee to :

``````main(doc,op)
{
var freq = op#ID_USERDATA:1;
var wavelength = 1.0/op#ID_USERDATA:4;
var magnitude = op#ID_USERDATA:2;
var amplitude = op#ID_USERDATA:3;
var wavevector = 2 * pi * wavelength;

var x = "x - (" + tostring((wavevector / magnitude) * amplitude) + " * sin(" + tostring(wavevector) +  " * x - " + tostring(freq) + " * t ))";
var y = "y + (" + tostring(amplitude) + " * cos( "+tostring(wavevector)+" * x - " + tostring(freq) + " * t )[B])[/B]";

op#FORMULAOBJECT_FX = x;
op#FORMULAOBJECT_FY = y;
}
``````

#20

thanks for explaining that. its a terrific set up BTW and a lovely render too.