2
$\begingroup$

I would like to create a grass simulation with geometry nodes.

I have a system that can almost work. But when I try to apply it to my use case I get stretching of the grass. Currently I have a system where a force is applied to a curve line. That force is stronger at the tip than the bottom.

  • Each frame the points are displaced by that force proportionally to their spline factor
  • After moving, the distance between each point on the one lower down is calculated. If that distance is greater than the original distance, the point is moved directly towards the other point until the distance is equal to the original distance.

And that's it. It works well on my single blade of grass.

enter image description here

But when I try to implement it on a larger scale, the grass slowly continues to grow. I don't know if this is because of the changes I have made due to using instances of curves instead of a single curve.

enter image description here

I've uploaded my attempt .blend.

Is there some way of maintaining the curve length?

$\endgroup$

1 Answer 1

4
$\begingroup$

A simulation zone is something you probably 'don't want' to use here. An advantage of a simulation, is that each step operates on the previous step, therefore allowing - literally and figuratively - for things to travel away from the entry point. Before sim zones, movement would be accomplished by some more or less creative usage of perlin noise, with the downside that objects would tend to move around their original position throughout the animation - and that's the exact thing you want here, because grass blades are rooted!

Perhaps you notice the typical pattern of treating a 3D texture as $xyt$ instead of $xyz$, using the current time/frame as $z$ coordinate. Here, however, I decided to also use the time in $xy$ translation, because I wanted to create an impression of air pockets moving through the landscape.

Another common pattern is multiplying the $[0,1)$ output by $2 =[0,2)$ and then $-1 = [-1, +1]$, however I only do this for $xy$ axes in this case, so I displace the tips horizontally only; it would have a very artificial look, except for the last note-worthy step…

…Which is the Trim Curve node. This is the direct answer to your question, just trim your curve to its beginning width. In my case, I'm mathematically guaranteed to lengthen the splines when I start with perfectly vertical lines and displace the top endpoints only horizontally. Note how cutting will now decrease the height of the splines, exactly as you'd expect from the grass blades that lay down.

If you really want to use a simulation for some reason (and there are many valid reasons, the simulation theoretically allows more realism if you decide to go that route), consider, for performance, animating just points - and only outside of the simulation build beziers, snapping the tops towards those points. Only then, outside of the simulation, trim the splines.

$\endgroup$
2
  • $\begingroup$ Thanks again mr wizard. You are correct in assuming I am going to use this with an animated sequence of wind speeds. Can you briefly explain the transformation happening to the left handle? you're dragging the end point hadnle down which causes it to curve? $\endgroup$
    – TheJeran
    Aug 31, 2023 at 15:50
  • 1
    $\begingroup$ @TheJeran "left" handle means the handle controlling the connection to the previous point (current point being the index 1 a.k.a. "end", and previous point being the index 0 a.k.a. "start"). I'm positioning this handle where the point was before. You could scale this vector to control the curvature (scale above 1 will "overshoot", meaning the grass blade will bend backward before bending in the direction of the "end"). Currently, the setup could be replaced with this for exactly same effect: i.imgur.com/3xnVFO0.png $\endgroup$ Aug 31, 2023 at 17:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .