In this recipe, we will create a classic white expanded polystyrene material, as shown in this screenshot:
The white expanded polystyrene material as it appears in the final rendering
Getting ready...
First, let's prepare the scene:
Start Blender and load the 9931OS_Suzanne_start.blend file. Add a Cube primitive to the scene and place it leaning on the Plane, close to Suzanne. Move it upwards by 1 Blender unit.
With the mouse arrow in the Camera view, press Shift + F to enter Walk Mode (in this mode, you can press the W key to go forward, press S to go back, move the mouse to decide the direction, and click or press Enter to confirm). Adjust the Camera position so as to center the two objects in the frame.
Select the Cube object and go to the Object modifiers window. Assign a Boolean modifier.
Press Shift + D to duplicate the Cube, and move it a bit upward (press G, then press Z, enter .4, and press Enter). Reselect the first Cube, and in the Object field of the Boolean modifier panel, select the second Cube (Cube.001). Set Operation to Difference. Go to Edit Mode and scale all the vertices a bit larger on the x and y axes (press S, then press Shift + Z, enter 1.200, and press Enter).
Exit Edit Mode and reselect Cube.001. Move it a bit on the x axis (press G, then press X, enter .4, and press Enter).
Go to the Object window and set Maximum Draw Type to Wire. Then go to the Ray Visibility subpanel (usually at the bottom) and uncheck all the items. This way, Cube.001 becomes visible in the 3D view, but is not yet rendered in the preview.
Just to be sure that the second cube is not visible (the previous step should be enough for the final rendering), go to Outliner and click on the camera icon to the right of the Cube.001 item.
Select the first Cube and assign a Bevel modifier. Set the Width value to 0.0200. Move it higher in the stack of modifiers and place it before the Boolean modifier.
Assign a Subdivision Surface modifier and set both the Subdivisions levels to 2. Check the Optimal Display item and move it higher in the stack. Place it before the Boolean modifier but after the Bevel modifier.
Press T to call the Tool Shelf panel. Set the Cube shading to Smooth.
Press Shift, select both Cube and the Cube.001 objects, and rotate them on z axis towards the Camera (press R, then press Z, enter -40, and then press Enter).
Press T to close the Tool Shelf panel. The following screenshot shows the process of building the box object:
Building the box object by a Boolean modifier
Select the Plane object, and in the Material window, switch the Diffuse BSDF shader with a Mix Shader node. Then, in the Shader slots, select a Diffuse BSDF node and a Glossy BSDF shader node. Add a Layer Weight node (press Shift + A and navigate to Input | Layer Weight) and connect the Facing output to the Fac input socket of the Mix Shader node. Set the color of the Diffuse BSDF node as follows: R to 0.530, G to 0.800, and B to 0.800.
How to do it...
Now we are going to create the material by performing the following steps:
Select Suzanne and click on New in the Material window under the Properties panel or in the Node Editor toolbar. Rename the material Plastic_expanded_polystyrene.
Switch the Diffuse BSDF shader with a Mix Shader node, and in the first Shader slot, select a Diffuse BSDF shader. In the second Shader slot, select a Glossy BSDF node.
Set the Diffuse BSDF shader color and the Glossy shader color to pure white. Set the Roughness value of the Glossy BSDF shader to 0.600. Add a Fresnel node (press Shift + A and navigate to Input | Fresnel). Connect its output to the Fac input socket of the Mix Shader node. Set the IOR value to 1.550.
Add a Voronoi Texture node (press Shift + A and navigate to Texture | Voronoi Texture), a Texture Coordinate node (press Shift + A and navigate to Input | Texture Coordinate), and a Mapping node (press Shift + A and navigate to Vector | Mapping).
Connect the Object output of the Texture Coordinate node to the Vector input of the Mapping node, and the output of this node to the Vector input of the Voronoi Texture node.
Set the Voronoi Texture node's Scale value to 25.000. Add a Bump node (press Shift + A and navigate to Vector | Bump). Connect the Fac output of the Voronoi Texture node to the Height input socket of the Bump node, and the output of this node to the Normal input sockets of the Diffuse BSDF and Glossy BSDF shader nodes.
Check the Invert item on the Bump node and set the Strength value to 0.500, as shown in the following screenshot:
The white expanded polystyrene material network
Press Shift and select the Cube object and Suzanne. Then press Ctrl + L, and in the Make Links pop-up menu, select the Material item to assign the material of the active object to the other object.
Save the file as Plastic_expanded_polystyrene.blend.
How it works...
You have probably noticed that this recipe is simply a variation of the generic plastic shader. We changed the color to white, and instead of Noise Texture, we used a Voronoi Texture node with a different scale to add the typical polystyrene pattern. Then, by increasing the Roughness value of the Glossy BSDF shader, we made the specularity more diffused.