1
$\begingroup$

For NodeVember this year, I’d like to try and plot some of the pasta shapes in the book Pasta By Design. The book contains equations that describe the shapes of pasta.

Eqution for Ancini De Pepe

I’d like to use these equations to generate volumetrics.
I’m just beginning with Blender and Maths isn’t my strongest subject. I’ve been racking my brains how to do this, but I’m completely stuck. enter image description here

I had the idea that I could solve the equations for i and j and then test to see if x, y or z was within the range, but this does not produce the result I want.
I tried using x and y as the i and j components but I could not get this to work either. As I’m doing this with nodes it’s difficult to do things iteratively I thought I could hack it by using x and y from the 3D array.

Is it possible to use equations like this to plot shapes with volumetrics?

pi(i,j)   := 15•cos( i/60 • PI )
phi(i,j)  := 15•sin( i/60 • PI )
kappa(i,j):= j
$\endgroup$
  • 1
    $\begingroup$ @DuarteFarrajotaRamos right down your alley? $\endgroup$ – batFINGER Oct 20 at 10:35
  • $\begingroup$ Would animation nodes be useful for this? It's an add-on that can do things like procedurally generate geometry according to a node tree. I'm not that familiar with it myself so I don't feel confident enough to make it an answer. $\endgroup$ – Ben Oct 21 at 0:35
6
$\begingroup$

I'm open to correction, but unfortunately, the formulae in your (I'm jealous,) book are expressed in the wrong domain for a renderer like Cycles. They're parametric surfaces.

That is to say, in the book, a surface is expressed as a function of parameters i,j in certain ranges. Given i and j, a point on the surface (X,Y,Z) is generated.

Cycles starts from the other end. It says: "Hey, I've been given this point P in XYZ space, and told it's interesting. What are its properties? Where should I fire a few more rays?" It will have been told to look at that point because it's an intersection of a ray with a triangle, a set step through a volume, or suchlike. Cycles can't iterate through i and j, and generate points in 3D space. You get what you're given.

That's not to say you can't make volumetric pasta. Most pasta is pressed through a die - in those cases, all you have to do is work out how to make a 2D mask in XY that's the shape of the pasta's profile, saying 'Yes' if the point you're given is inside the mask, and 'No' if it's outside.

In the case of your cylindrical Penne, that's just asking if the shading-point is close enough to a given radius in XY with a Compare node, and also that the absolute value of Z is less than where you want to chop it off top and bottom:

enter image description here

All these masks are used to drive the density of Volume shaders thus:

enter image description here

So here's your Penne:

enter image description here

.. but that wouldn't hold much sauce, so you can play with the profile:

enter image description here

.. and cut the ends off with a slant:

enter image description here

.. for Penne Rigate:

enter image description here

Or you can make, say, a cross-shaped mask around the X and Y axes, before rotating the whole space around the Z axis, by the Z height, to get Fusilli:

enter image description here

etc. etc. A great idea for Nodevember.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks for this! This approach is good for some of the simpler shapes, but I would like to try and approach it from that backwards way (if possible). Given a point xyz in the the parametric space, how can it be audited according to the equation? Is this a point to represent or not?. Essentially I would like to build a pipeline into which I can throw some of the more complex equations and get pasta shapes. $\endgroup$ – jkagli Oct 21 at 9:05
  • $\begingroup$ @jkagli Hi! With you.. but the only way I could think of doing that with the renderer would be: 'given XYZ, is there an i,j for which XYZ=f(i,j) is (nearly) satisfied?', which I imagine would use iterative numerical methods. The other way round, constructing the surface, is easy..(Add Mesh > Math Function) $\endgroup$ – Robin Betts Oct 21 at 9:58
  • $\begingroup$ If it could use say, a Compare to see if it was near a valid point, but then of course, you’re right, you would need to iterate over it. I was trying an approach where I would solve the function i = f(x,y,z) then seeing if the result was within the tolerances listed (0,120). I’m not good enough at maths to know why this doesn’t work. Where is this Add Mesh->Math Function? $\endgroup$ – jkagli Oct 21 at 11:29
  • $\begingroup$ @jkagli Ah, yes .. enable the shipped add-on 'Add Mesh > Extra Objects' to get the Math Function options, you should be able to follow your book exactly. $\endgroup$ – Robin Betts Oct 21 at 11:53
  • 1
    $\begingroup$ that’s a cool way to do it! thanks for that. But it’s not really what I’m looking for. I’d still like to do it with shader nodes! $\endgroup$ – jkagli Oct 21 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.