UE4 Intro To Materials - Page 6
- Go back to your M_Office_Carpet_Master and we want to add two scalar paremeters one for Metallic and one for Roughness. Now we previously added a Vector for a single float. You can right click and select a Scalar Parameter:
- Lets do the second one with the other method. Press the 1 keyboard button and left click. Right click on the node and select Convert to Parameter:
- Change the name and group of the top one to
Metallic and the name and group of the bottom node to
- Now select both nodes and press the C key on the keyboard and give it an appropriate comment. Connect each node to the main node:
- Set the default roughness value in the Details panel of the Roughness node to 1. Leave the metallic at 0.
- Press Apply and Save on the master material. Now double click on MI_OfficeCarpet_Blue. Now you will see these two extra parameters. Invert the roughness and metallic values and make it a mirrored like surface:
- Now run the game and look how even with the same material parent, we can change the properties in a way that is less expensive than having two separate materials:
Normal Map Parameter
- Open M_OfficeCarpet_Master and right click in the main area. Select another Texture Sample Parameter 2D to hold the normal map:
- Assign the normal map texture to the Details Panel. Name the node
Normal Map as well as the group. Link the node to the Normal Map slot in the main Material node.
- Now press Apply and Save and go to the game and see if it works. The bump is most evident on the reflective surface where light reflects off the high portion of the carpet:
- Now lets go back to M_OfficeCarpet_Master and make the UV’s adjustable in the instances. Add a new Texture Coordinate node. Now we can’t promote this node to a variable so we will have to multiply it. When you multiply 2 UV floats by 1 scalar you can adjust the U and V by the same amount. So if the UV are both set to one and the scalar to 8 then we would be a UV of 1 * 8 and 1 * 8 for a U of 8 and V of 8. So lets add a multiply node:
- Now add a Scalar Parameter and call it
UV Multiplier. Set it to Group
UV and connect the nodes so that you multiply the scalar by the coordinates as so:
- Now connect the end of the multiply pin and attach it to the UV input of both the diffuse and normal textures:
- Add an appropriate comment and clean up the nodes. Press the Apply button when done.
- Open up MI_Office_Carpet_Red and turn the UV Multiplier on and change the value to
.01 making the repeat less frequent and scaling the texture WAY up.
- Now go back to the game and hit play. Please note these settings are not created to look good but different. This demonstrates how many looks we can create with a master material. Also note that we could change the textures entirely and put them on another object that has a material that needs simple tiling with some controls. It is not limited to this carpet mesh.
- Go to the materials folder and create a new Material Instance from M_OfficeCarpet_Master and call it
- Now double click the newly made Material Instance and select a new Diffuse Texture. There is an Unreal Texture included in the Supplied Content folder called T_Rock_Slate_D.
- Change the Normal Map and select T_Rock_Slate_N.
- Change Metalic, Roughness, UV Multiplier and Diffuse Color to your liking. I look at the sphere and am happy with the results.
- Now go into the game and make a copy of the small carpet. Move it in front. Select the new MI_Slate in the Content Browser and assign it to this fourth carpet.
- Now go into the game and run it. Now you can see that we can use a material instance on different textures can look completely different but use the same master.
- Now would be a good time to press Build and rebuild the lighting in the room. Also press File | Save All to save everything you have done.
- We probably should have updated GitHub when we finished the first room. But lets load GitHub Desktop and make sure you load this project. Unselect all the files. Pick each separate file and right a commit message that describes what you did. Do either a group of files or one file at a time based on what works well together. When you have commited all the files upload them to the server. Press the Push Origin button on the top right hand corner. This way if you lose your data it is stored on the servers at GitHub.
<- Previous Home Continue ->