This material uses the sine function to produce a metal grid - the sort of material that might be used as a floor in an industrial or sci-fi setting. The same sine wave that produces the grid also allows us to control the colour of the materials between the bars of the grid (cosine would do just as good a job). Figure 1 shows what we are trying to achieve.

Fig 1: Controlled Color Maths


Fig 2: Controlled Color Maths

Step 1: Create our waves

This material is driven by a sine wave. To produce that wave, create either a U or V node (which one you want will depend on the direction you want the grid to run). Next, create a maths node, set the function to Sin, and plug the U or V node into Value_1 of the sine node. Finally, value_1 controls how many bars we will get across our grid - the higher we set the number, the more bars we will get (a value of nine will get two bars and one gap. Increase that by about six to add another gap and bar).

Step 2: Adjust the range of the waves.

We now have our sine waves. At the moment that wave produces numbers that run from -1 to 1. We need to alter that to get our flat topped bars and flat bottomed gaps. We will start with an Add maths function. Our add node will do two things. First, we will use Value_1 to multiply the output of the sine wave, controlling how much of it will eventually be above 1 or below 0, and thus cut off in Step 3 to produce our flat areas. Second, we will use Value_2 to add 0.5 to the output of the sine wave, moving it up so that it is centred around 0.5 instead of 0. If we don't do this, then the gaps will be twice the width of the bars.

The number we choose for Value_1 will control how wide the flat areas are. Set Value_1 to 0.5 and there will be no flat areas - our sine wave will run from 0 to 1, leaving nothing for the blender node to strip out. Above 0.5, the higher we set Value_1, the wider the flat area will be, as more of the sine wave will be either below 0 or above 1. I have chosen 0.6 in this example to give us a reasonably large flat area but also clearly sloping sides.

Step 3: Cut off the tops and bottoms.

Now we need to cut off the top and bottom of the sine wave. We are going to use the blender node to do this. As you can see in Figure 2, we are using two blender nodes, one to control the displacement and one to control the colours. At this stage the two nodes are identical. Simply plug the output of the modified sine wave from our Add node into the Blending node of both blender nodes. Anything about 1 or below 0 is ignored by the blender node - you can't have more than 100% of colour 1 or 100% of colour 2.

Step 4: The Displacement

In both blender nodes, we have set Blending to 1 and both colours to white. Input_2 we will leave as unmodified white - we want this part of the map to stick up the most. A noise node is plugged into Input_1. On the noise node, Max has been set to 0.2, so our noise node gives us a random mix of black and dark gray. At the bottom of the grid, where the modified sine wave produces zeros, this noise node will control all of the displacement. As we move up the sides of the wave, the noise will be blended smoothly into the white, so the nearer we get to the top of our grid, the smoother the displacement will be. On the flat surface, where the cut-off sine wave is equal to one, the noise node is ignored.

Finally, plug this blender node into the Displacement input on the Poser surface. You will need to experiment with the correct value to use on the displacement input - our value of five produces Figure 1 when this material is applied to the poser floor prop, so will almost certainly need to be much lower for most props. Don't forget to turn displacement on in your render options.

Step 5: The Colours

Our colour is controlled in the same way as our displacement. Here I have plugged a cloud node into Input_1 of the top blender node and set the cloud and sky colours to green and brown to get a simple mix of mud and slime. Plug this into the Diffuse_Color input. Feel free to use any material you want here.

Possible Variants

Use Cosine instead of Sine if you want your first bar to start right in the middle of a bar.

If you want entirely smooth bars, then delete the noise node, and set Input 1 of the bottom blender node to black.

Plug an abs maths node between the add node and the blender node to produce bars much closer together with narrow gaps (could be used for planks with the right colours).