Since the early days of procedural texture creation, marble was always a favorite for both artists and developers.
Here is our take based on the new Marble and Checker patterns introduced in Material-Z v0.94.
The material we will create is the same as the "Marble Tiles" material in the database.
Shapeable patterns inside Material-Z allow you to inject a shape into the pattern, like a tile (which is the default shape for most patterns). In the "Available Sources" list shapeable patterns are identified by an "S". A "T" indicates that they are also tileable.
Patterns which are not shapeable just create a predefined pattern, like the Marble pattern we will use here in this tutorial. You can also use normal patterns and feed them into a shapeable pattern.
Rename your Material to "Marble Tiles" by double clicking on the titlebar of the material.
Drag and drop a Marble source from the pattern category into the first slot of the first layer of the material.
Drop a shapeable Checker source (also from the pattern category) into the slot next to the marble source.
And for the rightmost slot in the layer, insert a Split source (operator category).
Select the Checker pattern and change it's "Cells" property from 6 to 4. This will make the size of the checkered cells a bit larger. The cells property defines how many cells or shapes the pattern creates vertically.
Select the Split operator and change it's component property to "y" as we are only interested in the pattern and not the tiling ID or direction angle of the pattern.
The material should now look like this.
So what did we do here ? First we added a marble pattern and use it as the input for the Checker pattern. The checker takes the marble input and creates many small tiles of individual marble patterns. Also it rotates every second cell by 90 degrees.
The Split operator makes sure we only use the pattern itself, the "x" component holds a unique id for the cell and the "z" it's direction, but we are not interested in these right now.
Now, drag a Tile source from the shape category to the next layer (when dragging the mouse to the bottom of the current layer a white line will appear to indicate that a new layer will be created). Place another Checker pattern next to the tile source.
Select the new Checker pattern and change it's Cell property also to 4.
Drag a Split operator to a new layer (this is important) and again select it's Y component. Connect the output of the Split operator to the bump property of the material.
The material should now look like this.
If we render it:
You can see that we used the second checker for the bumps of the marble tiles. However the tiles are too far apart and the bumps too big.
Select the checker pattern in the second layer and change it's "Gap" property to 0.01. It would also be nice to have a little bevel effect on the tiles, select the tile shape and set it's "Bevel" property to 0.06.
To reduce the bump height, drop a "Multiply" operator next to the split operator in the 3rd layer and change it's global value to 0.1.
This looks more like it, but without any marble patterns it is rather boring.
Adding the Marble Pattern
Believe it or not, we are just 3 more sources away from a good looking marble material!
Add a new Split operator to a new, fourth layer and connect it's white input terminal to the black output terminal of the second layer.
Drop a Clamp operator next to the split operator.
Drop a "Masked Color Blend" source from the Mixer category into a fifth and final layer. That's it, we have all the sources we need.
Now, we need to connect the terminals of the "Masked Color Blend" source. Connect it's white "Pattern" input with the output of the very first layer, connect it's "Mask" input with the output of the preview, fourth layer and connect it's black output terminal to the "Base Color" material property.
The final material node should now look like this:
So what did we do here ? In the fourth layer we did split the rotation angle from the checker pattern. Which is 0 for the black tiles and 90 for the white tiles (as they are rotated by 90 degrees). However, as we want to use this as a mask, we need values between 0 and 1, that is what the "Clamp" operator is for, it limits / clamps the values between 0..1.
Now, the magic all happens in the "Masked Color "Blend" source. It blends/mixes two colors based on it's pattern input and switches between two alternative sets of colors based on it's mask input.
Let's have a look at this in detail with the texture output of the base color:
The two default color sets for the masked color blend are white/black and black/white. This results in an alternating pattern of a white background and black cracks and a black background and white cracks.
Let's fine tune all of this a bit. First, I think the marble cracks are a bit too small for the size of the tiles. Select the very first source in the node, the Marble pattern, and set it's "Cells" property from 4 to 2. This makes the crack patterns larger (the cells property controls the number of vertical cells).
That is better.
However there is room for improvement. The white veines on the black background are a bit too pronounced while the black veines on the white background are not visible enough. Also, the white background is a bit too white.
We can change all this in the properties of the "Masked Color Blend" mixer. Select it and change the values like in this screenshot:
We changed the white color in the Color Set 2, which defines the white background.
We also changed the "Power" properties for the two color sets. Reducing the power to 0.3 for the first sets will make the white veins less pronounced and the 2.0 value for the black veins will make them more pronounced.
Adjusting Material Properties
Not bad. But we still have to adjust the material properties.
Select the Material tab and change the Roughness from 1.0 to 0.15 and the Specular value to 0.20.
Materials which are less rough reflect more light! Play around with the values to see how they affect the material.
We hope you liked this tutorial!