Blender: Procedural Rocks Generator

Introduction

Procedural art assets are pretty cool because they save time and are versatile, especially in the gaming industry. They're great for trying out new concepts and styles quickly, and we don't have to redo the same thing over and over. That's why it's worth putting in the effort to make a rock generator that we can customize easily.

Creating a good rock model involves both the shape of the rock and how it looks. We'll start with the shape and then move on to the material. We'll be using Blender in this tutorial, but the same ideas can be applied to other modeling software too.

Geometry Nodes

In Blender, the node system is a powerful tool that allows we to easily manipulate and control the various elements in we scene. The node system provides a visual representation of the data flow and interactions between different elements, making it easy to understand and use. To access the node editor in Blender, simply go to the Properties window and click on the "Shading" tab. From there, we can begin to create and manipulate nodes to achieve the desired result in our scene.

To start creating a rock model in Blender, first, clean up all objects in the Scene Collection by selecting them and pressing Delete key. Next, create an arbitrary geometry by going to the Add menu and selecting "Ico Sphere" to generate a simple triangular sphere. This will serve as a starting point for the rock.

To adjust the sphere, switch to the Node Editor and add a "Noise Texture" node to the material, connect it to the displacement input of the material. Use some random functions such as Perlin Noise, Voronoi to make some simple deformations to the sphere. Adjust the Noise Texture and the number of subdivisions of the Sphere to generate interesting geometries.

By adjusting the Noise Texture and the number of subdivisions of the Sphere, we can generate a variety of interesting geometries. The Noise Texture node is a powerful tool that can be used to add random variations to the surface of the sphere. Inside the Noise Texture, there is a Perlin Noise function, which allows we to generate 1D, 2D, 3D, and 4D continuous random arrays.

We can control the output of the Perlin Noise function by adjusting the Position and Vector Math nodes. For example, we can use the Vector Math node to multiply the result by 2 in the x-direction, to give the rock a directional look.

It's worth noting that the Perlin noise function is a procedural noise function, which means it's generated mathematically rather than sampled from an image. This makes it very useful for creating random patterns and textures that can be easily adjusted and controlled.

By adjusting the position and vector math nodes, we can control where the Perlin Noise is computed, thus changing its function output without changing its parameters.

For example, by multiplying the result by 2 in the x-direction, we can give the rock a directional look, rather than having it expand outward uniformly. This allows we to create more realistic and varied rock models, by giving them a sense of direction and movement.

We can also use the Position Node to adjust the position of the noise, this way we can control where the noise is computed on the surface of the sphere, giving we more control over the final outcome.

Overall, by using Perlin noise and adjusting the position and vector math nodes, we can create a variety of random patterns and variations on the surface of the sphere, giving we a lot of control over the final look of the rock.

To add more complexity to the generated model, we u can take random points on the surface of the sphere, convert them to a volume and then to a mesh. This can be done by using various tools such as the "Particles" or "Metaball" systems.

By converting the random points to a volume, we can create more complex shapes and forms that resemble natural rock formations. Once we have the volume, we can then convert it to a mesh by using the "Convert" function in the "Modifiers" tab.

Additionally, by obtaining the bounding sphere of the model generated in the previous step, we can use it for subsequent processing such as adding more details to the surface or for further deformation.

It's worth noting that this step can be very time-consuming and requires a lot of tweaking to get the desired result. However, it can add a lot of realism and complexity to the final model, making it look more like a natural rock formation.

The next step is to repeat the previous logic and model the rock in a sphere, but this time, instead of using Perlin Noise, we will use the Voronoi function to generate sharper edges and surfaces of the rock.

The Voronoi function generates the maximum value in the UV plane along a straight line distribution, we can offset it out to generate the sharp part. But now the maximum value is a larger interval, we can use the power function to increase the derivative function (Derivative) without changing the function continuity premise.

We can use the Voronoi function in the same way as the Perlin Noise, by connecting it to the displacement input of the material and adjusting the position and vector math nodes to control where it's applied on the surface of the sphere.

Additionally, we can also use the Voronoi function as a texture map, by connecting it to the material's color input and adjusting the weight, this way we can achieve interesting results and control the sharpness of the edges and surfaces of the rock.

By using the Voronoi function, we can create sharp edges and surfaces on the rock model. The function generates the maximum value in the UV plane along a straight line distribution, by offsetting it out we can generate the sharp part. However, since the maximum value is now a larger interval, we can use the power function to increase the derivative function (Derivative) without changing the function continuity premise.

By increasing the derivative function, we can create more defined and sharp edges, making the rock model look more realistic and natural. Additionally, by using the power function, we can control the degree of sharpness, thus fine-tuning the final outcome of the rock model.

It's worth noting that the Voronoi function can be used in combination with Perlin Noise, this way we can achieve a balance between randomness and sharpness and create more realistic rock models.

To further refine the edges of the rock model, we can multiply the constant values generated by the Voronoi function on the UV surface by the Normal vector of the model. This will shift the value of the Voronoi function in the direction of the normal vector for each vertex on the UV surface of the model.

By multiplying the constant values generated by the Voronoi function with the Normal vector, we can control the direction and magnitude of the edges of the rock model, making it more realistic. Additionally, we can use the multiplication method to control the magnitude of the edges, this way we can fine-tune the final outcome of the rock model.

It's worth noting that this step can be very time-consuming and requires a lot of tweaking to get the desired result. However, by multiplying the constant values with the Normal vector, we can create more natural-looking edges, making the rock model look more like a real-life formation.

