UE5/Houdini : Stylized Grass Pivot Painter Breakdown


this is inspired by Ghislain Giradot method to make Stylized Grass

Result





Modeling


First, to model our grass, we are gonna use Houdini. The grass is gonna be really simple. We need each blade to be as thin as possible, with Unitized UVs and each pivot stored in a secondary UV channel.
We need it to be thin since the scale and thickness is gonna be controlled via the Material later on.
The pivots are gonna be used to rotate each blade like a Billboard, Scale the size, control the wind and project the grass onto the landscape in Unreal Engine.


The first step is creating a single blade with a standard sweep and a line. Make the blade really thin and create UVs then Unitize them to make them fill the UV space 0 to 1.




Second step is creating the scattering, we need to create a small surface and scatter points and assign them attributes to use later. We start by creating a shape, here i used a circle. Then we scatter points onto the shape with a random rotation, name and pscale attribute. The name attribute is gonna be used by the Pivot Painter Node in Houdini.


Lastly we use a Foreach to loop the points and copy our grass blade using the random pscale and rotation attribute. I also used an attribute wrangle node to bend slighty the grass blades randomly just to add some variations.
 

Make sur you use the Pivot Painter 1.1 node and not the 1.0 or 2.0. We want to store the pivot in UVs and not onto a texture.


Once done we can simply export as an FBX file and import into Unreal Engine.

Material


Color


Let's look into the material in Unreal Engine. Create a Masked, Two Sided Foliage Material and setup a standard RVT with a Landscape.



Here we utilize the PivotPainter_PerObjectData with the Random Value Per Element output along with a Hue Shift to randomize each blades color. This just simply take the Green Channel of the 3rd UVs were a random float between 0 and 1 as been assigned.

Size


For the sizing of our blades, we use the Pivot Position and the Random Value Per Element to control the Global Scaling and the Random Scaling per blade. I feed the Random Value Per Element onto the alpha of a Lerp along with a Min and Max value to control the size variation of the blades. We use here the green channel of the UV to strech from bottom to top without moving the vertices of the blades at the bottom.


Landscape Projection


We can use the Pivot Position and RVTs to sample the Height of our Landscape and Offset the position of the blades to always stick to the ground and point upward.
We simply substract the Height of the Landscape to the position of the pivot on the Z channel and add a offset to manually control if needed.




Thickness and Billboard


We modeled our grass super thin, but now we need to control the Thickness withing the material. To do so, I use a technique showed by Ghislain Giradot. This technique act like a billboard function and scale/rotate the grass along it's Pivot Position.
The controls are simple, simply take a Tip Width and Root Width and lerp it using the green channel of our UVs powered by a parameter to control the Curviness of the blades.


The material function use the Width input to scale the blades thanks to the UVs. Since we modeled our grass to have Unitized UVs in Houdini, the scaling will be uniform but we need to make sure to substract 0.5 to the UVs to scale our grass by the center.
We then multiply the result with a standard billboard operation using the Camera position and the Y axis as the rotation Pivot.


Wind


The wind I used is the one showcased in the UE5 Content Example for the Pivot Painter 1.0. It use a Noise Texture and the RotateAboutAxis node. The gist of it is using the Random Value Per Element and the Pivot Position to create an offset from bottom to top for the Wind. That way each blade never moves like it's neighbour. The parameter here are only the Wind Direction, Speed and the Min and Max intensity.


Conclusion


We can always add features to our system like grass interaction using Niagara and Render Textures for example. All the posibility and operation we can do using the Pivot Position can really elevate any shaders to the next level.
The system is mostly used for small patches of High Quality grass in games, Illustration or quick Layout for an environnement.