Jump to content
Sign in to follow this  

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!



Share this post

Link to post
Share on other sites
Posted (edited)

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

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this