UE4 Intro To Materials - Page 15


Index



A Practical Master Material Part II


  1. Scroll over to Room 9 which is misnamed to Room 8. Click on World Outliner | Room 9 | Title3 in the game and change the room number to 9. Go to Static Meshes | SM_MatPreviewMesh02 and put a copy in the room.
Create new sprite with button

  1. Right click on M_Base_Master and select Create Material Instance and call it MI_Cobblestone.
Create new sprite with button

  1. Add the material to the static mesh. It might look hideous. So lets double click our MI_Cobblestone and make some changes. Make sure the Emissive mask off, Make Metallic 0 and turn off its mask. Make Roughness 1 and turn off its mask. Change the UVs to 2,2. Turn on the Normal Map and select the `T_CobbleStone_Rough_N** texture. Press Save and check it out in game.
Create new sprite with button

  1. Go back to the game and drag the MI_Cobblestone to the static mesh in the level.
Create new sprite with button

  1. Now we can make this even better. Open M_Base_Master. We can alter the size of the intensity of the normal. Create 2 Constant Vector 3 and make one 1,1,0 and the other 0,0,1. Take the output of the Yellow Vector 3 and plug into the A side of a Multiply node. Add a Scalar Parameter called Normal Intensity set to 1 with a Group set to Normal. This feeds into the B side of the Multiply node:
Create new sprite with button

  1. Put an Add node and feed the B side with the output of the above multiply and the A side with the output of the Blue constant:
Create new sprite with button

  1. Add a Multiply node. Now take the Output of the Add node and connect it to the B side of the multiply node. Add the output of the normal texture to the A side. Then send the output of the multiply to the Switch true input.
Create new sprite with button

  1. When you have complicated nodes you can have comments within comments. I would select the nodes that affect intensity and give it its own comment:
Create new sprite with button

  1. Press the Apply button. Lets go into the MI_Cobblestone and set the Normal Intensity in the material instance to a large number like 30. Go to the game and look at the result. Hmm, it is more intense but it looks funny:
Create new sprite with button

  1. Look at the graph and see if you can spot the problem. We have not connected the UV pins in anything except the diffuse texture. Connect the output of the UV bank Adjust UV Coordinates Switch Parameter to the input UV of the main normal texture. Press the Apply button.
Create new sprite with button

  1. Do the same thing for the textures in Metallic, Roughness and Emissive. Make sure UVs get sent to all your textures:
Create new sprite with button

  1. Compile your main material and set the intensity on the instance to 3:
Create new sprite with button

  1. The normal looks more intense and lines up properly with the diffuse texture:
Create new sprite with button

  1. Try a normal intensity of .5 and you should see a much less prominent normal. Cool! Go back to an intensity of say 2.
Create new sprite with button

  1. Lets add another common technique. Surfaces can be complex and have many underlying patterns. We can create a Detail Normal map to add even more subtlety to the bump. Add another Static Switch Parameter and call it Use Detail Normal? and group it to Normal. Then add a Blend Angle Corrected Normal:
Create new sprite with button

  1. We use the blend angle correction as you cannot add normals or multiply normals like colors. More sophisticated math is hapenning under the hood. Suffice to say that this combines two normal outputs into one and acts like adding two normals together. Take the output of the Switch for detailed normal and the output of the Switch for the normal map and put them into the two input pins of the Blend Angle Corrected Normal. Connect the output back to the Normal input in the main node.
Create new sprite with button

  1. Take the same output of the Constant Vector 3 that is 0,0,1 and add it to the False input of the Switch for the detailed normal. This will add nothing if this is set to false.
Create new sprite with button

  1. Add a Multiply node and connect the output to the True input to the detail normal Switch:
Create new sprite with button

  1. Add a Texture Sample Parameter 2D node and call it Detail Normal Texture, put it in Group Normal and assign T_Detail_Rocky_N to it:
Create new sprite with button

  1. This will not connect to the normals of the larger texture. We can set up separate UV’s for the detail so it repeats over different sizes. Copy and paste the Texture coordinate group minus the switch and paste it by the detailed normal like so. Make room by scaling up your comment box so it all fits:
Create new sprite with button

  1. Rename the parameters to Detail U Scalar and Detail V Scalar. Change both Groups to Normal. Connect the output of the Multiply to the UV input of the detail texture:
Create new sprite with button

  1. Now we want to control the intensity of this detailed normal. Lets copy and paste the intensity from the normal like so:
Create new sprite with button

  1. Rename the Scalar to Detailed Normal Intensity and change the Group to Normal. Add an Add node and hook up the blue channel to the top and the output of the multiply node to the bottom. Channel the output of the Add node from the Intensity group to the multiply node before the Switch:
Create new sprite with button

  1. Rename the comment:
Create new sprite with button

  1. Your normal graph should look like:
Create new sprite with button

  1. Now press the Apply button on your master and return to your material instance. Make sure your Use Detail Normal is set to true. Play around with the UV’s and Intensity to get an effect you like. You can see this previewed on the sphere in the instance editor:
Create new sprite with button

  1. Now you have a really detailed rock in game:
Create new sprite with button

  1. Lets see how flexible this master material can be. Lets copy and paste the Static Mesh in the game so we have a second copy:
Create new sprite with button

  1. Now create a new Material Instance from the base master material:
Create new sprite with button

  1. Call it MI_Brick_Hewn_Stone. Assign this new material instance it to this new static mesh.
Create new sprite with button

  1. Double click the material instance and assign as the Diffuse texture T_Brick_Hewn_Stone_D:
Create new sprite with button

  1. Turn on Use Metallic Mask and assign T_Brick_Hewn_Stone_M
Create new sprite with button

  1. Make sure the Roughness is set to .5.
Create new sprite with button

  1. Assign the Normal map for the texture T_Brick_Hewn_Stone_N:
Create new sprite with button

  1. If you want set the Detail Normal to your liking:
Create new sprite with button

  1. Now save the instance and go ingame to see your two stones using the same master. On the next page we will create a third example!
Create new sprite with button



<- Previous   Home    Continue ->