formula modeler - help with first baby step - a sphere
Diomede
Posts: 15,165
I want to learn more about the formula modeler. I've opened up the formula presets but I don't know enough about what the formula for a pumpkin or a seashell should be to figure out how to use the u,v,p1,p2 parameters. I think I might be able to get started if I saw a formula for a shape I think I understand, like a sphere. I can look up a formula for the x,y,z coordinates of a basic shape, but I can't figure out how to translate that into the uv space of a Carrara scene.
I believe the x,y,z coordinates of a sphere of radius R centered on the origin is
x-squared + y-squared + z-squared = R-squared.
How does that get translated into the u,v and p1,p2 settings in the formula modeler?
Comments
All Carrara's formula primitive does is cycle through u and v from 0 to 1, and builds a grid of those values. To make a sphere out of that, you need to use sin() and cos() and treat u and v as latitude and longitude.
The p1 and p2 parameters are values you can control in your timeline to adjust the formula.
pi=3.141592653;
x=sin(u*pi*2)*sin(v*pi);
y=cos(u*pi*2)*sin(v*pi);
z=cos(v*pi);
For an example of using a parameter, try this:
pi=3.141592653*p1;
x=sin(u*pi*2)*sin(v*pi);
y=cos(u*pi*2)*sin(v*pi);
z=cos(v*pi);
and then animate p1 between 0 and 1 second.
Perfect. Thanks. I will play with this for a while, then go back to "that French site" that has all of the samples.