Rock material

The first material I will go through is relatively advanced and therefore it is important that you know of nodes to create materials. If you are not familiar with this, there are a lot of good guides on the net. You can also find information about the nodes in blenders user manual.

Below you can see how the final rock material looks. The .Blend file with the material can be downloaded here (press the “klik her for at downloade filen” botton on the page to download it)

rock

How do you go about this task?

Often it’s the small details that make the difference. It is also what makes good materials very complicated. Often a layer of material is not enough to get a realistic appearance so it is important to start with a real image which can be used as a starting point.

When you have a good reference image by hand, it have to be analyzed.

close up rock

In this tutorial is used a close up of my own material (to avoid copyright issues). There are two things that draw special attention in the material

  • There are not just two colors but many (7 colors have been used for this rock material).
  • The colors are dispersed in concentrated areas. This means that there are areas where you won’t see a certain color and areas where it will be mixed with other colors.

It is this property we want to recreate by manipulating nodes and textures.

To create variation in small areas

Normally, one might think several Noise Textures in layers could handle it. If you do so you will not split colors in areas but just make variations in the entire area. To create the division of colors in different areas, I simply told, removed the lowest values ​​from the noise texture.

To better understand this, we must understand what data a noise texture consists of. In the nodes editor the noise texture has an output called Fac. Fac stands for fraction and gives values ​​from 0 to 1 as, for noise texture, vary with the coordinates of the object. This Fac indicates how two colors are mixed in the Mix Shader node.

If you follow a straight line across a surface the change in fac can be illustrated in a 2D coordinate system as.

fac_illustration

To create variation in specific areas I want to put values ​​under 0.5 is equal to 0. Thus there will be no mixing between the colors of the values ​​below 0.5. For values ​​over 0.5, there will be a mixture between the colors. This will give a pattern that can be illustrated by mixing red and blue as seen here.

spread texture

Here the completely red areas have had values ​​below 0.5 where areas with values ​​above 0.5 is a mix between blue and red and gives the purple shades.

The node setup

This way of mixing the colors is done with all the colors. Different colors has different degrees of coverage thus the parameter for the noise texture is changed for each color to fit the reference image.

Since the above pattern is used several times, I first form my own group of nodes that can be easily copied.

spread node

All values ​​to the left makes it possible to change the texture and the limit value for which you put all values ​​equal to 0 for the noise texture.

node functions are as follows:

  • Divide node: Better control of the limit value for which you put all values ​​equal to 0 for the noise texture
  • Substract node: Substract the selected value from the noise texture
  • Round node: Rounds to the nearest integer.
  • Add node: Add what have been Substract, as the values ​​would not necessarily lies between 0 and 1 and thus would not make sense in the next node.
  • The first multiply node: Multiplies areas from noise texture that is below the limit with 0 and will thus be 0 everywhere for these values​​. Multiplies the areas of the noise-texture that is above the limit value with 1 and thus keep the original value.
  • The second multiply node: Adjust the amount of mixing.

This group of nodes is used to control the mixing of colors, which are repeated with changed parameter which fits with the spread of the different colors used in the rock. The total node setup can be seen here.

spread node total

To give the finishing touch I add a noise texture to the displacement in order to give it some bump mapping. If you add a math node set to multiply in between, you can controle the degree of bump mapping.

In order to adjust the size of texture is used a Mapping node. Enjoy

Advertisements

18 Responses to Rock material

  1. Pingback: Tutorial: Procedural rock material | BlenderNation

  2. Nice material and good explanation. I really like it when people take the effort to produce a good, written tutorial instead of a quick video that is recorded without any script.

    One tiny thing: the final node setup is pretty complicated an may benefit from some simple layout tweaks to make it less cluttered, e.g. the mix shader nodes might be collapsed as they have all sockets connected and just take up space and someconnecting lines are very long an loop behind the nodes. These lines might benifit from ‘breaking; them with Shift-B which then allows you to rearrange those lines.

    Otherwise an excellent contribution, thank you for sharing.

  3. Congratulations for the blog, the idea is excellent. I totally agree with you, that few explanations are given on how to create good materials on blender tutorials.

    Just one suggestion, images from nodes trees are way too smal. Maybe if you use some sort of lightbox plugin for wordpress, the tutorials will be easier to follow.

    However, thanks for sharing

  4. rickyblender says:

    good beginning i like the end render it looks nice
    but node set up is very complicated
    also too many criss crossing lines difficult to understand it

    you can add box in line segment to control how and where line goes!
    like doing 90 degrees corner

    can you open a thread in blendernation forum
    it would be interesting to discuss this system of nodes
    might also be able to use some OSL nodes here!

    happy cycles

  5. M4x says:

    Hello, Cool quick tuto. Thanks
    But i can’t get readable version of the node network screenshot (image not big enough).

  6. Anonymous says:

    Excellent

  7. meloware says:

    Hurray for the written tutorial! Too many tutorials are just videos which cannot easily be used to review quickly. This tutorial is well explained and can be glanced at again at any time for a quick detail. I often need a quick answer and don’t want to sit through a 30 minute tutorial, only to discover the detail I need is missing. The blend file is also very important. It proves the feature in the user’s computer and Blender version. My only suggestion is that the blend file include a text window which includes the author’s credits, and a link to the tutorial. Well Done!

  8. For this kind of tutorial, this form is very understandable.
    The tutorials with intense use of the compositor need these “photos” of the nodes.

  9. powlly says:

    great tutorial,thank you.:)

  10. Excellent too and clearly explained!
    Thanks a lot, Friend!

  11. Joel Godin says:

    Thanks. Just a minor correction: Fac stands for “Factor” or multiple, not fraction, even though the results are the same for 0 to 1.

  12. Andreu says:

    Very nice tutorial! Thanks!

  13. Rasmus says:

    Thank you for the positive and constructive feedback. I will try to add the things that you have commented when we get into the new year. Have a Merry Christmas everyone.

  14. Shane says:

    Thought you may be interested to know that I made an OSL script based on this node setup. Makes the node tree a lot simpler. I also added the option to choose the noise texture used to get some more variety.
    https://github.com/sambler/osl-shaders/blob/master/stone/SARock/SARock.osl

  15. Javier says:

    First off, thanks a million for sharing the fruits of your hard work : )
    2nd, unfortunately I’m still a rookie when it comes to Nodes setups. That being said, can someone please enlighten me and tell me what the “Spread Texture” node is before giving it this label? I happen to have an image that I need to scale down (World, a sky image). I know I need the “Mapping” node, but I don’t know what node I’m missing in order to connect it to my “Environment texture-Background-World Output” noodle. All I know is that I can’t connect the Mapping directly to the Environment texture node, as it results in a total black preview.
    Thanks guys,

    JDL

  16. Javier says:

    Thanks for that Rasmus.

    JDL

  17. Anonymous says:

    Excellent article & Shader, thanks! I replaced the two lightest diffuse bsdf’s with a glossy and a refractive, as I think that rock will often have crystalline elements showing through in such a manner.

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 )

Google+ photo

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

Connecting to %s