UE4 Intro To Materials - Page 8


Index



Translucent Blend Mode


  1. Some objects like glass need to be translucent. Now in games we want to try and limit how many we use. This material is very expensive computationally and should be used with discretion. Create a new material called M_Translucent and place it in your Materials folder.
Create new sprite with button

  1. Go to the Textures folder and add CircleMask_T to the game and rename it to T_CircleMask_T.
Create new sprite with button

  1. Open the M_Translucent material and add a Texture Sample node:
Create new sprite with button

  1. Assign the newly dowloaded Texture called T_CircleMask_T Now for the mask we see the gray. This will be partially opaque. The white rings will be completly opaque and the black will be transparent like in the previous mask. Now it is greyed out so we need to change the blend mode. We cannot hook the pin up to Opacity as the blend type is wrong.
Create new sprite with button

  1. Change the Blend Mode in the Details panel to Tranlucent and hook the output of the texture to the Opacity pin in the shader.
Create new sprite with button

  1. Now go into the game and test it out. Add another cube to the scene and bind the latest Material we just created. Lets add some color and make the inside of the cube visible:
Create new sprite with button

  1. Play the game to look at it. Lets add a color to it and also fix the same two sided problem we had on the previous mask.
Create new sprite with button

  1. Lets add some color and add Two Sided to the modes panel. Add a Constant Vector 3 node, select a nice color and hook it up to the Base Color node. Make sure Two Sided is checked under Material in the Details panel:
Create new sprite with button

  1. Go back to the game and it looks better. But it doesn’t cast a shadow.
Create new sprite with button

  1. There are two things we need to do to fix this. Go back to the Material and change the Lighting Mode to Surface Translucency Volume.
Create new sprite with button

  1. Then go into the game and select the cube you previously created. Go into the details panel. Go to the Lighting section and there is a downward arrow under Shadows. Click this to expand the selection.
Create new sprite with button

  1. Look for the Radio Button that has Volumetric Translucent Shadow and make sure it is selected.
Create new sprite with button

  1. Go into the game and play it and look at the cube. We have a nice soft shadow next to the hard ones!
Create new sprite with button

  1. Lets Save All, Build the lighting and open GitHub Desktop. Commit the last set of changes and push them to the server. We are now done with room 3!
Create new sprite with button

Illumination

Now for some objects in the game, they will also be a light source. Think of the sun, a lamp, a TV set etc… So our materials can handle light blooms and glow to create the illusion that it is illumiating in game. To really sell this effect we also need to add a game light to actually light the scene. We will do this but we will work the entire pipeline from a final FBX to a model in the scene.


Importing a Model


  1. Look at your Files Needed for Walkthrough | SpotlightModel model folder. We have a .fbx file which is the 3-D model. Then we see the .png files which are all of our texture maps. The _D is diffuse, .N is normal, the .I is illumination (which we will be introducing here), _Rough is the roughness, and there is a new one _AO. This stands for ambient occlusion). This is a “technique used to calculate how exposed each point in a scene is to ambient lighting.” - Wikipedia
Create new sprite with button

  1. Now go the Textures folder and press the Import Button. Import only the .png files for now:
Create new sprite with button
  1. Your folder should now look like:
Create new sprite with button

  1. Import the Import | SpotlightModel | Spolight.fbx into this folder.
Create new sprite with button

  1. If it gives you a material you can delete it. You should end up with a bracket and lamp mesh. They are separate meshes so we can rotate the lamp at different angles:
Create new sprite with button

  1. Now is a good time to hit the Save All button to lock in our work. Notice that the new assets all have an Asterix next to their icon. This means they are not saved. Once we press Save All these go away. The game does crash so it is important to save often so you don’t lose any work.

    Rename the files to SM_Spotlight_Bracket and SM_Spotlight_Lamp.
Create new sprite with button

Bracket Material


  1. Lets go to the Materials folder and create a new Material called M_BrushedSteel.
Create new sprite with button

  1. Open up M_BrushedSteel Add a Constant Vector 3 node with .913, .921 and .915 as the RGB values:
Create new sprite with button

  1. Add a Constant node with a setting of 1 and plug it into the Metallic node:
Create new sprite with button

  1. Repeat this for Roughness but make the roughness .4 and connecxt the node.
Create new sprite with button

  1. Double click the Spotlight_bracket Static Mesh. Assign the material you just created:
Create new sprite with button

  1. Go to Room 4 and drag both meshes (with both selected) into the game. You can press F for focus to get the camera close to where they go in the scene. Move them to be close to the wall. Rotate the lamp part to point at the wall so we can have a light shine on it.
Create new sprite with button



<- Previous   Home    Continue ->