Procedural Rock Generator

For a personal project I found myself creating simple rocks to be scattered onto a terrain. I found an excellent tutorial from Fabricio Chamon which outlined some techniques for creating a very detailed rocks using multiple layers of noise and some other techniques to mitigate some of common pitfalls when using noise to deform geometry such as self intersection. This proved a great starting point for my rocks, which didn’t require as much detail, but used Fabricio’s techniques as a foundation.

I wanted to create a variety of rocks from this tutorial setup so decided to set up a tool which would allow for fast generation of multiple rocks of this style, with useful controls to preview and adjust the shape of the rock, as well as generate useful maps for texturing.

The tool takes any input geometry and shows a proxy version of the final rock shape. This can be adjusted with the seed and vertical compression values, which control the noise offset and amount of squash applied to the shape respectively. There is also a version control which is used in conjunction with the export controls to control versioning of the cached geometry.

In the export section, there are three buttons designed to be pressed one after the other, to cache the high poly, low poly and final geometry respectively. The high poly and low poly exports are both required to generate the mesh maps. The low poly mesh will have automatic UVs created for it which can be seen by using the visualisation control and selecting Low Poly (UV).

Three mesh maps can be created using the Bake Mesh Maps button, namely curvature, AO and worldnormals. These can then be used with the low poly model to assist with texturing and shading of the rocks.

Tool Breakdown

I used the tool with a sphere input mesh, but this tool could in theory be used with any input geometry. There are improvements that could be made as it was put together with one specific project in mind and for personal use, such as control over where the geometry is saved to and a more robust versioning system, along with the ability to automate the process further and simply input a number of desired variants which would be randomly generated. These changes would likely require significant changes to the underlying setup, so is a project for a rainy day.

For now the tool works in a fairly basic and hands on way, and you can download it here: Direct Download


Visualisation

Geometry LODWhich geometry LOD to display. Requires the respective geometry version to have been saved to disk.

Proxy
Display a low poly version of the rock, with only one level of noise applied. Gives a rough approximation of the final shape.
High Poly
Display the full resolution model with multiple noise layers applied.
Low Poly
Display a optimised version of the final model. Reliant on the high poly version being saved to disk.
Low Poly (UV)
Display a optimised version of the final model with a UV checker material applied. Reliant on the high poly version being saved to disk.
Low Poly (Mesh Maps)
Display a optimised version of the final model with a worldnormal mesh map applied. Reliant on the high poly version being saved to disk and mesh maps being baked.

Controls

VersionAn integer value used when saving the geometry out to disk to control version numbering.
SeedControl to vary the offset of the primary noise ran over the geometry. Use to vary the overall shape of the rock.
Vertical CompressionControls the amount of vertical scaling applied to the shape. Use to squash the rock, giving a more flat bottomed shape.

Export

Geometry

Cache High PolySave the full resolution version of the model to disk. Required for generation of low poly mesh and baking of mesh maps. Uses the current version number when saving.
Cache Low PolySave an optimised version of the mesh to disk. Required for baking of mesh maps and exporting final models. Uses the current version number when saving.
Export .objExport the low poly model to be used in other applications. Uses the current version number when saving.

Mesh Maps

ResolutionSet the width and height in pixel for the baked mesh maps.
Bake Mesh MapsExport mesh maps baking information from the high poly mesh onto the low poly mesh. Uses the current version number when saving.

Inputs

Input Geometry

Can be any shape of polygon mesh, with the base of the input mesh sitting on the origin.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s