WEBVTT 1 00:00:05.675 --> 00:00:09.825 Game Advanced Beta Type Version 2 2 00:00:29.275 --> 00:00:34.175 Hello everyone, this is Park Hyun sang, responsible for FPS game development lessons 3 00:00:34.175 --> 00:00:36.775 In this lesson, I will be giving a lecture on 4 00:00:36.775 --> 00:00:40.825 light mapping and optimization 5 00:00:41.375 --> 00:00:44.225 As you reach the beta version and continue development, 6 00:00:44.225 --> 00:00:46.325 you naturally end up adding 7 00:00:46.325 --> 00:00:48.725 a lot of graphic resources to the project 8 00:00:48.725 --> 00:00:51.925 However, in a real time rendering environment, 9 00:00:51.925 --> 00:00:55.325 unlimited resource usage is not feasible 10 00:00:56.275 --> 00:01:00.125 Therefore, we will learn how to optimize 11 00:01:00.125 --> 00:01:03.775 various graphic resources such as lights, 3D meshes, and textures, 12 00:01:03.775 --> 00:01:08.775 to provide smooth content delivery, 13 00:01:08.775 --> 00:01:12.675 and how to effectively utilize graphic elements 14 00:01:12.675 --> 00:01:16.725 라이트 매핑 15 00:01:16.725 --> 00:01:20.075 We will cover the concept of light mapping 16 00:01:20.075 --> 00:01:22.675 When we say light mapping, it is generally 17 00:01:22.675 --> 00:01:26.275 a combination of the two words light and map 18 00:01:26.275 --> 00:01:28.325 Light literally means light, 19 00:01:28.325 --> 00:01:32.075 and when the expression map is added, 20 00:01:32.075 --> 00:01:35.675 you can understand it as a texture 21 00:01:35.675 --> 00:01:37.425 without much difference 22 00:01:37.425 --> 00:01:40.675 In that case, it could be interpreted as 23 00:01:40.675 --> 00:01:42.375 an image file for light 24 00:01:42.375 --> 00:01:46.725 The process of creating a lightmap is the process of turning information 25 00:01:46.725 --> 00:01:49.825 about light into an image file 26 00:01:49.825 --> 00:01:53.975 Now, let's first understand why we convert information 27 00:01:53.975 --> 00:01:56.175 about light into an image file 28 00:01:56.175 --> 00:01:58.075 All objects in the real world can generally be 29 00:01:58.075 --> 00:02:04.175 moved if there is enough force applied 30 00:02:04.175 --> 00:02:10.425 On the other hand, if all objects in content created using a real-time engine 31 00:02:10.425 --> 00:02:16.025 were to move based on physical calculations, 32 00:02:16.025 --> 00:02:18.175 it would cause the computer 33 00:02:18.175 --> 00:02:22.825 to perform heavy computations and operate very slowly 34 00:02:22.825 --> 00:02:26.475 And inevitably, when the calculations become heavier, 35 00:02:26.475 --> 00:02:30.625 the FPS (Frames Per Second) 36 00:02:30.625 --> 00:02:33.275 the number of frames drawn per second 37 00:02:33.275 --> 00:02:36.425 will decrease 38 00:02:36.425 --> 00:02:40.725 The FPS value is one of the key indicators 39 00:02:40.725 --> 00:02:43.225 of how smooth the content is 40 00:02:43.225 --> 00:02:47.775 When users look at the screen, the term FPS 41 00:02:47.775 --> 00:02:49.625 is often used to refer to the genre of games 42 00:02:49.625 --> 00:02:52.725 It stands for First Person Shooting 43 00:02:52.725 --> 00:02:57.575 In such cases, the target is usually set to 60 frames per second as the baseline 44 00:02:57.575 --> 00:03:00.675 For content that focuses 45 00:03:00.675 --> 00:03:04.725 more on visual aesthetics and storytelling, 46 00:03:04.725 --> 00:03:07.225 the baseline is usually around 30 frames per second 47 00:03:07.225 --> 00:03:11.025 Similarly, TV shows and movies often use 48 00:03:11.025 --> 00:03:16.075 a lower frame rate of 24 frames per second 49 00:03:16.075 --> 00:03:19.675 So, when users look at the screen, 50 00:03:19.675 --> 00:03:22.525 we can tell how smooth 51 00:03:22.525 --> 00:03:26.875 the experience is by using the FPS value 52 00:03:26.875 --> 00:03:31.875 If it exceeds 60 frames per second, it will feel very smooth 53 00:03:31.875 --> 00:03:35.825 Moreover, nowadays, there are monitors 54 00:03:35.825 --> 00:03:39.475 that maintain very high frame rates, 55 00:03:39.475 --> 00:03:41.975 such as 140 frames or 240 frames per second, 56 00:03:41.975 --> 00:03:44.775 which has raised the expectations of users' eyes 57 00:03:44.775 --> 00:03:46.625 However, as mentioned earlier, 58 00:03:46.625 --> 00:03:49.975 if all objects are constantly performing 59 00:03:49.975 --> 00:03:52.275 physical collisions or calculations, 60 00:03:52.275 --> 00:03:55.525 In some cases, this could lead to providing a screen 61 00:03:55.525 --> 00:03:59.525 with choppy visuals, such as 10 frames or even 5 frames per second 62 00:03:59.525 --> 00:04:03.940 As a result, objects are typically divided into two main categories for management 63 00:04:03.940 --> 00:04:07.040 The first category is what you refer to as characters, 64 00:04:07.040 --> 00:04:09.070 or movable objects, 65 00:04:09.070 --> 00:04:11.440 commonly known as Dynamic objects 66 00:04:11.440 --> 00:04:14.490 The second category is objects that do not move, 67 00:04:14.490 --> 00:04:16.950 such as background objects, 68 00:04:16.950 --> 00:04:20.250 which are referred to as Static objects 69 00:04:20.250 --> 00:04:23.940 Moving objects, like shadows, 70 00:04:23.940 --> 00:04:27.290 change constantly, so there's not much we can do about them 71 00:04:27.290 --> 00:04:30.450 However, for stationary Static objects, 72 00:04:30.450 --> 00:04:35.700 we can precalculate tasks that require high computational costs 73 00:04:35.700 --> 00:04:40.940 and provide them to users in advance 74 00:04:40.940 --> 00:04:43.740 If we can pre-calculate parts like 75 00:04:43.740 --> 00:04:47.840 lighting calculations and other elements such as navigation meshes, 76 00:04:47.840 --> 00:04:50.650 which involve the movement paths of objects, 77 00:04:50.650 --> 00:04:53.800 users will be able to enjoy 78 00:04:53.800 --> 00:04:58.400 the content more smoothly and comfortably 79 00:04:58.400 --> 00:05:02.050 A lightmap, in essence, 80 00:05:02.050 --> 00:05:04.510 is used to precalculate lighting 81 00:05:04.510 --> 00:05:08.870 for objects that are set as Static, 82 00:05:08.870 --> 00:05:11.940 or non-moving, objects 83 00:05:11.940 --> 00:05:14.200 In the example screen, 84 00:05:14.200 --> 00:05:18.400 on the left is the image with no lightmap drawn, 85 00:05:18.400 --> 00:05:22.140 and on the right is the image with the lightmap drawn 86 00:05:22.140 --> 00:05:25.940 As you can see, here we have shading for the light, 87 00:05:25.940 --> 00:05:32.640 effects like the red wall reflecting light onto the opposite wall, 88 00:05:32.640 --> 00:05:35.240 and many other details 89 00:05:35.240 --> 00:05:40.140 such as dark shadows under the eaves 90 00:05:40.140 --> 00:05:44.420 These elements help create a more 3D 91 00:05:44.420 --> 00:05:47.770 and realistic background image, 92 00:05:47.770 --> 00:05:50.420 which can be provided to users 93 00:05:50.420 --> 00:05:54.520 To achieve this, we will work on creating a lightmap 94 00:05:54.520 --> 00:05:57.125 using the assets we have already received 95 00:05:57.475 --> 00:05:59.775 The screen you're currently viewing 96 00:05:59.775 --> 00:06:05.525 shows the Map v1 from the RPG FPS game assets 97 00:06:05.525 --> 00:06:07.675 Since there is no camera, 98 00:06:07.675 --> 00:06:09.875 the game view will display, No cameras rendering 99 00:06:09.875 --> 00:06:13.475 so let's focus on the scene view for now 100 00:06:13.475 --> 00:06:15.675 When you open the map, 101 00:06:15.675 --> 00:06:20.075 you might see some strange, blotchy, angular shapes 102 00:06:20.075 --> 00:06:24.675 on a structure that looks like a water tank, 103 00:06:24.675 --> 00:06:26.625 resembling odd, uneven patterns 104 00:06:26.625 --> 00:06:30.925 In the actual RPG FPS game assets industrial folder, 105 00:06:30.925 --> 00:06:33.975 there's a folder with the same name of Map v1 106 00:06:33.975 --> 00:06:37.675 Here, you can see a lightmap, 107 00:06:38.875 --> 00:06:41.425 and since it contains only background objects, 108 00:06:41.425 --> 00:06:43.375 it is applied to all of them 109 00:06:43.375 --> 00:06:49.075 You can confirm that the lightmap is created, 110 00:06:49.075 --> 00:06:53.125 with all the lighting information pre drawn as texture files 111 00:06:53.125 --> 00:06:55.475 During the import process, 112 00:06:55.475 --> 00:06:58.475 some data was modified, 113 00:06:58.475 --> 00:07:04.025 and as you can see, some of the map data appears 114 00:07:04.025 --> 00:07:05.975 to be corrupted or broken visually 115 00:07:05.975 --> 00:07:08.725 We won't be using this as it is 116 00:07:08.725 --> 00:07:13.825 We will drag the RPG FPS map into the Main Scene 117 00:07:13.825 --> 00:07:17.625 that we have been working on, and add it to the scene file 118 00:07:17.625 --> 00:07:21.525 We will deactivate the test objects we placed for testing purposes, 119 00:07:21.525 --> 00:07:26.825 so they won't be visible in the scene 120 00:07:27.325 --> 00:07:31.475 If you look at all the objects placed here, you'll notice that 121 00:07:31.475 --> 00:07:34.275 that all the visible 3D objects have 122 00:07:34.275 --> 00:07:37.625 then Static option enabled 123 00:07:37.625 --> 00:07:39.525 in the top-right corner 124 00:07:39.525 --> 00:07:42.325 of the Inspector window 125 00:07:42.325 --> 00:07:46.625 And all the building objects are set as Static as well 126 00:07:46.625 --> 00:07:50.075 If you click the arrow to the right of the Static option, 127 00:07:50.075 --> 00:07:52.125 a list of various settings will appear 128 00:07:52.125 --> 00:07:56.775 Here, you can see that the 129 00:07:56.775 --> 00:08:00.425 Contribute GI option is enabled, as shown on the screen 130 00:08:00.425 --> 00:08:01.975 When this option is enabled, 131 00:08:01.975 --> 00:08:04.275 it means that the selected object 132 00:08:04.275 --> 00:08:08.425 is the target for expressing 133 00:08:08.425 --> 00:08:11.475 the lightmap's texture 134 00:08:11.475 --> 00:08:14.275 So, all the background objects here 135 00:08:14.275 --> 00:08:16.625 have already been neatly organized 136 00:08:16.625 --> 00:08:21.225 by the developer and set as Static 137 00:08:21.225 --> 00:08:24.375 So, we will drag this 138 00:08:24.375 --> 00:08:26.775 directly into the Main Scene, 139 00:08:26.775 --> 00:08:29.525 where the character is, 140 00:08:30.175 --> 00:08:33.975 and then right click on Map v1, 141 00:08:33.975 --> 00:08:35.725 and select Remove Scene 142 00:08:35.725 --> 00:08:37.925 And then, we will click 143 00:08:37.925 --> 00:08:40.325 the "Don't Save" button to avoid saving it 144 00:08:40.325 --> 00:08:43.725 Then, you'll be able to confirm 145 00:08:43.725 --> 00:08:45.625 that the strange images, 146 00:08:45.625 --> 00:08:47.775 like the ones on the water tank, are gone 147 00:08:47.775 --> 00:08:51.425 Before we create the lightmap, 148 00:08:51.425 --> 00:08:55.375 we need to make some settings for the lighting first 149 00:08:55.375 --> 00:08:58.725 Inside the Map_v1 game object, 150 00:08:58.725 --> 00:09:03.075 there are particles, 3D objects, and light elements 151 00:09:03.075 --> 00:09:07.075 In Unity, when you create a new scene, 152 00:09:07.075 --> 00:09:09.675 a Directional Light and a Main Camera are 153 00:09:09.675 --> 00:09:11.175 provided by default 154 00:09:11.175 --> 00:09:14.925 Since there is an additional Directional Light, 155 00:09:14.925 --> 00:09:18.325 we will delete that light 156 00:09:18.325 --> 00:09:21.175 and only use the default light 157 00:09:21.175 --> 00:09:23.225 provided in the Main Scene 158 00:09:23.225 --> 00:09:26.225 A lightmap is essentially 159 00:09:26.225 --> 00:09:31.025 the process of turning light information into a texture 160 00:09:31.025 --> 00:09:33.025 So, when there is light, 161 00:09:33.025 --> 00:09:35.175 you can see the direction of the light, as it is shown here 162 00:09:35.175 --> 00:09:38.375 And when an object casts a shadow 163 00:09:38.375 --> 00:09:42.175 based on the direction of the light, 164 00:09:42.175 --> 00:09:46.025 not only is the shadow information generated, 165 00:09:46.025 --> 00:09:48.875 but the information about the object's light 166 00:09:48.875 --> 00:09:53.825 and dark sides is also captured 167 00:09:53.825 --> 00:09:57.925 and turned into an image file 168 00:09:57.925 --> 00:10:02.825 Now that we've covered the basic preparations for the lightmap 169 00:10:02.825 --> 00:10:05.425 We will now start creating the lightmap 170 00:10:05.425 --> 00:10:09.225 by going to Window to Rendering to Lighting 171 00:10:09.225 --> 00:10:15.425 And if the Lighting Settings asset in the Scene is empty, 172 00:10:15.425 --> 00:10:19.025 If it is empty, I will briefly delete it 173 00:10:19.025 --> 00:10:24.075 If it's empty, you can click the New button to create a new one 174 00:10:24.575 --> 00:10:27.775 The New Lighting Settings has been created now 175 00:10:27.775 --> 00:10:30.925 here are several options, but for now, 176 00:10:30.925 --> 00:10:35.025 we will change the lighting mode to Subtractive 177 00:10:35.025 --> 00:10:37.725 The process of creating a lightmap 178 00:10:37.725 --> 00:10:41.275 involves detailed light calculations, 179 00:10:41.275 --> 00:10:43.825 so it is a task that typically takes a significant amount of time 180 00:10:43.825 --> 00:10:48.575 Here, the Direct Samples will be set to half, which would be 16 181 00:10:48.575 --> 00:10:52.575 The Indirect samples for the ambient light are also halved, 182 00:10:52.575 --> 00:10:54.275 and the same goes for the Environment 183 00:10:54.275 --> 00:10:57.675 Finally, the Lightmap Resolution 184 00:10:57.675 --> 00:11:00.775 is set to 12 to speed up 185 00:11:00.775 --> 00:11:03.775 the process and get quicker results 186 00:11:03.775 --> 00:11:06.825 If we create the lightmap 187 00:11:06.825 --> 00:11:10.225 for the current map using the default settings, 188 00:11:10.225 --> 00:11:12.325 it will take over 40 minutes 189 00:11:12.325 --> 00:11:15.575 In the industry, depending on the situation, 190 00:11:15.575 --> 00:11:19.225 creating a lightmap can sometimes take an entire day or even overnight 191 00:11:19.225 --> 00:11:22.375 But since we can't afford to spend that much time, 192 00:11:22.375 --> 00:11:25.525 With these settings, and an important note 193 00:11:25.525 --> 00:11:28.475 if you check the mode of the Directional Light, 194 00:11:28.475 --> 00:11:30.075 it is set to Realtime 195 00:11:30.075 --> 00:11:35.225 ou need to change this to either Mixed or Baked 196 00:11:35.225 --> 00:11:38.575 I will set it to Mixed 197 00:11:38.575 --> 00:11:42.425 That's because "Realtime" means 198 00:11:42.425 --> 00:11:45.975 the light calculation for the selected Directional Light 199 00:11:45.975 --> 00:11:48.575 will only be done in real time, rather than being pre computed 200 00:11:48.575 --> 00:11:51.125 Baked" refers to the process of pre computing the lightmap, 201 00:11:51.125 --> 00:11:53.775 which is commonly referred to as baking the light 202 00:11:53.775 --> 00:11:58.125 Baking means turning the light information into a texture, 203 00:11:58.125 --> 00:12:00.175 and when you bake, it indicates that 204 00:12:00.175 --> 00:12:03.775 the Directional Light's information will be used only during the baking process 205 00:12:03.775 --> 00:12:06.225 Since the Directional Light typically 206 00:12:06.225 --> 00:12:08.526 acts like the sun, 207 00:12:08.526 --> 00:12:11.276 it needs to affect both Dynamic objects 208 00:12:11.276 --> 00:12:13.976 and Static objects as well 209 00:12:13.976 --> 00:12:16.426 Therefore, it's common to set it to Mixed 210 00:12:16.426 --> 00:12:19.176 so that it influences both types of objects 211 00:12:19.176 --> 00:12:23.776 Once everything is prepared, save the Scene 212 00:12:23.776 --> 00:12:26.376 Save it by clicking Ctrl and S 213 00:12:26.376 --> 00:12:28.276 The Generate Lighting button 214 00:12:28.276 --> 00:12:31.676 is at the bottom of the Lighting window We will click that 215 00:12:31.676 --> 00:12:34.776 While the lightmap is being generated, 216 00:12:34.776 --> 00:12:37.326 the time taken will be displayed at the bottom right 217 00:12:37.326 --> 00:12:40.426 Right now, the time is gradually decreasing 218 00:12:40.426 --> 00:12:43.876 While the lightmap is being baked, 219 00:12:43.876 --> 00:12:47.176 let me first explain 220 00:12:47.176 --> 00:12:49.976 the concept of Global Illumination 221 00:12:49.976 --> 00:12:52.126 Earlier, we checked 222 00:12:52.126 --> 00:12:56.676 the Contribute GI option in the Static settings 223 00:12:56.676 --> 00:13:00.776 The abbreviation GI stands for Global Illumination 224 00:13:00.776 --> 00:13:04.226 Generally, light can be direct, like sunlight 225 00:13:04.226 --> 00:13:09.476 which directly hits objects, 226 00:13:09.476 --> 00:13:14.476 and it can also be indirect where the direct light hits an object, 227 00:13:14.476 --> 00:13:17.126 bounces off, and then influences other objects 228 00:13:17.126 --> 00:13:20.076 This is referred to as Indirect light 229 00:13:20.076 --> 00:13:23.826 Also, this light can eventually escape outward, 230 00:13:23.826 --> 00:13:27.376 hit the sky, and then come back down 231 00:13:27.376 --> 00:13:31.426 The light hits the particles floating in the air from the sky 232 00:13:31.426 --> 00:13:36.076 So, it's not just the effect from the Directional Light 233 00:13:36.076 --> 00:13:40.526 light that scatters in all directions after hitting clouds in the sky 234 00:13:40.526 --> 00:13:44.726 or particles in the atmosphere is also considered 235 00:13:44.726 --> 00:13:49.926 This type of light is referred to as GI (Global Illumination) 236 00:13:49.926 --> 00:13:53.126 So, when we create a lightmap, 237 00:13:53.126 --> 00:13:57.376 it's not just the direct light from a Directional Light like the sun 238 00:13:57.376 --> 00:14:02.626 It also includes the assumption that the light bounces multiple times and hits from all directions, 239 00:14:02.626 --> 00:14:06.126 incorporating Global Illumination, 240 00:14:06.126 --> 00:14:09.126 as part of the baking process to generate the texture 241 00:14:09.126 --> 00:14:12.626 The samples below are mostly 242 00:14:12.626 --> 00:14:15.276 what we calculate as a single pixel data 243 00:14:15.276 --> 00:14:18.976 when we ultimately create an image file 244 00:14:18.976 --> 00:14:22.626 We refer to obtaining information 245 00:14:22.626 --> 00:14:26.326 about multiple lights to determine 246 00:14:26.326 --> 00:14:29.826 what color to represent this pixel as a sample 247 00:14:29.826 --> 00:14:33.376 In other words, 16 samples are needed 248 00:14:33.376 --> 00:14:35.426 to calculate for the Directional Light 249 00:14:35.426 --> 00:14:38.926 It means that for Indirect or Environment, 250 00:14:38.926 --> 00:14:42.526 hundreds of samples will be used 251 00:14:42.526 --> 00:14:46.876 Below here, it's about collecting information 252 00:14:46.876 --> 00:14:50.426 from those numerous samples to generate an image 253 00:14:50.426 --> 00:14:54.126 If you look at the Lightmap Resolution section, 254 00:14:54.126 --> 00:14:56.676 you'll see the term Texels per unit 255 00:14:56.676 --> 00:14:59.876 1 unit in the real world is based on 1 meter, 256 00:14:59.876 --> 00:15:02.526 and Unity has set 1 unit to represent 1 meter 257 00:15:02.526 --> 00:15:06.176 When drawing 1 unit, 258 00:15:06.176 --> 00:15:11.076 the number of pixels in the texture is referred to as a Texel 259 00:15:11.076 --> 00:15:16.076 In other words, it's about how many pixels are 260 00:15:16.076 --> 00:15:19.476 used to represent a 1m space 261 00:15:19.476 --> 00:15:22.226 Naturally, the higher the number of Texels, 262 00:15:22.226 --> 00:15:25.476 the more detailed the light representation becomes, 263 00:15:25.476 --> 00:15:29.026 and shadows and other elements also become much more refineㅇ 264 00:15:29.026 --> 00:15:31.876 However, this also means it takes more time 265 00:15:31.876 --> 00:15:37.776 This means that you're dividing 1 meter into 12 parts to represent it 266 00:15:37.776 --> 00:15:41.926 Now, the calculations for the light are complete according to the explanation 267 00:15:42.326 --> 00:15:43.876 Here, let me quickly 268 00:15:43.876 --> 00:15:45.876 turn off the gizmo beforehand 269 00:15:45.876 --> 00:15:48.726 In this way, zombies and similar objects are dynamic, 270 00:15:48.726 --> 00:15:52.126 so the shadow calculations 271 00:15:52.126 --> 00:15:53.776 are done in real time 272 00:15:53.776 --> 00:15:56.026 The background objects are static, 273 00:15:56.026 --> 00:16:00.626 so even if they move, the shadows don't change 274 00:16:00.626 --> 00:16:05.226 Moving the water tank won't change the shadow 275 00:16:05.226 --> 00:16:07.826 The same applies here 276 00:16:07.826 --> 00:16:10.176 That's because it was pre made 277 00:16:10.176 --> 00:16:13.976 as a texture file like this 278 00:16:13.976 --> 00:16:17.476 This is the texture file called a lightmap 279 00:16:17.476 --> 00:16:20.676 Among them, the area occupied by the water tank is 280 00:16:20.676 --> 00:16:25.026 highlighted in yellow by the Baked Lightmaps section 281 00:16:25.026 --> 00:16:29.326 You can check by clicking the Open Preview button, 282 00:16:29.326 --> 00:16:31.826 and in the Window menu, 283 00:16:31.826 --> 00:16:34.276 under the Lighting panel, you can see that 284 00:16:34.276 --> 00:16:39.776 the lightmap has been generated in a total of 5 images, 285 00:16:39.776 --> 00:16:42.376 from 0 to 4, under the Baked Lightmaps section 286 00:16:42.376 --> 00:16:45.726 The Subtractive method I used means 287 00:16:45.726 --> 00:16:49.376 that all the shadows, highlights, and everything related to light 288 00:16:49.376 --> 00:16:52.626 are represented in a single image 289 00:16:52.626 --> 00:16:55.576 To be more precise, it means representing 290 00:16:55.576 --> 00:16:57.426 everything in a single type of image 291 00:16:57.426 --> 00:17:00.676 By enabling Baked Indirect here, 292 00:17:00.676 --> 00:17:03.776 it will only represent the information related to indirect lighting 293 00:17:03.776 --> 00:17:07.076 This means that shadows and other effects caused by direct light, 294 00:17:07.076 --> 00:17:11.576 such as those created by direct lighting, 295 00:17:11.576 --> 00:17:15.726 will be excluded, and only the indirect lighting will be drawn 296 00:17:15.726 --> 00:17:18.876 Since Baked Indirect does not 297 00:17:18.876 --> 00:17:21.476 include shadows, 298 00:17:21.476 --> 00:17:24.676 only the information about the light and dark areas will be drawn 299 00:17:24.676 --> 00:17:28.526 If you change the light, the shadow information can change as well 300 00:17:28.526 --> 00:17:31.576 Instead, it will use one more texture 301 00:17:31.576 --> 00:17:36.276 The Shadowmask method uses a total of three images 302 00:17:36.276 --> 00:17:40.676 to represent shadows, bright areas, dark areas, and GI, 303 00:17:40.676 --> 00:17:43.376 because it expresses by using three images 304 00:17:44.076 --> 00:17:47.376 which makes it the slowest 305 00:17:47.376 --> 00:17:50.376 and heaviest method among the lightmap techniques 306 00:17:50.376 --> 00:17:53.226 Therefore, according to the Unity manual, 307 00:17:53.226 --> 00:17:56.076 when targeting low spec platforms like mobile games, 308 00:17:56.076 --> 00:18:00.526 it's recommended to use the Subtractive method 309 00:18:00.526 --> 00:18:04.776 For high spec platforms, using options like Shadowmask 310 00:18:04.776 --> 00:18:07.676 for baking is suggested 311 00:18:07.676 --> 00:18:10.126 In this way, the light information is 312 00:18:10.126 --> 00:18:12.276 organized into a single type, 313 00:18:13.076 --> 00:18:17.326 and among the options, you can also see that additional information is 314 00:18:17.326 --> 00:18:20.826 added separately regarding the direction 315 00:18:20.826 --> 00:18:24.926 in which these 3D objects are facing in the world 316 00:18:24.926 --> 00:18:28.526 So, this information is what we refer to 317 00:18:28.526 --> 00:18:31.026 as baking the lightmap 318 00:18:31.026 --> 00:18:33.726 The lightmap creation is now complete, 319 00:18:33.726 --> 00:18:36.826 but it feels very dark and dull, right? 320 00:18:36.826 --> 00:18:40.976 One reason for that is because the current environment's sky is 321 00:18:40.976 --> 00:18:44.376 Unity's default sky 322 00:18:44.376 --> 00:18:50.176 We need to make some adjustments to the Sky settings 323 00:18:50.176 --> 00:18:54.126 First, let's look at the Skybox section 324 00:18:54.126 --> 00:18:57.826 under RPG FPS game assets of Texture 325 00:18:57.826 --> 00:19:02.026 Here, you can see an image of the sky with clouds 326 00:19:02.026 --> 00:19:04.726 In the Window menu, go to Rendering and to Lighting panel, 327 00:19:04.726 --> 00:19:08.776 and then drag the Skybox_v9 328 00:19:08.776 --> 00:19:13.926 into the second Environment section next to Scene 329 00:19:13.926 --> 00:19:17.576 As you can see now, 330 00:19:17.576 --> 00:19:21.676 the Skybox in the background has been changed 331 00:19:21.676 --> 00:19:26.176 If anyone can't see the updated Skybox, 332 00:19:26.176 --> 00:19:29.176 you can toggle it on and off using the Toggle button in the viewport, 333 00:19:29.176 --> 00:19:32.126 so feel free to try that you can turn it off and on again 334 00:19:32.126 --> 00:19:34.726 Typically, when baking a lightmap, 335 00:19:34.726 --> 00:19:38.626 you need to bake in information like 336 00:19:38.626 --> 00:19:41.726 like red or blue hues from the Sky 337 00:19:41.726 --> 00:19:45.276 in the environment to create more natural lighting 338 00:19:45.276 --> 00:19:48.126 Previously, there wasn't enough Sky information 339 00:19:48.126 --> 00:19:50.476 to use for that kind of lighting, 340 00:19:50.476 --> 00:19:54.676 which is why the result appeared relatively dull 341 00:19:54.676 --> 00:19:57.926 I will regenerate the lighting 342 00:19:57.926 --> 00:20:00.376 and show you the comparison 343 00:20:00.376 --> 00:20:03.076 once the Skybox has been applied 344 00:20:03.076 --> 00:20:06.326 Now that the Skybox is set, 345 00:20:06.326 --> 00:20:08.976 I will click the Generate Lighting button 346 00:20:08.976 --> 00:20:12.776 In order to receive lighting information from the Skybox, 347 00:20:12.776 --> 00:20:15.926 the Source section in the Environment Lighting settings 348 00:20:15.926 --> 00:20:20.126 needs to be set to Skybox and this allows the lighting information 349 00:20:20.126 --> 00:20:22.726 to be used as a reference when generating the lightmap 350 00:20:22.726 --> 00:20:26.176 By default, you can modify the type of Environment Light 351 00:20:26.176 --> 00:20:29.326 based on the result as needed 352 00:20:30.126 --> 00:20:32.476 There are two results 353 00:20:32.476 --> 00:20:35.226 The image at the top is the result 354 00:20:35.226 --> 00:20:37.976 with the default Unity Skybox 355 00:20:37.976 --> 00:20:39.376 The image shown here is a screenshot 356 00:20:39.376 --> 00:20:42.326 taken after it was added later 357 00:20:42.326 --> 00:20:43.926 The one below Unity's Skybox 358 00:20:43.926 --> 00:20:47.126 is actually the result of 359 00:20:47.126 --> 00:20:51.426 baking with the Skybox version 9 that we applied 360 00:20:51.426 --> 00:20:52.876 There's not a big difference 361 00:20:52.876 --> 00:20:56.876 he only noticeable difference here might be 362 00:20:56.876 --> 00:21:00.376 that the shadow details are a bit more visible, 363 00:21:00.376 --> 00:21:04.026 and a few points are slightly more defined 364 00:21:04.026 --> 00:21:07.526 Other than that, the change is subtle 365 00:21:07.526 --> 00:21:11.676 Of course, people with sharp eyes 366 00:21:11.676 --> 00:21:14.826 might notice that the darker areas 367 00:21:14.826 --> 00:21:16.826 have brightened a little 368 00:21:16.826 --> 00:21:21.126 As for me, I prefer 369 00:21:21.126 --> 00:21:25.026 using the Gradient option rather than 370 00:21:25.026 --> 00:21:28.976 directly taking the information from the Skybox 371 00:21:28.976 --> 00:21:31.326 It’s a bit more tedious, 372 00:21:31.326 --> 00:21:33.776 but with the Gradient option, 373 00:21:33.776 --> 00:21:37.676 you define the light from three directions 374 00:21:37.676 --> 00:21:43.176 light coming down from the sky, light coming from the horizon, 375 00:21:43.176 --> 00:21:48.376 and light bouncing off the ground 376 00:21:48.376 --> 00:21:52.076 You can then choose custom colors 377 00:21:52.076 --> 00:21:55.876 to represent these directions 378 00:21:55.876 --> 00:21:59.476 So, I use the color picker to select a color 379 00:21:59.476 --> 00:22:02.176 that closely matches 380 00:22:02.176 --> 00:22:05.676 the brightest areas of the Sky I’ve added, 381 00:22:05.676 --> 00:22:10.776 ensuring it doesn’t stray 382 00:22:10.776 --> 00:22:15.176 too far from the original 383 00:22:15.176 --> 00:22:19.176 For the light intensity, I’ll set it to 1 for now 384 00:22:19.176 --> 00:22:22.926 Similarly, for the Equator, I click 385 00:22:22.926 --> 00:22:27.976 and use the color picker to select the color of the light at the horizon, 386 00:22:27.976 --> 00:22:30.026 setting the intensity to 1 as well 387 00:22:30.026 --> 00:22:32.476 Finally, for the Ground, 388 00:22:32.476 --> 00:22:35.026 I pick the color from the largest area, 389 00:22:35.026 --> 00:22:39.126 which is the ground surface, 390 00:22:39.126 --> 00:22:40.773 and set the color accordingly 391 00:22:40.773 --> 00:22:46.373 Since it's been set to a bright value, if you feel it's too bright, 392 00:22:46.373 --> 00:22:49.873 you can lower the intensity a bit 393 00:22:49.873 --> 00:22:53.023 Even at 0, it will still maintain a basic level of brightness 394 00:22:53.023 --> 00:22:56.422 If 1 is too bright, adjusting it down slightly is 395 00:22:56.422 --> 00:22:57.622 another way to fine tune the expression 396 00:22:57.622 --> 00:23:01.222 The value of 1 is just an arbitrary reference value 397 00:23:01.222 --> 00:23:03.222 that I set for later adjustments 398 00:23:03.222 --> 00:23:07.722 Once the light calculations are done, I’ll compare the results 399 00:23:07.722 --> 00:23:09.922 with the third screenshot as well 400 00:23:09.922 --> 00:23:13.722 In this situation, where the colors 401 00:23:13.722 --> 00:23:16.122 from the Skybox were picked 402 00:23:16.122 --> 00:23:20.072 and set using the Gradient, you can now see 403 00:23:20.072 --> 00:23:23.022 that the shadowed areas have brightened significantly 404 00:23:23.022 --> 00:23:27.322 compared to when the Skybox was directly used 405 00:23:27.322 --> 00:23:29.922 The shadows aren't as harsh and they smoothly blend in 406 00:23:29.922 --> 00:23:35.522 Also, you can notice that the blue in the Equator section has been emphasized more 407 00:23:35.522 --> 00:23:39.322 This is something you can choose to use 408 00:23:39.322 --> 00:23:42.722 depending on the person or the situation 409 00:23:42.722 --> 00:23:44.872 When using this lightmap, 410 00:23:44.872 --> 00:23:49.172 I'll show you another way to use it 411 00:23:49.172 --> 00:23:51.522 by installing a custom light 412 00:23:51.522 --> 00:23:54.222 By using Light Point Light 413 00:23:54.222 --> 00:23:57.172 with the Only Baked setting, 414 00:23:57.172 --> 00:24:01.472 which means it will only affect static objects by default, 415 00:24:01.472 --> 00:24:03.922 This is how such effects can be expressed in some cases 416 00:24:03.922 --> 00:24:07.872 I’ve set it to a slight red hue, so that 417 00:24:07.872 --> 00:24:11.722 a red tint subtly blends into the surrounding environment 418 00:24:11.722 --> 00:24:13.722 If we bake the lightmap in this state, 419 00:24:13.722 --> 00:24:15.472 there is one issue 420 00:24:15.472 --> 00:24:19.772 The "Baked" option only affects static objects 421 00:24:19.772 --> 00:24:23.122 However, if a dynamic object approaches 422 00:24:23.122 --> 00:24:26.072 in a situation like this with red light, 423 00:24:26.072 --> 00:24:28.772 it won't have any effect 424 00:24:28.772 --> 00:24:30.872 So, if the background is red 425 00:24:30.872 --> 00:24:34.922 and the dynamic object is still only receiving the light from the sky, 426 00:24:34.922 --> 00:24:37.222 it would create a very awkward situation 427 00:24:37.222 --> 00:24:39.222 To prevent this, 428 00:24:39.222 --> 00:24:42.272 there is a game object that, 429 00:24:42.272 --> 00:24:46.972 after baking the light in the lightmap, 430 00:24:46.972 --> 00:24:51.272 holds the information of the baked light 431 00:24:51.272 --> 00:24:53.422 and then transfers it to the dynamic objects 432 00:24:53.422 --> 00:24:56.972 This is called a light probe 433 00:24:56.972 --> 00:25:00.722 It's the Light Probe object at the bottom of 434 00:25:00.722 --> 00:25:03.572 the Light section in the hierarchy 435 00:25:03.572 --> 00:25:07.322 I will install it and move its position to the world origin 436 00:25:07.322 --> 00:25:12.072 So, if you look at the position, you'll see circular markers 437 00:25:12.072 --> 00:25:14.722 To an appropriate starting position, 438 00:25:14.722 --> 00:25:16.622 move these circles 439 00:25:16.622 --> 00:25:20.422 If you click the Edit Light Probe Positions button, 440 00:25:20.422 --> 00:25:24.222 you will be able to select the individual spheres 441 00:25:24.222 --> 00:25:27.072 When placing light probes, you should generally ensure 442 00:25:27.072 --> 00:25:31.072 that the light probes can encompass the character 443 00:25:31.072 --> 00:25:33.922 If the character is jumping, consider the jump space as well 444 00:25:33.922 --> 00:25:38.622 Then, drag and select the area you need 445 00:25:38.622 --> 00:25:41.622 You can expand the area 446 00:25:41.622 --> 00:25:46.322 by copying and pasting using 447 00:25:46.322 --> 00:25:48.772 Ctrl C and Ctrl V 448 00:25:48.772 --> 00:25:51.422 Ctrl C and V like this 449 00:25:51.422 --> 00:25:55.922 If there is a lot of change in lighting, you should place the probes closer together 450 00:25:55.922 --> 00:25:59.422 If there is little variation in the light, 451 00:25:59.422 --> 00:26:01.672 it's fine to space them out more 452 00:26:01.672 --> 00:26:04.922 So, here's the downside of light probes 453 00:26:04.922 --> 00:26:07.172 It doesn't apply to those cases, 454 00:26:07.172 --> 00:26:12.222 but light probes are always connected, 455 00:26:12.222 --> 00:26:14.522 so they cannot function separately 456 00:26:14.522 --> 00:26:18.372 So, once you start placing them this way, 457 00:26:18.372 --> 00:26:22.072 it has the downside that you will constantly 458 00:26:22.072 --> 00:26:25.572 need to keep placing them 459 00:26:25.572 --> 00:26:28.022 Of course, I won't cover this in full 460 00:26:28.022 --> 00:26:30.672 due to the length of the video, 461 00:26:30.672 --> 00:26:34.572 but as you can see, the range of this triangle is visible 462 00:26:34.572 --> 00:26:38.222 When the character enters the range of this triangle, 463 00:26:38.222 --> 00:26:40.722 the probes within it will distribute 464 00:26:40.722 --> 00:26:43.972 the light information from their current position 465 00:26:43.972 --> 00:26:46.522 to the dynamic objects 466 00:26:46.522 --> 00:26:49.422 So, in areas with a lot of light variation 467 00:26:49.422 --> 00:26:52.722 or shadowed regions, 468 00:26:52.722 --> 00:26:55.022 you need to place the probes very closely together 469 00:26:55.022 --> 00:27:00.822 Otherwise, you should carefully select and adjust the spacing accordingly 470 00:27:00.822 --> 00:27:03.772 Typically, a level designer handles this task 471 00:27:03.772 --> 00:27:07.222 while adjusting the lighting 472 00:27:07.222 --> 00:27:11.022 If there's a mistake or the spacing is too tight, 473 00:27:11.022 --> 00:27:14.772 you can select and delete specific areas as needed 474 00:27:14.772 --> 00:27:18.772 Since the computer will automatically handle the connections, 475 00:27:18.772 --> 00:27:21.722 we'll leave the placement like this for now 476 00:27:21.722 --> 00:27:24.372 Then, let's go to Window Rendering and click 477 00:27:24.372 --> 00:27:26.522 the Generate Lighting button 478 00:27:26.522 --> 00:27:28.922 to bake the lightmap 479 00:27:29.322 --> 00:27:31.472 I increased the intensity value slightly more 480 00:27:31.472 --> 00:27:34.972 than what was explained earlier and then baked the light 481 00:27:34.972 --> 00:27:38.972 I will press play and compare how this object 482 00:27:38.972 --> 00:27:41.122 looks in the game 483 00:27:41.122 --> 00:27:44.072 Currently, it's outside the light probe's area, 484 00:27:44.072 --> 00:27:47.072 or more specifically, outside the red region, 485 00:27:47.072 --> 00:27:48.922 so it's not receiving any light 486 00:27:48.922 --> 00:27:51.672 However, as you get closer, 487 00:27:51.672 --> 00:27:54.422 you can see the red light casting onto the object 488 00:27:54.422 --> 00:27:59.922 Even if you deactivate the red light here, 489 00:27:59.922 --> 00:28:02.472 even if it's deactivated 490 00:28:02.472 --> 00:28:05.222 the red light still 491 00:28:05.222 --> 00:28:08.872 lingers around the barrel of the object 492 00:28:08.872 --> 00:28:11.872 This is how light probes are used 493 00:28:11.872 --> 00:28:15.572 In the same context, reflection probes serve 494 00:28:15.572 --> 00:28:16.972 a similar role for light 495 00:28:16.972 --> 00:28:20.522 Right now, there is no data, 496 00:28:20.522 --> 00:28:23.722 but if you place the reflection probes 497 00:28:23.722 --> 00:28:28.522 in appropriate areas and click the Bake button, 498 00:28:28.522 --> 00:28:32.722 it will capture the surrounding environment in a 360 degree view 499 00:28:32.722 --> 00:28:35.772 This captured image will then be applied 500 00:28:35.772 --> 00:28:38.772 to shiny surfaces like glass, creating a reflective effect 501 00:28:38.772 --> 00:28:41.022 Let's take a closer look at it here 502 00:28:41.022 --> 00:28:45.872 I will intentionally increase the fabric's texture to an exaggerated level 503 00:28:45.872 --> 00:28:48.372 If you increase the Smoothness value like this 504 00:28:48.372 --> 00:28:53.472 and compare before and after adding the Reflection Probe, 505 00:28:53.472 --> 00:28:56.472 you can temporarily remove the texture to set it to None, 506 00:28:56.472 --> 00:28:58.972 and then increase the Metallic 507 00:28:58.972 --> 00:29:02.622 This will show that the surrounding environment is reflected 508 00:29:02.622 --> 00:29:05.772 What the Reflection Probe does is that right now, 509 00:29:05.772 --> 00:29:09.472 it’s only casting light around without any objects 510 00:29:09.472 --> 00:29:11.472 but if a 3D object exists 511 00:29:11.472 --> 00:29:16.522 within the area of the Reflection Probe 512 00:29:16.522 --> 00:29:21.422 Now, I will lower this and place it around the 3D object 513 00:29:21.422 --> 00:29:24.072 By doing that, as you can see now, 514 00:29:24.072 --> 00:29:28.722 it creates the feeling that the surrounding environment 515 00:29:28.722 --> 00:29:31.072 is being directly reflected 516 00:29:31.072 --> 00:29:35.022 Instead, the Reflection doesn't reflect in live, 517 00:29:35.022 --> 00:29:38.872 the images that Reflection Probe holds, 518 00:29:38.872 --> 00:29:41.622 are reflected to show 519 00:29:41.622 --> 00:29:43.522 as if it's reflecting it 520 00:29:43.522 --> 00:29:47.722 If you turn off the Reflection Probe, only the default Sky will be reflected 521 00:29:47.722 --> 00:29:51.872 So, by baking the Reflection Probe like this, 522 00:29:51.872 --> 00:29:55.972 what is created at this time is the Reflection Map 523 00:29:55.972 --> 00:29:58.872 So, it's not just baking the light 524 00:29:58.872 --> 00:30:00.922 you can also pre-calculate data 525 00:30:00.922 --> 00:30:04.372 like the baked light from these probes 526 00:30:04.372 --> 00:30:07.172 Just like the Reflection Probe, 527 00:30:07.172 --> 00:30:11.672 you can pre-calculate the surrounding environment’s image, 528 00:30:11.672 --> 00:30:16.372 which reduces the computational load on the hardware 529 00:30:16.372 --> 00:30:18.722 when the content is 530 00:30:18.722 --> 00:30:21.322 running in real-time 531 00:30:21.322 --> 00:30:25.322 These series of tasks are mostly referred to as optimization 532 00:30:25.322 --> 00:30:28.172 What you need to remember in optimization is 533 00:30:28.172 --> 00:30:30.722 that it's not just about saving resources for the sake of it 534 00:30:30.722 --> 00:30:34.672 It’s about saving resources, 535 00:30:34.672 --> 00:30:37.772 but still making things look better, 536 00:30:37.772 --> 00:30:40.472 or improving performance without creating 537 00:30:40.472 --> 00:30:43.172 a big difference before and after applying a technique 538 00:30:43.172 --> 00:30:45.672 We’ve looked into optimization techniques, 539 00:30:45.672 --> 00:30:47.422 and these techniques 540 00:30:47.422 --> 00:30:50.722 can also be applied while creating 3D objects 541 00:30:50.722 --> 00:30:53.622 When controlling your content, 542 00:30:53.622 --> 00:30:56.722 using one zombie object 543 00:30:56.722 --> 00:30:59.372 instead of three will consume 544 00:30:59.372 --> 00:31:00.972 fewer resources, right? 545 00:31:00.972 --> 00:31:04.572 One method is to consolidate the health of three zombies into one, 546 00:31:04.572 --> 00:31:08.072 instead of splitting 10, 10, and 10, you make it 30 547 00:31:08.072 --> 00:31:11.772 This way, you make the player invest more time 548 00:31:11.772 --> 00:31:12.872 to defeat just one zombie 549 00:31:12.872 --> 00:31:14.772 Simply put, optimization 550 00:31:14.772 --> 00:31:18.022 doesn't only apply to graphics 551 00:31:18.022 --> 00:31:20.872 It's important to understand that it's a process 552 00:31:20.872 --> 00:31:23.322 where all parts work together 553 00:31:23.322 --> 00:31:26.872 It’s not always good to save resources just for the sake of it 554 00:31:26.872 --> 00:31:28.822 Sometimes, additional effects are intentionally used 555 00:31:28.822 --> 00:31:32.372 to provide a more immersive environment for the users 556 00:31:32.372 --> 00:31:35.972 A good example of this is the use of post-processing effects on the camera, 557 00:31:35.972 --> 00:31:38.972 so it's important to 558 00:31:38.972 --> 00:31:40.622 activate them 559 00:31:40.622 --> 00:31:43.272 No matter how it looks in the scene view, 560 00:31:43.272 --> 00:31:47.422 if the post-processing effects are not applied to the screen 561 00:31:47.422 --> 00:31:50.072 the users actually see, it wouldn't make any sense 562 00:31:50.072 --> 00:31:54.172 So, to ensure the effects are displayed on the screen the users see, 563 00:31:54.172 --> 00:31:59.572 you need to activate the post processing checkbox 564 00:31:59.572 --> 00:32:03.922 In the same context, you can see 565 00:32:03.922 --> 00:32:07.122 that the camera also has 566 00:32:07.122 --> 00:32:09.522 the Anti-aliasing option added here 567 00:32:09.522 --> 00:32:11.722 In the case of Anti-aliasing, 568 00:32:11.722 --> 00:32:15.622 it's about how to make the screen appear smoother 569 00:32:15.622 --> 00:32:19.172 If you zoom in, you’ll notice that the current No Anti-aliasing state 570 00:32:19.172 --> 00:32:23.272 actually hasn’t completely removed the effect 571 00:32:23.272 --> 00:32:28.522 sssssssssssssssss 572 00:32:28.522 --> 00:32:32.472 In URP, under Project Settings Graphics, 573 00:32:32.472 --> 00:32:38.572 the current applied URP quality setting is HighFidelity 574 00:32:38.572 --> 00:32:43.022 When you look at the default settings of URP, 575 00:32:43.022 --> 00:32:44.922 you'll see that 576 00:32:44.922 --> 00:32:49.022 Multi Sampling Anti-Aliasing is applied by default 577 00:32:49.022 --> 00:32:53.621 You can see the rendering result with sharp, jagged edges, 578 00:32:53.621 --> 00:32:58.171 which is one of the algorithms, in addition to multi sampling 579 00:32:58.171 --> 00:33:00.571 there are other types of Anti-aliasing 580 00:33:00.571 --> 00:33:03.021 that the camera can use, 581 00:33:03.021 --> 00:33:05.921 and you can apply them to see the difference 582 00:33:05.921 --> 00:33:09.321 So, for Anti-aliasing options, 583 00:33:09.321 --> 00:33:13.171 you don't need to use them redundantly 584 00:33:13.171 --> 00:33:16.671 It's better to either use the default multi-sampling provided 585 00:33:16.671 --> 00:33:19.071 or use the additional Anti aliasing 586 00:33:19.071 --> 00:33:21.821 attached to the main camera, 587 00:33:21.821 --> 00:33:25.321 You should choose based on 588 00:33:25.321 --> 00:33:29.921 what looks smoother to the eye 589 00:33:29.921 --> 00:33:31.471 or consider the impact on performance 590 00:33:31.471 --> 00:33:36.321 There are post-processing effects that allow you 591 00:33:36.321 --> 00:33:39.321 to control the rendered results across the entire screen 592 00:33:39.321 --> 00:33:42.971 Besides this, there are various data 593 00:33:42.971 --> 00:33:45.371 available on the screen after the rendering is complete, 594 00:33:45.371 --> 00:33:49.221 such as depth values, color values, 595 00:33:49.221 --> 00:33:51.871 position values, direction values, and more 596 00:33:51.871 --> 00:33:53.921 Using these imformation, 597 00:33:53.921 --> 00:33:56.571 let's create a simple effect 598 00:33:56.921 --> 00:34:00.221 Generally, in Core3D environments, 599 00:34:00.221 --> 00:34:04.971 you need to import the post-processing package 600 00:34:04.971 --> 00:34:07.221 via the package manager 601 00:34:07.221 --> 00:34:11.971 However, in URP, the basic post-processing is built in, 602 00:34:11.971 --> 00:34:14.521 and you can create and manage it 603 00:34:14.521 --> 00:34:16.921 through the Volume system within URP 604 00:34:16.921 --> 00:34:19.971 In the hierarchy, click on Volume, Global Volume 605 00:34:19.971 --> 00:34:22.321 to create post-processing effects 606 00:34:22.321 --> 00:34:25.021 that will affect the entire map 607 00:34:25.021 --> 00:34:28.271 Once the Volume object is created, click the New button 608 00:34:28.271 --> 00:34:30.871 to fill the currently empty Profile 609 00:34:30.871 --> 00:34:34.971 After that, click Add Override, Post Processing 610 00:34:34.971 --> 00:34:36.821 to select the effect you want 611 00:34:36.821 --> 00:34:39.721 There are a lot of options, 612 00:34:39.721 --> 00:34:42.621 but I won’t explain all of them 613 00:34:42.621 --> 00:34:44.021 Let's add one that is commonly used, like Bloom 614 00:34:44.021 --> 00:34:48.021 I will set the Intensity to 1 for now 615 00:34:48.021 --> 00:34:52.721 If you set the Intensity to 1, as you can see, 616 00:34:52.721 --> 00:34:56.171 even with the Smoothness or Metallic values being very high on the object, 617 00:34:56.171 --> 00:34:59.871 the intensity will still cause a glaring, 618 00:34:59.871 --> 00:35:03.471 almost painful shine like this 619 00:35:03.471 --> 00:35:06.871 At this point, you shouldn't only adjust the Bloom 620 00:35:06.871 --> 00:35:12.121 You also need to tweak the texture of the object itself a bit, 621 00:35:12.121 --> 00:35:14.421 exploring other methods 622 00:35:14.421 --> 00:35:17.471 to express a more comfortable 623 00:35:17.471 --> 00:35:20.621 and less glaring shine 624 00:35:20.621 --> 00:35:22.171 With Bloom, 625 00:35:22.171 --> 00:35:25.671 As you saw when we created the dissolve effect earlier, 626 00:35:25.671 --> 00:35:29.071 the Emissive value plays a key role 627 00:35:29.071 --> 00:35:34.221 By adjusting the color of the Emissive, 628 00:35:34.221 --> 00:35:36.921 it's not just about making the color brighter, 629 00:35:36.921 --> 00:35:39.921 but also increasing the Intensity 630 00:35:39.921 --> 00:35:44.321 you're seeing now, this results in the bright glowing effect 631 00:35:44.321 --> 00:35:46.571 This is how you use it 632 00:35:46.571 --> 00:35:49.621 It's not necessarily better just because it's strong 633 00:35:49.621 --> 00:35:53.371 I'll turn off the light probe for now since it might be distracting for the explanation 634 00:35:53.371 --> 00:35:56.371 In addition to this effect, another 635 00:35:56.371 --> 00:35:59.221 commonly used one is Depth of Field 636 00:35:59.221 --> 00:36:03.071 which is a camera focusing technique 637 00:36:03.071 --> 00:36:04.871 Let's try it out 638 00:36:04.871 --> 00:36:08.871 First, in the Global Volume, right below Bloom, 639 00:36:08.871 --> 00:36:11.021 click the Override button 640 00:36:11.021 --> 00:36:14.171 and add Depth of Field to the post processing effects 641 00:36:14.171 --> 00:36:18.621 Here, when you activate the mode, 642 00:36:18.621 --> 00:36:22.571 it will change from Off to two options: Gaussian or Bokeh 643 00:36:22.571 --> 00:36:27.121 Gaussian is quite easy to use 644 00:36:27.121 --> 00:36:29.971 However, since this effect determines 645 00:36:29.971 --> 00:36:33.021 how sharp the target appears in the camera, 646 00:36:33.021 --> 00:36:35.571 you can add or remove a slight effect 647 00:36:35.571 --> 00:36:38.171 in the game view 648 00:36:38.171 --> 00:36:41.071 to see the changes applied 649 00:36:41.071 --> 00:36:43.821 But we can't be sure if it's exactly 650 00:36:43.821 --> 00:36:47.871 as we intended just by doing that 651 00:36:47.871 --> 00:36:51.321 So, I’ll quickly adjust the position of the main camera 652 00:36:51.321 --> 00:36:54.921 and set it up 653 00:36:54.921 --> 00:36:57.821 so that the player is aligned 654 00:36:57.821 --> 00:37:00.721 in a straight line with the red building 655 00:37:00.721 --> 00:37:04.821 I'll turn off the gizmos for a clearer view 656 00:37:04.821 --> 00:37:09.121 First, set the angle in the scene view like this, 657 00:37:09.121 --> 00:37:11.971 then select the main camera 658 00:37:11.971 --> 00:37:15.071 and click the GameObject Align With View button 659 00:37:15.071 --> 00:37:17.921 Then, the game object you selected 660 00:37:17.921 --> 00:37:22.071 will be set to the position and angle 661 00:37:22.071 --> 00:37:24.021 that you're currently viewing in the scene view 662 00:37:24.621 --> 00:37:27.371 When comparing the game view and the scene view like this, 663 00:37:27.371 --> 00:37:30.121 you can see that Depth of Field is applied, 664 00:37:30.121 --> 00:37:32.821 so the background appears slightly blurred in the game view 665 00:37:32.821 --> 00:37:35.421 To make more detailed adjustments, 666 00:37:35.421 --> 00:37:39.471 I'll activate the Start and End sections here 667 00:37:39.471 --> 00:37:43.971 Start and End are parameters that determine 668 00:37:43.971 --> 00:37:48.221 where the sharpness begins 669 00:37:48.221 --> 00:37:51.271 and how far the sharpness extends 670 00:37:51.271 --> 00:37:56.271 I’ll temporarily move the camera view in the scene view 671 00:37:56.271 --> 00:37:59.171 I'm not moving the main camera, just changing the view 672 00:37:59.171 --> 00:38:01.271 I'll activate the gizmo, 673 00:38:01.271 --> 00:38:03.921 and when comparing it with the camera position, 674 00:38:03.921 --> 00:38:07.121 you'll see that the current Depth of Field's Start value is set to 10 675 00:38:07.121 --> 00:38:12.271 So, anything up to 10 meters from the camera will appear sharp and in focus 676 00:38:12.271 --> 00:38:16.471 On the other hand, anything beyond that point will gradually start to blur 677 00:38:16.471 --> 00:38:19.771 So, by adjusting these distance parameters, 678 00:38:19.771 --> 00:38:23.371 you can control how sharp or blurry objects appear 679 00:38:23.371 --> 00:38:26.771 For example, if you set the distance to 30m, 680 00:38:26.771 --> 00:38:30.271 objects that are further away will appear blurry, 681 00:38:30.271 --> 00:38:33.971 and those closer will stay sharp 682 00:38:33.971 --> 00:38:35.471 This is a simple way to control depth of field 683 00:38:35.471 --> 00:38:39.821 without needing in-depth knowledge of 684 00:38:39.821 --> 00:38:41.721 camera mechanics 685 00:38:41.721 --> 00:38:44.471 The Bokeh option, on the other hand, is 686 00:38:44.471 --> 00:38:48.721 based on the actual camera working principles 687 00:38:48.721 --> 00:38:53.871 and involves three main factors, Focus Distance, Focal Length, and Aperture 688 00:38:53.871 --> 00:38:57.571 Aperture, specifically, is the camera's diaphragm, 689 00:38:57.571 --> 00:39:01.271 which controls the amount of light that enters 690 00:39:01.271 --> 00:39:04.071 So, if you switch to the Bokeh format, 691 00:39:04.071 --> 00:39:07.521 you can create some unique effects 692 00:39:07.521 --> 00:39:11.221 For example, when we worked on Reflection 693 00:39:11.221 --> 00:39:14.271 and settings like Metallic and Smoothness earlier, 694 00:39:14.271 --> 00:39:17.221 you saw that when these values were too high, 695 00:39:17.221 --> 00:39:21.771 the light would appear to spread in a circular shape, like this 696 00:39:21.771 --> 00:39:24.971 To achieve this circular light spread effect, 697 00:39:24.971 --> 00:39:28.821 I'll set the Blade Count to 5 698 00:39:28.821 --> 00:39:31.221 and adjust the distance slightly 699 00:39:31.221 --> 00:39:34.171 To explain the Bokeh effect on screen, 700 00:39:34.171 --> 00:39:37.071 I intentionally adjusted the settings to extreme values, 701 00:39:37.071 --> 00:39:41.021 even though I wouldn't normally 702 00:39:41.021 --> 00:39:43.921 use these in practice 703 00:39:43.921 --> 00:39:45.871 For example, I changed 704 00:39:45.871 --> 00:39:47.821 the Focus Distance and Focal Length, 705 00:39:47.821 --> 00:39:50.571 but generally, the Bokeh effect draws attention 706 00:39:50.571 --> 00:39:54.171 to the shape of the highlighted light, like the one you're seeing now 707 00:39:54.171 --> 00:39:57.921 If the Blade Count is set to 3, 708 00:39:57.921 --> 00:40:02.121 the shape will be triangular 709 00:40:02.121 --> 00:40:05.571 it will be square, and with 5 or 6, 710 00:40:05.571 --> 00:40:09.071 it will form pentagonal or hexagonal shapes 711 00:40:09.071 --> 00:40:13.521 you can control how the light appears, adjusting the way light is shaped 712 00:40:13.521 --> 00:40:17.971 This filter that controls the shape of light is 713 00:40:17.971 --> 00:40:20.371 commonly referred to as Bokeh 714 00:40:20.371 --> 00:40:25.821 In Depth of Field, since it focuses on controlling 715 00:40:25.821 --> 00:40:28.771 how sharp objects appear, 716 00:40:28.771 --> 00:40:31.621 to show more realistic values, 717 00:40:31.621 --> 00:40:33.821 I’ll temporarily turn off the Stats 718 00:40:33.821 --> 00:40:37.421 Please remember what looks sharp here 719 00:40:37.421 --> 00:40:41.671 I’ve set the Distance value to 5 units 720 00:40:41.671 --> 00:40:44.421 in front of the current camera position 721 00:40:44.421 --> 00:40:46.771 This means that with the current camera position, 722 00:40:46.771 --> 00:40:51.821 it will focus on the point that is 5 units away from the camera 723 00:40:51.821 --> 00:40:55.021 This means that the camera will focus sharply on that point 724 00:40:55.021 --> 00:40:59.021 Then, based on the Focal Length, 725 00:40:59.021 --> 00:41:01.371 as the value decreases 726 00:41:01.371 --> 00:41:04.871 the area that appears sharp will expand 727 00:41:04.871 --> 00:41:10.071 As you can see, the Bokeh effect gradually disappears naturally 728 00:41:10.071 --> 00:41:12.771 So, depending on the Focal Length, 729 00:41:12.771 --> 00:41:15.720 if you fill the sharp area, 730 00:41:15.720 --> 00:41:18.620 only a narrow range will be in focus 731 00:41:18.620 --> 00:41:21.920 Conversely, if the Focal Length decreases, 732 00:41:21.920 --> 00:41:27.020 it determines the range in front and behind the object you want to focus on 733 00:41:27.020 --> 00:41:31.170 This is controlled by the Focal Length 734 00:41:31.170 --> 00:41:34.320 The Aperture controls how strong the effect will be, 735 00:41:34.320 --> 00:41:37.270 adjusting the intensity of the blur and focus in the scene 736 00:41:37.270 --> 00:41:40.070 To make it more natural, 737 00:41:40.070 --> 00:41:43.220 For a person, we always keep the focus sharp and steady 738 00:41:43.220 --> 00:41:45.970 on the exact spot we need to look at 739 00:41:45.970 --> 00:41:49.220 These are the basic effects provided by Unity 740 00:41:49.220 --> 00:41:52.620 Other than these, you can also extend 741 00:41:52.620 --> 00:41:55.120 functionality through the Asset Store 742 00:41:55.870 --> 00:41:59.020 If you look at the edges of the object, 743 00:41:59.020 --> 00:42:01.320 you can see that the shadows have become darker 744 00:42:01.320 --> 00:42:03.870 One effect that fits well with this is 745 00:42:03.870 --> 00:42:06.970 called Ambient Occlusion 746 00:42:06.970 --> 00:42:11.670 In the previous Core3D, Ambient Occlusion was managed through post-processing, 747 00:42:11.670 --> 00:42:16.470 but in URP, if you go to Project Settings, Graphics 748 00:42:16.470 --> 00:42:20.470 and check the current URP quality setting, 749 00:42:20.470 --> 00:42:24.870 HighFidelity, you'll see that 750 00:42:24.870 --> 00:42:26.270 Screen Space Ambient Occlusion is 751 00:42:26.270 --> 00:42:30.820 already applied under the Renderer List 752 00:42:30.820 --> 00:42:35.570 If you turn this off, you'll notice that the dark areas 753 00:42:35.570 --> 00:42:38.220 along the edges are treated more weakly 754 00:42:38.220 --> 00:42:42.320 However, if you turn it back on, you'll see the dark areas become darker and lighter accordingly 755 00:42:42.320 --> 00:42:44.770 The term Ambient Occlusion refers to 756 00:42:44.770 --> 00:42:47.370 ambient, environment 757 00:42:47.370 --> 00:42:50.570 and occlusion, blocked 758 00:42:50.570 --> 00:42:54.520 In simple terms, for large, open surfaces, 759 00:42:54.520 --> 00:42:58.220 light can reach from any direction 760 00:42:58.220 --> 00:43:00.770 On the other hand, if there’s a corner or angled surface, 761 00:43:00.770 --> 00:43:03.370 light coming from the opposite side won’t reach it 762 00:43:03.370 --> 00:43:06.570 The area where light can hit will be limited 763 00:43:06.570 --> 00:43:09.770 This is a visual representation of whether 764 00:43:09.770 --> 00:43:11.570 an area can receive light or not 765 00:43:11.570 --> 00:43:16.520 So, it's important to note that, unlike in Core3D, 766 00:43:16.520 --> 00:43:20.520 the management of these effects has shifted 767 00:43:20.520 --> 00:43:24.120 to a different system in URP 768 00:43:24.120 --> 00:43:27.470 It's a shame that I couldn't explain every feature, 769 00:43:27.470 --> 00:43:32.370 but I wanted to clarify, as it might be confusing 770 00:43:32.370 --> 00:43:35.320 to mix optimization with post processing 771 00:43:35.320 --> 00:43:37.320 To summarize, 772 00:43:37.320 --> 00:43:40.020 optimization and post-processing, 773 00:43:40.020 --> 00:43:45.470 along with tasks related to graphic resources, 774 00:43:45.470 --> 00:43:48.770 are complementary to each other 775 00:43:48.770 --> 00:43:51.370 If you increase the quality, 776 00:43:51.370 --> 00:43:54.520 then naturally, optimization will suffer 777 00:43:54.520 --> 00:43:57.920 In such cases, you need to make slight technical adjustments 778 00:43:57.920 --> 00:44:00.620 o improve quality without significantly compromising optimization 779 00:44:00.620 --> 00:44:05.470 It's important to find the right balance 780 00:44:05.470 --> 00:44:07.920 in these overall tasks and configure them accordingly 781 00:44:08.620 --> 00:44:12.520 In this section, we learned about the use of light mapping 782 00:44:12.520 --> 00:44:14.870 and post processing techniques 783 00:44:14.870 --> 00:44:19.320 topics related to light mapping, including Reflection Probes, Light Probes, and their integration 784 00:44:19.320 --> 00:44:21.920 Along with features for graphic optimization, 785 00:44:21.920 --> 00:44:26.270 we also controlled graphic resources in a real-time engine 786 00:44:26.270 --> 00:44:28.720 Various features like post processing 787 00:44:28.720 --> 00:44:31.520 consume resources in the post processing stage 788 00:44:31.520 --> 00:44:34.170 These effects, however, also help 789 00:44:34.170 --> 00:44:36.620 enhance immersion for the users 790 00:44:36.620 --> 00:44:39.720 It's important to strike a balance 791 00:44:39.720 --> 00:44:42.020 for efficient visual expression, 792 00:44:42.020 --> 00:44:44.220 rather than just focusing on saving resources 793 00:44:44.520 --> 00:44:49.420 This concludes the lecture on light mapping and post processing 794 00:44:49.420 --> 00:44:49.920 Light mapping 795 00:44:49.920 --> 00:44:50.420 ㅁ way of pre storing the information of an object receiving light in a texture 796 00:44:50.420 --> 00:44:50.920 It precomputes the lighting for static objects to reduce the computational load on the computer 797 00:44:50.920 --> 00:44:51.420 Light settings selecting Window, Rendering, Lighting 798 00:44:51.420 --> 00:44:51.920 Click the New button under the Lighting Setting Asset section to create a new one, then change the mode to Subtractive 799 00:44:51.920 --> 00:44:52.420 Set Direct Samples to 16 and Indirect Samples to 256 800 00:44:52.420 --> 00:44:52.920 Set Environment Samples to 128 and Lightmap Resolution to 12 801 00:44:52.920 --> 00:44:53.470 Change the Directional Light mode to Mixed, then save and click the Generate Lighting button 802 00:44:53.470 --> 00:44:53.970 Graphic optimization techniques 803 00:44:53.970 --> 00:44:54.470 Light Probe, An object that makes dynamic objects appear to receive the same lighting as static objects 804 00:44:54.470 --> 00:44:54.970 In the hierarchy window, select Light Point Light, then change the light mode to Baked 805 00:44:54.970 --> 00:44:55.470 In the hierarchy window, select Light Light Probe Group, then set its position to the world origin 806 00:44:55.470 --> 00:44:55.970 When you click the Edit Light Probe Positions button, you can select each individual probe and adjust its position 807 00:44:55.970 --> 00:44:56.470 Drag the probes to cover the necessary areas, and then use Ctrl C and Ctrl V to duplicate and expand them 808 00:44:56.470 --> 00:44:56.970 Select Window, Rendering, Lighting, then click the Generate Lighting button 809 00:44:56.970 --> 00:44:57.470 Even when the light is deactivated, the probes still hold the light information, allowing the lighting effects to be applied to dynamic objects 810 00:44:57.470 --> 00:44:58.120 Reflection Probe, An object that makes dynamic objects appear to receive the same reflections as static objects 811 00:44:58.120 --> 00:44:58.820 In the hierarchy window, select Light Reflection Probe to add it 812 00:44:58.820 --> 00:44:59.470 Click the Bake button to capture the surrounding environment image, then increase the Smoothness value in the Surface Inputs section 813 00:44:59.470 --> 00:45:00.120 Placing a Reflection Probe around a 3D object will create the effect of reflecting the surrounding environment 814 00:45:00.120 --> 00:45:00.820 The reflection effect is applied using the image stored in the Reflection Probe, rather than reflecting the real-time screen 815 00:45:00.820 --> 00:45:01.470 By using Light Probes and Reflection Probes, you can reduce the hardware load during content operation 816 00:45:01.470 --> 00:45:02.120 Post-processing additional image effects applied to the rendered screen after the rendering is completed 817 00:45:02.120 --> 00:45:02.820 In the main camera object, check the Post Processing option under Rendering to activate it 818 00:45:02.820 --> 00:45:03.470 In URP, post-processing is built in and managed through Volume 819 00:45:03.470 --> 00:45:04.120 Bloom effect A visual effect where light spreads naturally, similar to how neon signs glow 820 00:45:04.120 --> 00:45:04.820 In the hierarchy, select Volume Global Volume, then click the New button in the Inspector window under the Profile section 821 00:45:04.820 --> 00:45:05.470 Click the Add Override button, then select the Bloom effect 822 00:45:05.470 --> 00:45:05.970 Depth of Field A post processing effect that uses camera focusing techniques 823 00:45:05.970 --> 00:45:06.470 In the Global Volume Inspector window, click the Add Override button, then select the Depth of Field effect 824 00:45:06.470 --> 00:45:06.970 After enabling the mode, select Gaussian mode 825 00:45:06.970 --> 00:45:07.470 In the hierarchy, select the Main Camera, then choose GameObject Align With View from the menu bar 826 00:45:07.470 --> 00:45:07.970 Set and enable the Start and End values for Depth of Field 827 00:45:07.970 --> 00:45:08.470 The Bokeh mode properties 828 00:45:08.470 --> 00:45:08.970 Blade Count: The more blades you use, the rounder the Bokeh effect will appear 829 00:45:08.970 --> 00:45:09.470 Focus Distance, sets the distance from the camera to the point where the focus is sharp 830 00:45:09.470 --> 00:45:09.970 Focal Length, sets the range based on the distance between the object in focus and the camera lens 831 00:45:09.970 --> 00:45:10.470 Aperture, adjusts the intensity of the blur effect 832 00:45:10.470 --> 00:45:10.970 Ambient Occlusion Affects the boundary areas where objects overlap 833 00:45:10.970 --> 00:45:11.470 In URP, Screen Space Ambient Occlusion is applied by default