250 Game Development and Simulation with Unreal Technology
culation.
Hardness Percent: This value spec ifies the transition area size.
Inputs
A: This input takes i n the posi tion of th e point to c h e c k.
B: This input takes in th e center of the sphere.
Example Usa ge: You can connect this expression to control the opacity channel
of a material, when the object becomes farther than a certain distance from
the camera, it will fade away and finally disappear (see Figure 4.79).
FIND ON THE WEBSITE
To find updates to this tutorial and upda te d instructions about its implementa-
tion on othe r UE4 versions, p le ase visit the books companion Website at:
http://www.RVRLAB.com/UE4Book/
TUTORIAL 4.7 Materials with Time Varying Effects III: Black Body
Radiation
In this tutorial we will learn how to use a couple of Utility expressions to
simulate physically re alistic dynamic effects in our materials.
BEFORE YOU PROCEED
Before you proceed with this Tutorial, and you have not finished Tu-
torial 4.1 on page 150, please go ahead and complete it. In order to
view the effects we will create in this Tutorial, we need the De mo
Room to h ave been included in our project.
ORGANIZING ASSETS AN D PLACING THE DISPLAY ITEM
We will place a Display Item in the Demo Room and place three me shes on it,
so that we could demonstrate our creations later.
1. If you have not finished Tutorial 4.1 on page 150, please go ahead and complete
it. We will ne ed the Demo Roo m to have been included in our p roject.
2. In the con te nt browser, loo k for a folder inside the Demo Room folder called
Blueprints and open it.
3. Drag a copy of Display Item onto the level and place it to along a wall. Change
its properties to the following:
Materials in Unreal Engine 251
Number: 6-M.
Description: Black Body Materials. . .
Type: Square-L
4. In the con te nt browser, look for a folder c alled Props and open it.
5. In the Props folder, look for and find a mesh called SM_MatPreviewMesh_02
and drag it into the Display Item you have already placed in the Demo Room.
6. Rotate, scale, and position the mesh so that it faces outwards from the Display
Item.
7. Alt-Drag the mesh to cr eate two copies of it on the Display Ite m (see Figure 4.36
on page 165). You can alternatively copy and paste the mesh in the editor on the
Display Item.
8. Save your level so far.
CREATING TH E BASE MATERIAL’S DIFFUSE NETWORK
We now have a display item and three meshes in the level to demon stra te our
progr ess as we go along in this tutorial.
9. In the Content Browser, find your materials folder you have created in earlier
tutorials. If you do not have one, Right-click on the Game folder, create a new
folder and call it MyMaterials.
10. Double-click o n the MyMa terials folder to open it up.
11. Create a New Material in this folder a nd call it M_BlackBody_St atic.
12. Double-click on the newly created M_BlackBody_Static material to open in
in the Material Editor.
13. The base material we will create now for o ur M_BlackBod y_Static will use
a utility expression called Black Body. This expression is used to simulate the
amount (and color) of light radiated from a hot surface at a particular temperature.
14. In the Material Editor, Left-click to the left of the Base Color and place a
Black Body expression. Make the following changes to this Texture Sam ple
expression in its Details Panel:
Description: Type i n the text Body Radiation.
15.
Place a Constant expression to th e left of the Body Radiation (hold 1 and
Left-click). Make the following changes to this expression in its Details
Panel:
Value: 1000.
Desc: Temp1.
16. Make the following conne ctions:
252 Game Development and Simulation with Unreal Technology
Temp1 output Body Radiation Input.
Body Radiation output Bas e Color channel of material node.
Body Radiation output Emissi ve Color channel of ma te rial
node.
17.
Your material network and its simulation preview should look like Figure 4.80(a).
18. Save your material.
(a)
(b)
FIGURE 4.80: The Black Body Radiation at (a) 1000
Kelvin and (b) 3500
Kelvin.
19. Place another Constant expression below the first on e (hold 1 and L eft-click).
Make the following ch anges to this expression in its Details Panel:
Value: 3500.
Desc: Temp2.
20. If you connect the output of th e Temp2 to the input of the Body Radiation, your
material will glow with a bright yellow-white color (see Figure 4.80(b)).
We now have two temperatures in ou r network (1000
K and 3500
K) for our
black body. Next, we will set up a network to interpo la te b etween these two
values as if the body is ma de of a combination of hot/co ol materials, just like
the surface of a star.
Materials in Unreal Engine 253
21. Place a Lerp expression between th e two Constant expressions and the Black
Body expression and make the following connections:
Temp1 output Lerp A channel.
Temp2 output Lerp B channel.
Lerp output Body Rad iation inpu t channe l.
22.
Place a Textu r e Sample expression below the two Constant expressions
(Temp1 a nd Temp2) and make the following changes in its details rollout:
Texture: T_Perlin _Noise_M.
Desc: Body Composition.
23. Make the following conne ctions:
Body Composition Re d output Alpha channel of Lerp.
FIGURE 4.81: The Blackbody Material Static Interpolations.
24. Save your material. Your material should look similar to Figure 4.81 so far.
Our b ase ma te rial’s diffuse network is created. It is responsible for creating
the black body radiation on the sur face to wh ic h it will be applied.
CREATING TH E DYNAMIC PATTERN
Now that we have our base material, it is time to make a duplicate so that we
can keep our original ma te rial. We will then create a n etwork based on dynamic
Coordinate expressions to make the new copy of our material dynamic.
25. We do not want to make any changes to our Base M aterial (we called it
M_BlackBody_Static) as we will use it in the level for comparison later. So
let us first duplicate it and work the next steps on the duplicated material.
26. In the Content B r owser, Right-click on the material M_BlackBody_Static
and choose Duplicate.
254 Game Development and Simulation with Unreal Technology
27. Rename the duplicate Material to M_BlackBody_Dynamic.
28. Double-c lick on the M_BlackBody_Dyna mic material to open it in the mater ia l
editor. I t should be identical to your M_Panels_Stat ic material you have so far.
29. We will now establish movement and tiling on our texture. We would like to
achieve this without the need to make any changes to our geometry.
30. Disconnect the Body Composition texture expression (the blac k an d white noise
texture) from the Alpha channel of the Lerp expression. NOTE: To disconnect a
link press Alt key and Left-click on either en d of the connection .
31. Move th e texture to the left (about half a page’s le ngth) so that we can build our
network in the free space.
32. Rename the texture sample to Macro Compositio n1.
33. Place a Panner to the left of the Macro Composition1 and set the following
properties in its de ta ils ro llout:
SpeedX: -0.005
SpeedY: -0.005
Desc: MacroPan1.
34. Place a TexCoord expression to th e lef t of the MacroPan1 and set the following
properties in its de ta ils ro llout:
Coordinate Index: 0
UTiling: 0.1
VTiling: 0.1
Desc: MacroTexture1 .
35. Make the following conne ctions:
MacroTexture1 Output Coordinates channel of MacroPan1.
MacroPan1 Output UVs channel of Macro Com position1 .
36.
Your Coordinate Modification network should look similar to Figure 4.82.
37. Marque select (Left-click and drag the mouse to select) the three expressions,
MacroTexture1, MacroPan1, and Macro Composition1.
38. With these expression selected, duplicate them b y pressing Control+W.
39. Make the following changes in the duplicate of MacroTexture1 details rollout:
Coordinate Index: 0
UTiling: 1.0
VTiling: 1.0
Desc: MicroTexture1 .
40. Make the following chang es in the duplicate of MacroPan1 details rollout:
..................Content has been hidden....................

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