Generates rocks or groups of rocks based on input value.
This rock generator was built specifically for my senior game project. Following the art style, it has the ability to flatten the top and the bottom of the mesh.
Rocks are one of the most abundant and tedious assets in our game which is in an underground cave. It would take a long time having to sculpt each rock formations. This project saved us from having to spend endless hours sculpting and allowed us to create limitless amount of rock formations on demand.
You may use this as a starting point, and customize it to fit the style and need of your project.
Outer packages of the two generators.
This system generates rocks from another input mesh
This system generates rocks from another simple geometry
1) Base Mesh with Ctrl to Flatten Top and Bot
1.1) Create a base polygonal Sphere, and bring it 1 unit upward to it sits right on top of the grid.
1.2) To flatten out the bottom of the sphere, use Group Create to make a bounding box and adjust the bounding box’s size to be big enough that the box overlaps with part of the bottom you’d like to flatten
1.2) Create another one but position its bounding box overlapping the top part of the sphere. Use bounding box expression to keep the center of the bounding box at the top of the sphere that would have have varying height.
2) Adjust Shape
2.1) Add organic noise with a Mountain node. Don’t worry about the final look just yet. Just get some noise in. I pretty much let it be at its default setting, except changing the Fractal Type to Terrain.
2.2) In order to smoothly flatten the bottom part we selected with the Group Create node, add a Soft Transform node and assign group1 (plane_bot) to the Group property. Scale the Y axis to 0 to even out the area.
2.3) Add another Soft Transform node and assign group2 (plane_top). Scale the Y axis to 0 to even out the area. Use the node’s Y translation and Soft Radius to adjust the influence.
3) Sphere Projection
3.1) Clean up topology with a Fuse node, which snaps nearby points together.
3.2) Create another 0.1 radius Sphere.
3.3) Move it upward so that the sphere is inside the original mesh. Keep the new sphere in the middle of original mesh no matter how the looks by using centroid functions in translation X and Z
3.4) Add a Ray node. Input the new Sphere to the left side, and the original mesh to the other side. The new Sphere will be projected to the original one, resulting in a cleaner mesh with sufficient amount of polygons to add more noise.
4) Bring Back the Noise
4.1) Add more organic noise to the projected mesh with another Mountain node.
4.2) Add a Transform node. In the Uniform Scale parameter, input rand(stamp("../copy1","PT",0)+1) to randomize the resultant rock formation that is going to happen in the next step.
5) Rock Formation
We are going duplicate the previously created rocks, randomize their size and rotation, and put them together.
5.1) Create a Circle (primitive) that is flat on the ground (ZX Plane).
5.2) Add Scatter to create points scattered within the determined radius. Adjust the following properties according to preference:
- Force Total: Total number of rocks in the formation
- Global Seed: How the points are randomized
5.3) Go back to the Circle node to adjust it’s Uniform Scale parameter. This will determine how far apart is each point from each other.
5.4) With a Copy Stamp node, place rocks that have their size/rotation randomized on each spot.
5.5) Add another Transform and use Uniform Scale to adjust the size of the entire formation
From this Transform node is where you can attach an Output node for the high poly model.
6) Make It Game-Ready!
In order to covert this mesh into a game-ready low poly model, we need to clean up the intersecting geometries, reduce the poly count, and UV unwrap.
6.1) Convert the mesh to volume with a VDB from Polygon.
6.2) Convert it back to a polygonal mesh with Convert. You’ll get a clean mesh with no hidden faces inside.
6.3) Add Poly Reduce and set Keep% to 5.
6.4) UV Unwrap. You may use UV Quick Shade to preview the unwrap with checkerboard pattern.
6.5) Finish up by placing an Output node at the end to point out where to get the low poly model.
Link properties that you’d like to be able to control to the controller. Usually I would create a Null node at the beginning and link it to the controller as I go. Here are all the parameters in the controller and where I linked it to.
Seed > Global Seed in Scatter
Number of Rocks > Force Total Count in Scatter
Radius > Uniform Scale in Circle
Bottom Flatness > Soft Radius in Soft Transform for the bottom part
Top Flatness > Soft Radius in Soft Transform for the top part
Top Plane Size > Y Size of plane_top (Group Create)
Bot Plane Size > Y Size of plane_bot (Group Create)
Uniform Size > Uniform Size of the last Transform node (before we convert the mesh to volume)
Notes: You may plug in other kind of rocks or geometries at the top of all the nodes (where the Sphere goes) to achieve different looks.