Game Advanced Beta Type Version 2
Hello everyone, this is Park Hyun sang, responsible for FPS game development lessons
In this lesson, I will be giving a lecture on
light mapping and optimization
As you reach the beta version and continue development,
you naturally end up adding
a lot of graphic resources to the project
However, in a real time rendering environment,
unlimited resource usage is not feasible
Therefore, we will learn how to optimize
various graphic resources such as lights, 3D meshes, and textures,
to provide smooth content delivery,
and how to effectively utilize graphic elements
라이트 매핑
We will cover the concept of light mapping
When we say light mapping, it is generally
a combination of the two words light and map
Light literally means light,
and when the expression map is added,
you can understand it as a texture
without much difference
In that case, it could be interpreted as
an image file for light
The process of creating a lightmap is the process of turning information
about light into an image file
Now, let's first understand why we convert information
about light into an image file
All objects in the real world can generally be
moved if there is enough force applied
On the other hand, if all objects in content created using a real-time engine
were to move based on physical calculations,
it would cause the computer
to perform heavy computations and operate very slowly
And inevitably, when the calculations become heavier,
the FPS (Frames Per Second)
the number of frames drawn per second
will decrease
The FPS value is one of the key indicators
of how smooth the content is
When users look at the screen, the term FPS
is often used to refer to the genre of games
It stands for First Person Shooting
In such cases, the target is usually set to 60 frames per second as the baseline
For content that focuses
more on visual aesthetics and storytelling,
the baseline is usually around 30 frames per second
Similarly, TV shows and movies often use
a lower frame rate of 24 frames per second
So, when users look at the screen,
we can tell how smooth
the experience is by using the FPS value
If it exceeds 60 frames per second, it will feel very smooth
Moreover, nowadays, there are monitors
that maintain very high frame rates,
such as 140 frames or 240 frames per second,
which has raised the expectations of users' eyes
However, as mentioned earlier,
if all objects are constantly performing
physical collisions or calculations,
In some cases, this could lead to providing a screen
with choppy visuals, such as 10 frames or even 5 frames per second
As a result, objects are typically divided into two main categories for management
The first category is what you refer to as characters,
or movable objects,
commonly known as Dynamic objects
The second category is objects that do not move,
such as background objects,
which are referred to as Static objects
Moving objects, like shadows,
change constantly, so there's not much we can do about them
However, for stationary Static objects,
we can precalculate tasks that require high computational costs
and provide them to users in advance
If we can pre-calculate parts like
lighting calculations and other elements such as navigation meshes,
which involve the movement paths of objects,
users will be able to enjoy
the content more smoothly and comfortably
A lightmap, in essence,
is used to precalculate lighting
for objects that are set as Static,
or non-moving, objects
In the example screen,
on the left is the image with no lightmap drawn,
and on the right is the image with the lightmap drawn
As you can see, here we have shading for the light,
effects like the red wall reflecting light onto the opposite wall,
and many other details
such as dark shadows under the eaves
These elements help create a more 3D
and realistic background image,
which can be provided to users
To achieve this, we will work on creating a lightmap
using the assets we have already received
The screen you're currently viewing
shows the Map v1 from the RPG FPS game assets
Since there is no camera,
the game view will display, No cameras rendering
so let's focus on the scene view for now
When you open the map,
you might see some strange, blotchy, angular shapes
on a structure that looks like a water tank,
resembling odd, uneven patterns
In the actual RPG FPS game assets industrial folder,
there's a folder with the same name of Map v1
Here, you can see a lightmap,
and since it contains only background objects,
it is applied to all of them
You can confirm that the lightmap is created,
with all the lighting information pre drawn as texture files
During the import process,
some data was modified,
and as you can see, some of the map data appears
to be corrupted or broken visually
We won't be using this as it is
We will drag the RPG FPS map into the Main Scene
that we have been working on, and add it to the scene file
We will deactivate the test objects we placed for testing purposes,
so they won't be visible in the scene
If you look at all the objects placed here, you'll notice that
that all the visible 3D objects have
then Static option enabled
in the top-right corner
of the Inspector window
And all the building objects are set as Static as well
If you click the arrow to the right of the Static option,
a list of various settings will appear
Here, you can see that the
Contribute GI option is enabled, as shown on the screen
When this option is enabled,
it means that the selected object
is the target for expressing
the lightmap's texture
So, all the background objects here
have already been neatly organized
by the developer and set as Static
So, we will drag this
directly into the Main Scene,
where the character is,
and then right click on Map v1,
and select Remove Scene
And then, we will click
the "Don't Save" button to avoid saving it
Then, you'll be able to confirm
that the strange images,
like the ones on the water tank, are gone
Before we create the lightmap,
we need to make some settings for the lighting first
Inside the Map_v1 game object,
there are particles, 3D objects, and light elements
In Unity, when you create a new scene,
a Directional Light and a Main Camera are
provided by default
Since there is an additional Directional Light,
we will delete that light
and only use the default light
provided in the Main Scene
A lightmap is essentially
the process of turning light information into a texture
So, when there is light,
you can see the direction of the light, as it is shown here
And when an object casts a shadow
based on the direction of the light,
not only is the shadow information generated,
but the information about the object's light
and dark sides is also captured
and turned into an image file
Now that we've covered the basic preparations for the lightmap
We will now start creating the lightmap
by going to Window to Rendering to Lighting
And if the Lighting Settings asset in the Scene is empty,
If it is empty, I will briefly delete it
If it's empty, you can click the New button to create a new one
The New Lighting Settings has been created now
here are several options, but for now,
we will change the lighting mode to Subtractive
The process of creating a lightmap
involves detailed light calculations,
so it is a task that typically takes a significant amount of time
Here, the Direct Samples will be set to half, which would be 16
The Indirect samples for the ambient light are also halved,
and the same goes for the Environment
Finally, the Lightmap Resolution
is set to 12 to speed up
the process and get quicker results
If we create the lightmap
for the current map using the default settings,
it will take over 40 minutes
In the industry, depending on the situation,
creating a lightmap can sometimes take an entire day or even overnight
But since we can't afford to spend that much time,
With these settings, and an important note
if you check the mode of the Directional Light,
it is set to Realtime
ou need to change this to either Mixed or Baked
I will set it to Mixed
That's because "Realtime" means
the light calculation for the selected Directional Light
will only be done in real time, rather than being pre computed
Baked" refers to the process of pre computing the lightmap,
which is commonly referred to as baking the light
Baking means turning the light information into a texture,
and when you bake, it indicates that
the Directional Light's information will be used only during the baking process
Since the Directional Light typically
acts like the sun,
it needs to affect both Dynamic objects
and Static objects as well
Therefore, it's common to set it to Mixed
so that it influences both types of objects
Once everything is prepared, save the Scene
Save it by clicking Ctrl and S
The Generate Lighting button
is at the bottom of the Lighting window We will click that
While the lightmap is being generated,
the time taken will be displayed at the bottom right
Right now, the time is gradually decreasing
While the lightmap is being baked,
let me first explain
the concept of Global Illumination
Earlier, we checked
the Contribute GI option in the Static settings
The abbreviation GI stands for Global Illumination
Generally, light can be direct, like sunlight
which directly hits objects,
and it can also be indirect where the direct light hits an object,
bounces off, and then influences other objects
This is referred to as Indirect light
Also, this light can eventually escape outward,
hit the sky, and then come back down
The light hits the particles floating in the air from the sky
So, it's not just the effect from the Directional Light
light that scatters in all directions after hitting clouds in the sky
or particles in the atmosphere is also considered
This type of light is referred to as GI (Global Illumination)
So, when we create a lightmap,
it's not just the direct light from a Directional Light like the sun
It also includes the assumption that the light bounces multiple times and hits from all directions,
incorporating Global Illumination,
as part of the baking process to generate the texture
The samples below are mostly
what we calculate as a single pixel data
when we ultimately create an image file
We refer to obtaining information
about multiple lights to determine
what color to represent this pixel as a sample
In other words, 16 samples are needed
to calculate for the Directional Light
It means that for Indirect or Environment,
hundreds of samples will be used
Below here, it's about collecting information
from those numerous samples to generate an image
If you look at the Lightmap Resolution section,
you'll see the term Texels per unit
1 unit in the real world is based on 1 meter,
and Unity has set 1 unit to represent 1 meter
When drawing 1 unit,
the number of pixels in the texture is referred to as a Texel
In other words, it's about how many pixels are
used to represent a 1m space
Naturally, the higher the number of Texels,
the more detailed the light representation becomes,
and shadows and other elements also become much more refineㅇ
However, this also means it takes more time
This means that you're dividing 1 meter into 12 parts to represent it
Now, the calculations for the light are complete according to the explanation
Here, let me quickly
turn off the gizmo beforehand
In this way, zombies and similar objects are dynamic,
so the shadow calculations
are done in real time
The background objects are static,
so even if they move, the shadows don't change
Moving the water tank won't change the shadow
The same applies here
That's because it was pre made
as a texture file like this
This is the texture file called a lightmap
Among them, the area occupied by the water tank is
highlighted in yellow by the Baked Lightmaps section
You can check by clicking the Open Preview button,
and in the Window menu,
under the Lighting panel, you can see that
the lightmap has been generated in a total of 5 images,
from 0 to 4, under the Baked Lightmaps section
The Subtractive method I used means
that all the shadows, highlights, and everything related to light
are represented in a single image
To be more precise, it means representing
everything in a single type of image
By enabling Baked Indirect here,
it will only represent the information related to indirect lighting
This means that shadows and other effects caused by direct light,
such as those created by direct lighting,
will be excluded, and only the indirect lighting will be drawn
Since Baked Indirect does not
include shadows,
only the information about the light and dark areas will be drawn
If you change the light, the shadow information can change as well
Instead, it will use one more texture
The Shadowmask method uses a total of three images
to represent shadows, bright areas, dark areas, and GI,
because it expresses by using three images
which makes it the slowest
and heaviest method among the lightmap techniques
Therefore, according to the Unity manual,
when targeting low spec platforms like mobile games,
it's recommended to use the Subtractive method
For high spec platforms, using options like Shadowmask
for baking is suggested
In this way, the light information is
organized into a single type,
and among the options, you can also see that additional information is
added separately regarding the direction
in which these 3D objects are facing in the world
So, this information is what we refer to
as baking the lightmap
The lightmap creation is now complete,
but it feels very dark and dull, right?
One reason for that is because the current environment's sky is
Unity's default sky
We need to make some adjustments to the Sky settings
First, let's look at the Skybox section
under RPG FPS game assets of Texture
Here, you can see an image of the sky with clouds
In the Window menu, go to Rendering and to Lighting panel,
and then drag the Skybox_v9
into the second Environment section next to Scene
As you can see now,
the Skybox in the background has been changed
If anyone can't see the updated Skybox,
you can toggle it on and off using the Toggle button in the viewport,
so feel free to try that you can turn it off and on again
Typically, when baking a lightmap,
you need to bake in information like
like red or blue hues from the Sky
in the environment to create more natural lighting
Previously, there wasn't enough Sky information
to use for that kind of lighting,
which is why the result appeared relatively dull
I will regenerate the lighting
and show you the comparison
once the Skybox has been applied
Now that the Skybox is set,
I will click the Generate Lighting button
In order to receive lighting information from the Skybox,
the Source section in the Environment Lighting settings
needs to be set to Skybox and this allows the lighting information
to be used as a reference when generating the lightmap
By default, you can modify the type of Environment Light
based on the result as needed
There are two results
The image at the top is the result
with the default Unity Skybox
The image shown here is a screenshot
taken after it was added later
The one below Unity's Skybox
is actually the result of
baking with the Skybox version 9 that we applied
There's not a big difference
he only noticeable difference here might be
that the shadow details are a bit more visible,
and a few points are slightly more defined
Other than that, the change is subtle
Of course, people with sharp eyes
might notice that the darker areas
have brightened a little
As for me, I prefer
using the Gradient option rather than
directly taking the information from the Skybox
It’s a bit more tedious,
but with the Gradient option,
you define the light from three directions
light coming down from the sky, light coming from the horizon,
and light bouncing off the ground
You can then choose custom colors
to represent these directions
So, I use the color picker to select a color
that closely matches
the brightest areas of the Sky I’ve added,
ensuring it doesn’t stray
too far from the original
For the light intensity, I’ll set it to 1 for now
Similarly, for the Equator, I click
and use the color picker to select the color of the light at the horizon,
setting the intensity to 1 as well
Finally, for the Ground,
I pick the color from the largest area,
which is the ground surface,
and set the color accordingly
Since it's been set to a bright value, if you feel it's too bright,
you can lower the intensity a bit
Even at 0, it will still maintain a basic level of brightness
If 1 is too bright, adjusting it down slightly is
another way to fine tune the expression
The value of 1 is just an arbitrary reference value
that I set for later adjustments
Once the light calculations are done, I’ll compare the results
with the third screenshot as well
In this situation, where the colors
from the Skybox were picked
and set using the Gradient, you can now see
that the shadowed areas have brightened significantly
compared to when the Skybox was directly used
The shadows aren't as harsh and they smoothly blend in
Also, you can notice that the blue in the Equator section has been emphasized more
This is something you can choose to use
depending on the person or the situation
When using this lightmap,
I'll show you another way to use it
by installing a custom light
By using Light Point Light
with the Only Baked setting,
which means it will only affect static objects by default,
This is how such effects can be expressed in some cases
I’ve set it to a slight red hue, so that
a red tint subtly blends into the surrounding environment
If we bake the lightmap in this state,
there is one issue
The "Baked" option only affects static objects
However, if a dynamic object approaches
in a situation like this with red light,
it won't have any effect
So, if the background is red
and the dynamic object is still only receiving the light from the sky,
it would create a very awkward situation
To prevent this,
there is a game object that,
after baking the light in the lightmap,
holds the information of the baked light
and then transfers it to the dynamic objects
This is called a light probe
It's the Light Probe object at the bottom of
the Light section in the hierarchy
I will install it and move its position to the world origin
So, if you look at the position, you'll see circular markers
To an appropriate starting position,
move these circles
If you click the Edit Light Probe Positions button,
you will be able to select the individual spheres
When placing light probes, you should generally ensure
that the light probes can encompass the character
If the character is jumping, consider the jump space as well
Then, drag and select the area you need
You can expand the area
by copying and pasting using
Ctrl C and Ctrl V
Ctrl C and V like this
If there is a lot of change in lighting, you should place the probes closer together
If there is little variation in the light,
it's fine to space them out more
So, here's the downside of light probes
It doesn't apply to those cases,
but light probes are always connected,
so they cannot function separately
So, once you start placing them this way,
it has the downside that you will constantly
need to keep placing them
Of course, I won't cover this in full
due to the length of the video,
but as you can see, the range of this triangle is visible
When the character enters the range of this triangle,
the probes within it will distribute
the light information from their current position
to the dynamic objects
So, in areas with a lot of light variation
or shadowed regions,
you need to place the probes very closely together
Otherwise, you should carefully select and adjust the spacing accordingly
Typically, a level designer handles this task
while adjusting the lighting
If there's a mistake or the spacing is too tight,
you can select and delete specific areas as needed
Since the computer will automatically handle the connections,
we'll leave the placement like this for now
Then, let's go to Window Rendering and click
the Generate Lighting button
to bake the lightmap
I increased the intensity value slightly more
than what was explained earlier and then baked the light
I will press play and compare how this object
looks in the game
Currently, it's outside the light probe's area,
or more specifically, outside the red region,
so it's not receiving any light
However, as you get closer,
you can see the red light casting onto the object
Even if you deactivate the red light here,
even if it's deactivated
the red light still
lingers around the barrel of the object
This is how light probes are used
In the same context, reflection probes serve
a similar role for light
Right now, there is no data,
but if you place the reflection probes
in appropriate areas and click the Bake button,
it will capture the surrounding environment in a 360 degree view
This captured image will then be applied
to shiny surfaces like glass, creating a reflective effect
Let's take a closer look at it here
I will intentionally increase the fabric's texture to an exaggerated level
If you increase the Smoothness value like this
and compare before and after adding the Reflection Probe,
you can temporarily remove the texture to set it to None,
and then increase the Metallic
This will show that the surrounding environment is reflected
What the Reflection Probe does is that right now,
it’s only casting light around without any objects
but if a 3D object exists
within the area of the Reflection Probe
Now, I will lower this and place it around the 3D object
By doing that, as you can see now,
it creates the feeling that the surrounding environment
is being directly reflected
Instead, the Reflection doesn't reflect in live,
the images that Reflection Probe holds,
are reflected to show
as if it's reflecting it
If you turn off the Reflection Probe, only the default Sky will be reflected
So, by baking the Reflection Probe like this,
what is created at this time is the Reflection Map
So, it's not just baking the light
you can also pre-calculate data
like the baked light from these probes
Just like the Reflection Probe,
you can pre-calculate the surrounding environment’s image,
which reduces the computational load on the hardware
when the content is
running in real-time
These series of tasks are mostly referred to as optimization
What you need to remember in optimization is
that it's not just about saving resources for the sake of it
It’s about saving resources,
but still making things look better,
or improving performance without creating
a big difference before and after applying a technique
We’ve looked into optimization techniques,
and these techniques
can also be applied while creating 3D objects
When controlling your content,
using one zombie object
instead of three will consume
fewer resources, right?
One method is to consolidate the health of three zombies into one,
instead of splitting 10, 10, and 10, you make it 30
This way, you make the player invest more time
to defeat just one zombie
Simply put, optimization
doesn't only apply to graphics
It's important to understand that it's a process
where all parts work together
It’s not always good to save resources just for the sake of it
Sometimes, additional effects are intentionally used
to provide a more immersive environment for the users
A good example of this is the use of post-processing effects on the camera,
so it's important to
activate them
No matter how it looks in the scene view,
if the post-processing effects are not applied to the screen
the users actually see, it wouldn't make any sense
So, to ensure the effects are displayed on the screen the users see,
you need to activate the post processing checkbox
In the same context, you can see
that the camera also has
the Anti-aliasing option added here
In the case of Anti-aliasing,
it's about how to make the screen appear smoother
If you zoom in, you’ll notice that the current No Anti-aliasing state
actually hasn’t completely removed the effect
sssssssssssssssss
In URP, under Project Settings Graphics,
the current applied URP quality setting is HighFidelity
When you look at the default settings of URP,
you'll see that
Multi Sampling Anti-Aliasing is applied by default
You can see the rendering result with sharp, jagged edges,
which is one of the algorithms, in addition to multi sampling
there are other types of Anti-aliasing
that the camera can use,
and you can apply them to see the difference
So, for Anti-aliasing options,
you don't need to use them redundantly
It's better to either use the default multi-sampling provided
or use the additional Anti aliasing
attached to the main camera,
You should choose based on
what looks smoother to the eye
or consider the impact on performance
There are post-processing effects that allow you
to control the rendered results across the entire screen
Besides this, there are various data
available on the screen after the rendering is complete,
such as depth values, color values,
position values, direction values, and more
Using these imformation,
let's create a simple effect
Generally, in Core3D environments,
you need to import the post-processing package
via the package manager
However, in URP, the basic post-processing is built in,
and you can create and manage it
through the Volume system within URP
In the hierarchy, click on Volume, Global Volume
to create post-processing effects
that will affect the entire map
Once the Volume object is created, click the New button
to fill the currently empty Profile
After that, click Add Override, Post Processing
to select the effect you want
There are a lot of options,
but I won’t explain all of them
Let's add one that is commonly used, like Bloom
I will set the Intensity to 1 for now
If you set the Intensity to 1, as you can see,
even with the Smoothness or Metallic values being very high on the object,
the intensity will still cause a glaring,
almost painful shine like this
At this point, you shouldn't only adjust the Bloom
You also need to tweak the texture of the object itself a bit,
exploring other methods
to express a more comfortable
and less glaring shine
With Bloom,
As you saw when we created the dissolve effect earlier,
the Emissive value plays a key role
By adjusting the color of the Emissive,
it's not just about making the color brighter,
but also increasing the Intensity
you're seeing now, this results in the bright glowing effect
This is how you use it
It's not necessarily better just because it's strong
I'll turn off the light probe for now since it might be distracting for the explanation
In addition to this effect, another
commonly used one is Depth of Field
which is a camera focusing technique
Let's try it out
First, in the Global Volume, right below Bloom,
click the Override button
and add Depth of Field to the post processing effects
Here, when you activate the mode,
it will change from Off to two options: Gaussian or Bokeh
Gaussian is quite easy to use
However, since this effect determines
how sharp the target appears in the camera,
you can add or remove a slight effect
in the game view
to see the changes applied
But we can't be sure if it's exactly
as we intended just by doing that
So, I’ll quickly adjust the position of the main camera
and set it up
so that the player is aligned
in a straight line with the red building
I'll turn off the gizmos for a clearer view
First, set the angle in the scene view like this,
then select the main camera
and click the GameObject Align With View button
Then, the game object you selected
will be set to the position and angle
that you're currently viewing in the scene view
When comparing the game view and the scene view like this,
you can see that Depth of Field is applied,
so the background appears slightly blurred in the game view
To make more detailed adjustments,
I'll activate the Start and End sections here
Start and End are parameters that determine
where the sharpness begins
and how far the sharpness extends
I’ll temporarily move the camera view in the scene view
I'm not moving the main camera, just changing the view
I'll activate the gizmo,
and when comparing it with the camera position,
you'll see that the current Depth of Field's Start value is set to 10
So, anything up to 10 meters from the camera will appear sharp and in focus
On the other hand, anything beyond that point will gradually start to blur
So, by adjusting these distance parameters,
you can control how sharp or blurry objects appear
For example, if you set the distance to 30m,
objects that are further away will appear blurry,
and those closer will stay sharp
This is a simple way to control depth of field
without needing in-depth knowledge of
camera mechanics
The Bokeh option, on the other hand, is
based on the actual camera working principles
and involves three main factors, Focus Distance, Focal Length, and Aperture
Aperture, specifically, is the camera's diaphragm,
which controls the amount of light that enters
So, if you switch to the Bokeh format,
you can create some unique effects
For example, when we worked on Reflection
and settings like Metallic and Smoothness earlier,
you saw that when these values were too high,
the light would appear to spread in a circular shape, like this
To achieve this circular light spread effect,
I'll set the Blade Count to 5
and adjust the distance slightly
To explain the Bokeh effect on screen,
I intentionally adjusted the settings to extreme values,
even though I wouldn't normally
use these in practice
For example, I changed
the Focus Distance and Focal Length,
but generally, the Bokeh effect draws attention
to the shape of the highlighted light, like the one you're seeing now
If the Blade Count is set to 3,
the shape will be triangular
it will be square, and with 5 or 6,
it will form pentagonal or hexagonal shapes
you can control how the light appears, adjusting the way light is shaped
This filter that controls the shape of light is
commonly referred to as Bokeh
In Depth of Field, since it focuses on controlling
how sharp objects appear,
to show more realistic values,
I’ll temporarily turn off the Stats
Please remember what looks sharp here
I’ve set the Distance value to 5 units
in front of the current camera position
This means that with the current camera position,
it will focus on the point that is 5 units away from the camera
This means that the camera will focus sharply on that point
Then, based on the Focal Length,
as the value decreases
the area that appears sharp will expand
As you can see, the Bokeh effect gradually disappears naturally
So, depending on the Focal Length,
if you fill the sharp area,
only a narrow range will be in focus
Conversely, if the Focal Length decreases,
it determines the range in front and behind the object you want to focus on
This is controlled by the Focal Length
The Aperture controls how strong the effect will be,
adjusting the intensity of the blur and focus in the scene
To make it more natural,
For a person, we always keep the focus sharp and steady
on the exact spot we need to look at
These are the basic effects provided by Unity
Other than these, you can also extend
functionality through the Asset Store
If you look at the edges of the object,
you can see that the shadows have become darker
One effect that fits well with this is
called Ambient Occlusion
In the previous Core3D, Ambient Occlusion was managed through post-processing,
but in URP, if you go to Project Settings, Graphics
and check the current URP quality setting,
HighFidelity, you'll see that
Screen Space Ambient Occlusion is
already applied under the Renderer List
If you turn this off, you'll notice that the dark areas
along the edges are treated more weakly
However, if you turn it back on, you'll see the dark areas become darker and lighter accordingly
The term Ambient Occlusion refers to
ambient, environment
and occlusion, blocked
In simple terms, for large, open surfaces,
light can reach from any direction
On the other hand, if there’s a corner or angled surface,
light coming from the opposite side won’t reach it
The area where light can hit will be limited
This is a visual representation of whether
an area can receive light or not
So, it's important to note that, unlike in Core3D,
the management of these effects has shifted
to a different system in URP
It's a shame that I couldn't explain every feature,
but I wanted to clarify, as it might be confusing
to mix optimization with post processing
To summarize,
optimization and post-processing,
along with tasks related to graphic resources,
are complementary to each other
If you increase the quality,
then naturally, optimization will suffer
In such cases, you need to make slight technical adjustments
o improve quality without significantly compromising optimization
It's important to find the right balance
in these overall tasks and configure them accordingly
In this section, we learned about the use of light mapping
and post processing techniques
topics related to light mapping, including Reflection Probes, Light Probes, and their integration
Along with features for graphic optimization,
we also controlled graphic resources in a real-time engine
Various features like post processing
consume resources in the post processing stage
These effects, however, also help
enhance immersion for the users
It's important to strike a balance
for efficient visual expression,
rather than just focusing on saving resources
This concludes the lecture on light mapping and post processing
Light mapping
ㅁ way of pre storing the information of an object receiving light in a texture
It precomputes the lighting for static objects to reduce the computational load on the computer
Light settings selecting Window, Rendering, Lighting
Click the New button under the Lighting Setting Asset section to create a new one, then change the mode to Subtractive
Set Direct Samples to 16 and Indirect Samples to 256
Set Environment Samples to 128 and Lightmap Resolution to 12
Change the Directional Light mode to Mixed, then save and click the Generate Lighting button
Graphic optimization techniques
Light Probe, An object that makes dynamic objects appear to receive the same lighting as static objects
In the hierarchy window, select Light Point Light, then change the light mode to Baked
In the hierarchy window, select Light Light Probe Group, then set its position to the world origin
When you click the Edit Light Probe Positions button, you can select each individual probe and adjust its position
Drag the probes to cover the necessary areas, and then use Ctrl C and Ctrl V to duplicate and expand them
Select Window, Rendering, Lighting, then click the Generate Lighting button
Even when the light is deactivated, the probes still hold the light information, allowing the lighting effects to be applied to dynamic objects
Reflection Probe, An object that makes dynamic objects appear to receive the same reflections as static objects
In the hierarchy window, select Light Reflection Probe to add it
Click the Bake button to capture the surrounding environment image, then increase the Smoothness value in the Surface Inputs section
Placing a Reflection Probe around a 3D object will create the effect of reflecting the surrounding environment
The reflection effect is applied using the image stored in the Reflection Probe, rather than reflecting the real-time screen
By using Light Probes and Reflection Probes, you can reduce the hardware load during content operation
Post-processing additional image effects applied to the rendered screen after the rendering is completed
In the main camera object, check the Post Processing option under Rendering to activate it
In URP, post-processing is built in and managed through Volume
Bloom effect A visual effect where light spreads naturally, similar to how neon signs glow
In the hierarchy, select Volume Global Volume, then click the New button in the Inspector window under the Profile section
Click the Add Override button, then select the Bloom effect
Depth of Field A post processing effect that uses camera focusing techniques
In the Global Volume Inspector window, click the Add Override button, then select the Depth of Field effect
After enabling the mode, select Gaussian mode
In the hierarchy, select the Main Camera, then choose GameObject Align With View from the menu bar
Set and enable the Start and End values for Depth of Field
The Bokeh mode properties
Blade Count: The more blades you use, the rounder the Bokeh effect will appear
Focus Distance, sets the distance from the camera to the point where the focus is sharp
Focal Length, sets the range based on the distance between the object in focus and the camera lens
Aperture, adjusts the intensity of the blur effect
Ambient Occlusion Affects the boundary areas where objects overlap
In URP, Screen Space Ambient Occlusion is applied by default