I'm trying to create something like a stack of cards using Geo Nodes. Following a tutorial on YouTube, I managed to arrange the cards along a curve using the Resample Curve node. Now, I want to give the cards a random rotation around the Z-axis to make the stack look more natural. I've attempted to use the Rotate Instances node, but it didn't work, and I'm not quite sure how to achieve what I have in mind.
Perhaps you could get a nice result with just one Noise Texture with the right settings, but I find it easier to reason about multiple separate noise textures:
- First a noise texture giving a basic profile to the stack, low scale for smoothness (actually very low, because I use Index as coordinate, and indices tend to be bigger than position components) and no roughness/detail for the same reason; consider some minimal distortion for uneven profile.
- Then noise with slightly bigger scale to add some more chaos with local shifts of the stack; plus some distortion, so the shifts vary in size.
- Add them together:
- Voronoi texture is good for sudden boundary changes, but you could achieve similar by posterizing (snapping) a normal noise texture. This simulates big shifts of the stack. If you want to instead simulate joining separate stacks together, you need to use the voronoi cell position as the base for the coordinates for all other noises!
- A white noise can be added to slightly move all cards randomly, however another noise with much bigger scale and/or roughness works more realistically, because in reality cards will tend to line up.
The setup then becomes:
And the stacks (the 2nd with all offsets scaled down for a more subtle effect):
One non-realistic thing here (the continuity across voronoi boundaries could be considered another) is that all cards centers stick to $xy = 0$. You could use the same noise textures (or transform them e.g. using other noises) to also offset the cards slightly.
Basically, you need to rotate and translate the instances using a noise texture. I found that tweaking the pivot of the rotation helps. The result looked good, but was missing something.
In the reference, it seems that the cards tend to clump together; a group of them roughly rotate together by the same amount. To replicate that, I posterized the noise using a Color Ramp (because it seems that the posterize node only exists in the Compositor). I ended up mixing the original noise with the posterized version.
A clamped noise texture produces values between 0.0 and 1.0. Typically, we subtract 0.5 and multiply by 2.0 to move the values to the -1.0 to 1.0 range. Then, we can scale the values up or down according to our needs. I combined the latter two steps in my setup.
Note that the rotation should only be around the z-axis, so I multiplied the x and y components of the noise output by zero. On the other hand, the translation should be limited to the x-y plane. Multiplying the z-component by zero does the trick.
The rest is to tweak the values to get something that looks good.
A screenshot showing the final node setup and the result is attached below.
There is an issue with my setup. I shouldn't have used the Factor output from the noise as a vector. This will cause all components to be the same.