Creating a synthetic sponge material with procedurals

In this recipe, we will create a polyurethane sponge material (the type that you usually find in kitchens), as shown in the following screenshot:

Creating a synthetic sponge material with procedurals

The synthetic sponge material when rendered

Getting ready

Follow these steps to create a synthetic sponge material with procedurals:

  1. Start Blender and switch to the Cycles Render engine.
  2. Select the default Cube, and in the Transform subpanel to the right of the 3D viewport (under Dimensions), change the values of X to 0.350, Y to 0.235, and Z to 0.116. Press Ctrl + A to apply the scale.
  3. With the mouse arrow in the 3D viewport, add a Plane to the scene (press Shift + A and navigate to Mesh | Plane). Exit Edit Mode, and in the Transform subpanel (the Dimensions item), set the values of X to 20.000 and Y to 20.000. Press Ctrl + A to apply the scale. Move the Plane down (press G, then press Z, enter -0.05958, and then press Enter) to act as the floor for the sponge.
  4. Select the Lamp item. In the Object data window, click on the Use Nodes button and change the type to Sun. Set the Size to 0.500, Color to pure white, and the Strength value to 5.000. In the Transform panel, set the values of Rotation value of X to 15°, Y to , and Z to 76°.
  5. Select the Camera item, and in the Object data window under the Lens subpanel, change the Focal Length value to 60.000. In the Transform subpanel, set the values of the Location value of X to 0.82385, Y to -0.64613, and Z to 0.39382. Change the Rotation values of X to 68°, Y to , and Z to 51°.
  6. Go to the World window and click on the Use Nodes button under the Surface subpanel. Click on the little square with a dot on the right side of the color slot, and from the menu, select Sky Texture. Change Sky Type to Preetham and set the Strength value to 0.100.
  7. Go to the Render window, and under the Sampling subpanel, set the Clamp Direct and Clamp Indirect values to 1.00. Set Samples for Render and Preview to 50.
  8. Split the 3D viewport into two rows. Convert the upper row to a Node Editor window. Split the bottom view into two parts and convert the left part to another 3D viewport. With the mouse arrow in the left 3D view, press 0 on the numeric keypad to go to the Camera view.
  9. Select the Cube, and with the mouse arrow in the Camera view, press Shift + S. Navigate to Cursor to Selected to place the cursor on the pivot of the Cube (if it's elsewhere). Add Lattice to the scene (press Shift + A and select Lattice). Press Tab to exit Edit Mode. In the Transform subpanel, under Scale, set the values of X to 0.396, Y to 0.264, and Z to 0.129. Go to the Object data window, and in the Lattice subpanel set the U, V, and W values to 3.
  10. Reselect the Cube and go to the Object modifiers window. Assign a Subdivision Surface modifier, switch the type of subdivision algorithm from Catmull-Clark to Simple, and set the Subdivisions value to 2 for both View and Render.
  11. Assign a Bevel modifier and set the Width value to 0.0010. Assign a Lattice modifier, and in the empty Object field, select the Lattice name. Reselect the Lattice object and press Tab to enter Edit Mode. Select the Lattice vertices that are indicated in the following screenshot:
    Getting ready

    The setup for the sponge scene in Solid viewport shading mode

  12. Scale the selected vertices on the x and y axes to slightly smaller values (press S, then press Shift + Z, enter digit .9, and press Enter). Then scale only the upper vertices to slightly smaller values, and similarly scale other vertices to obtain a shape similar to a kitchen sponge. Then exit Edit Mode (press Tab).
  13. Reselect the Cube, navigate to Tool Shelf | Tools | Shading, and select Smooth. With the mouse arrow in the 3D view, press N and T to close the Transform and Tool Shelf panels. Go to the Material window.

How to do it...

Now let's create the material by performing the following steps:

  1. First, select the Plane and click on New in the Material window under the main Properties panel or in the Node Editor toolbar. In the Material window, switch the Diffuse BSDF node with a Mix Shader node. In the first Shader slot, select a Diffuse BSDF node, and in the second Shader slot, select a Glossy BSDF shader node. Set Distribution of the Glossy BSDF shader to Beckmann, the Fac value of the Mix Shader to 0.400, and the Diffuse BSDF node's Color to a shade of blue (in my case, R to 0.110, G to 0.147, and B to 0.209).
  2. Now select the Cube object and click on Use Nodes in the Material window under the main Properties panel or in the Node Editor window's toolbar. Rename the new material sponge_polyurethane.
  3. In the Material window, switch the Diffuse BSDF node with a Mix Shader node. In the Label slot in the Node subpanel under the Properties panel of the Node Editor window (if this is not present, press the N key to make it appear), label it as Mix Shader1. Go to the Material window, and in the Mix Shader1 node's first Shader slot, select a Mix Shader node again. Label it as Mix Shader2. In the second Shader slot, select an Add Shader node.
  4. In the first Shader slot of the Mix Shader2 node, select a Diffuse BSDF shader node, and in the second slot, a Velvet BSDF node. Set the Diffuse BSDF node's Roughness value to 1.000 and the Velvet node's Sigma value to 0.600.
  5. Connect the output of the Velvet shader to the first Shader input of the Add Shader node. In its second Shader input, load a Glossy BSDF shader and set the Roughness value to 0.350.
  6. Add a Fresnel node (press Shift + A and navigate to Input | Fresnel) and connect it to the Fac input socket of the Mix Shader1 node. Set the IOR value to 1.496. Add an RGB node (press Shift + A and navigate to Input | RGB) and connect its output to the Color input sockets of the Diffuse BSDF, Velvet, and Glossy BSDF shader nodes. Set the RGB node's Color of R to 0.319, G to 1.000, and B to 0.435 (any other color is also fine), as shown in the following screenshot:
    How to do it...

    The basic shader component

  7. Add a Texture Coordinate node (press Shift + A and navigate to Input | Texture Coordinate), a Mapping node (press Shift + A and navigate to Vector | Mapping), two Voronoi Texture nodes (press Shift + A and navigate to Texture | Voronoi Texture), and two Noise Texture nodes (press Shift + A and navigate to Texture | Noise Texture). Label the textures as Voronoi Texture1, Voronoi Texture2, Noise Texture1, and Noise Texture2.
  8. Place the four textures in a row. Then connect the Object output of the Texture Coordinate node to the Vector input socket of the Mapping node, and the Vector output of this node to the Vector input sockets of the four texture nodes.
  9. Set the Scale value of the Voronoi Texture1 node to 38.000, the Voronoi Texture2 node to 62.300, the Noise Texture1 node to 300.000, and the Noise Texture2 node to 900.000.
  10. Add three ColorRamp nodes (press Shift + A and navigate to Converter | ColorRamp). Label them as ColorRamp1, ColorRamp2, and ColorRamp3. Connect the Color output of the Voronoi Texture1 node to the Fac input socket of the ColorRamp1 node, the Color output of the Voronoi Texture2 node to the Fac input socket of the ColorRamp2 node, and the Color output of the Noise Texture1 node to the Fac input socket of the ColorRamp3 node.
  11. Add four Math nodes (press Shift + A and navigate to Converter | Math). Set Operation to Multiply and label them as Multiply1, Multiply2, Multiply3, and Multiply4. Connect the Color output of the three ColorRamp nodes to the first Value input socket of the first three Multiply-Math nodes, and the Color output of the Noise Texture2 node to the first Value input socket of the Multiply4 node. Set the second Value input socket of the Multiply1 and Multiply2 nodes to 1.000, the second Value input socket of the Multiply3 node to 0.100, and the second Value input socket of the Multiply4 node to 0.050.
  12. Add a MixRGB node (press Shift + A and navigate to Color | MixRGB). Connect the output of the Multiply1 node to the Color1 input socket and the output of the Multiply2 node to the Color2 input socket. Change Blend Type to Add and the Fac value to 1.000. Label the Add-MixRGB node as Add1.
  13. Press Shift + D to duplicate the Add1 node, and label it as Add2. Connect the output of the Add1 node to the Color1 input socket. Then connect the output of the Multiply3 node to the Color2 input socket of the Add2 node.
  14. Press Shift + D to duplicate the Add2 node, and label it as Add3. Paste it between the Multiply3 and Add2 nodes, and connect the output of the Multiply4 node to the Color2 input socket of the Add3 node.
  15. Add a new Math node (press Shift + A and navigate to Converter | Math), set Operation to Multiply, and label it as Multiply5. Connect the output of the Add2 node to the first Value input socket of the Multiply5 node, and set the second Value input socket to 1.000.
  16. Connect the output of the Multiply5 node to the Displacement input socket of the Material Output node, as shown in the following screenshot:
    How to do it...

    The bump pattern

  17. Now box-select (press the B key and then click and drag the selection to enclose the objects) the ColorRamp1, ColorRamp2, Multiply1, Multiply2, Add1, Add2, and Multiply5 nodes. Press G and move them to the right to make room for new nodes on the left side.
  18. Add an RGB Curves node (press Shift + A and navigate to Color | RGB Curves) and paste it between the Voronoi Texture1 node and the ColorRamp1 node. Label it as RGB Curves1. Click on the curve to add a control point, and in the coordinate slots below the node window, set the X value to 0.26111 and the Y value to 0.50000. Click to add a second control point. Set X to 0.73889 and Y to 0.51111.
  19. Press Shift + D to duplicate the RGB Curves1 node. Paste it between the Voronoi Texture2 and ColorRamp2 nodes. Label it as RGB Curves2.
  20. Go to the ColorRamp1 node and move the white color stop to the 0.240 position. Then go to the ColorRamp2 node and repeat this step. Next, go to the ColorRamp3 node, move the white color stop to the 0.550 position, and set Interpolation to Ease, as shown in the following screenshot:
    How to do it...

    Tweaking the bump pattern

How it works...

  • From steps 2 to 6, we built the basic shader for the sponge material and the color. As you can see in the Rendered camera view, without the bump pattern, there is a visible artifact in the more distant side of the mesh. This is due to the Smooth shading we set in step 13 of the Getting ready section. Setting the shading to Flat again would remove the artifact, but would also show the blocky faces of the deformed sponge mesh. In this case, because of the bump pattern and the fact that the mesh is subdivided, this is not a major issue, and both solutions (smooth but with artifacts or flat but blocky) are fine.
  • From steps 7 to 20, we built the sponge bump pattern by mixing Voronoi Texture nodes at different sizes, with increased contrast due to the ColorRamp nodes. Then we add some noise to avoid a highly smoothed surface.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.147.158