Jump to content

Procedural Wedding Cake


Recommended Posts

Hello, I'm trying to replicate a Procedural Cake I've seen in this video: 

To make the basic structure I've created a line with a pscale gradient attribute on each point. Then with a For Each Point loop I copy a cylinder (wich is already scaled in height of the distance between the line points) to the points. The problem is that I want that each layer scales in X and Z according to Pscale, but this is scaling me also the Y of each copied cylinder, which I don't want, as they have to be all the same size (and before copying them they have the right Y). Any ideas on how I can do this? Thank you very much!



Link to comment
Share on other sites

Here is another method of copy-stacking any kind of object on top of itself.


After sorting line points by height you can toggle between keeping proportions and a custom ramp shape (left).

vector pos_next = point(0, 'P', @ptnum + 1);
float height = pos_next.y - v@P.y;
float grad = 1.0 - ( @ptnum / float(@numpt - 1) );
float radius = chramp('shape', grad);

if(chi('proportion_keep')){ v@scale = vector(height); }
else{ v@scale = set(radius, height, radius); }

if(@ptnum == @numpt - 1){ removepoint(0, @ptnum); }

Incoming objects are scaled to unit size with 1/$SIZEY and floored with -$YMIN in a transform node before copying.


Edited by konstantin magnus
  • Like 3
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.

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