To make the rock model more realistic, we can add some uneven cracks to the surface. One way to achieve this is by using the Voronoi function again, but this time with the added weight in the Y direction and color as the output. This generates a variety of values, where each color has equal internal values.

By using the Voronoi function in this way, we can create uneven cracks on the surface of the rock model, making it look more realistic. Additionally, we can use the color output to control the size and shape of the cracks, by adjusting the weight in the Y direction.

It's also worth noting that we can feed the result of this step to the previous result, in order to generate the cracks. This allows we to create more realistic and natural-looking cracks on the surface of the rock model.

Overall, adding uneven cracks to the rock model can greatly increase the realism of the final outcome, making it look more like a natural rock formation.

Finally, in the Modifier tab, we can add a Decimate modifier to the rock model. By adjusting the value of the decimate modifier we can reduce the number of faces of the triangles and generate a low-poly model. This can be useful when working on a large-scale project or when creating a game asset.

The Decimate modifier works by removing the unnecessary triangles from the model and it can be used to reduce the polycount without affecting the shape of the model. By adjusting the value of the decimate, we can control the level of detail and the polycount of the model.

It's worth noting that this step should be done at the end of the process, as it can affect the final outcome of the rock model.

With this step, we have completed the process of creating a realistic rock model using geometry nodes in Blender.

Shader Nodes

Shader node system is a powerful tool for creating convincing materials in Blender. When creating a rock material, one effective technique is to add a Noise Texture to the surface of the model and multiply it with the normal vector. This can make the surface of the model appear rough and natural, similar to real-life rock formations.

We can use the Noise Texture node to create variations in the color and roughness of the surface. We can connect the noise texture to a "Normal Map" node and then connect it to the "Normal" input of the material, this way we can multiply the noise texture with the normal vector to create the roughness effect.

Additionally, we can use various other nodes such as the "Mix Shader" or "BSDF" to control the specularity, reflection, and other properties of the rock material. By using the shader nodes we can create a realistic rock material that can be easily adjusted and fine-tuned.

To further refine the realism of the rock material, we can use the ColorRamp node to reveal some smooth surfaces on the rock. By using the ColorRamp node, we can create variations in the roughness of the surface, making it appear more natural.

We can connect the ColorRamp node to the "Roughness" input of the material, this way we can adjust the reflection of the model and create a more realistic look. By adjusting the ColorRamp node, we can create smooth and rough areas on the surface of the rock model, making it look more like a natural rock formation.

Additionally, we can also use various other nodes such as the "Mix Shader" or "BSDF" to control the specularity, reflection, and other properties of the rock material. By using the shader nodes in combination with the ColorRamp node, we can create a realistic rock material that can be easily adjusted and fine-tuned.

To create a more realistic rock material, we can also use the ColorRamp node for the Base Color of the material. By using the ColorRamp node, we can extract the color of the rock from an image and use it as the base color of the material. This allows us to get a more accurate representation of the diffuse color of the rock.

To attach the moss material to the upward-facing surface of the rock, we can use the result of the previous dot product as the Factor input of the Mix Shader node. By using the dot product as the Factor, we can control which faces of the rock model have moss attached to them. The moss material will be applied to the upward facing surfaces of the rock model, creating a more realistic and natural-looking rock.

Additionally, we can use the "Mix Shader" node to blend the extracted color with the noise texture, this way we can create a more natural looking surface with variations in color and roughness. This will give the rock material a more realistic and natural look.

Next, we can create an Empty object and place it on top of the rock model. By using the Texture Coordinate node, we can output the vector from each point in the model space to the center of the empty object. This can be used to calculate the dot product of this vector and the normal vector of the rock model to get the angle between them.

By calculating the angle between the vector and the normal vector, we can determine which faces of the rock model are facing the center of the empty object. When the angle is small, the face will be facing the center of the empty object. This can be useful for creating various effects such as creating a spotlight or a light source that illuminates the rock model.

We can use the dot product output, to drive the factor input of a Mix Shader node, this way we can create a material that reacts to the angle between the empty object and the rock surface, creating a more realistic look.

It's worth noting that this step can be very time-consuming and requires a lot of tweaking to get the desired result. However, by using this technique, we can create a more realistic and natural-looking rock model, by simulating the lighting conditions in the scene.

To create a more realistic and natural-looking rock model, we can also add moss to the surface of the rock. We can do this by creating a new BRDF material for the moss and then mixing it with the existing rock material.

To attach the moss material to the upward facing surface of the rock, we can use the result of the previous dot product as the Factor input of the Mix Shader node. By using the dot product as the Factor, we can control which faces of the rock model have moss attached to them. The moss material will be applied to the upward facing surfaces of the rock model, creating a more realistic and natural-looking rock.

It's worth noting that this step can be very time-consuming and requires a lot of tweaking to get the desired result. However, by using this technique, we can create a more realistic and natural-looking rock model, by simulating the presence of moss growing on the surface.

And with that, we have a pretty decent rock generator. The process of creating a realistic rock model involves several steps, including adjusting the geometry of the model, creating a realistic material, and adding various details such as moss. By using Blender's node system, we can easily create a realistic rock model that can be adjusted and fine-tuned to our liking. It's also worth noting that the steps and techniques provided are only examples and there are many other ways to achieve the same results.

Previous
Previous

CG: Volumetric Path Tracing Renderer