|
@@ -6,7 +6,7 @@ Lights and shadows
|
|
|
Introduction
|
|
|
------------
|
|
|
|
|
|
-Lights emit light that mixes with the materials and produces a visible
|
|
|
+Light sources emit light that mixes with the materials and produces a visible
|
|
|
result. Light can come from several types of sources in a scene:
|
|
|
|
|
|
- From the Material itself in the form of the emission color (though
|
|
@@ -51,7 +51,7 @@ There is a list of generic shadow parameters, each also has a specific function:
|
|
|
- **Contact**: Performs a short screen-space raycast to reduce the gap generated by the bias.
|
|
|
- **Reverse Cull Faces**: Some scenes work better when shadow mapping is rendered with face-culling inverted.
|
|
|
|
|
|
-Below is an image of how tweaking bias looks like. Default values work for most
|
|
|
+Below is an image of what tweaking bias looks like. Default values work for most
|
|
|
cases, but in general it depends on the size and complexity of geometry.
|
|
|
|
|
|
.. image:: img/shadow_bias.png
|
|
@@ -77,8 +77,8 @@ does not affect the lighting at all and can be anywhere.
|
|
|
|
|
|
.. image:: img/light_directional.png
|
|
|
|
|
|
-Every face whose front-side is hit by the light rays is lit while the others stay dark. Most light types
|
|
|
-have specific parameters, but directional lights are pretty simple in nature so they don't.
|
|
|
+Every face whose front-side is hit by the light rays is lit, while the others stay dark. Most light types
|
|
|
+have specific parameters, but directional lights are pretty simple in nature, so they don't.
|
|
|
|
|
|
Directional shadow mapping
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
@@ -112,7 +112,7 @@ Always make sure to set a shadow *Max Distance* according to what the scene need
|
|
|
A lower maximum distance will result in better-looking shadows.
|
|
|
|
|
|
Sometimes, the transition between a split and the next can look bad. To fix this,
|
|
|
-the **"Blend Splits"** option can be turned on which sacrifices detail in exchange
|
|
|
+the **"Blend Splits"** option can be turned on, which sacrifices detail in exchange
|
|
|
for smoother transitions:
|
|
|
|
|
|
.. image:: img/blend_splits.png
|
|
@@ -137,7 +137,7 @@ Shadowmap size for directional lights can be changed in Project Settings -> Rend
|
|
|
|
|
|
.. image:: img/project_setting_shadow.png
|
|
|
|
|
|
-Increasing it can solve bias problems but reduce performance. Shadow mapping is an art of tweaking.
|
|
|
+Increasing it can solve bias problems, but decrease performance. Shadow mapping is an art of tweaking.
|
|
|
|
|
|
Omni light
|
|
|
~~~~~~~~~~
|
|
@@ -147,7 +147,7 @@ radius.
|
|
|
|
|
|
.. image:: img/light_omni.png
|
|
|
|
|
|
-In real life, light attenuation is an inverse function which means omni lights don't have a radius.
|
|
|
+In real life, light attenuation is an inverse function, which means omni lights don't have a radius.
|
|
|
This is a problem because it means computing several omni lights would become demanding.
|
|
|
|
|
|
To solve this, a *Range* is introduced together with an attenuation function.
|
|
@@ -166,8 +166,8 @@ Omni light shadow mapping is relatively straightforward. The main issue that nee
|
|
|
considered is the algorithm used to render it.
|
|
|
|
|
|
Omni Shadows can be rendered as either **"Dual Paraboloid" or "Cube Mapped"**.
|
|
|
-The former renders quickly but can cause deformations
|
|
|
-while the later is more correct but more costly.
|
|
|
+The former renders quickly, but can cause deformations,
|
|
|
+while the later is more correct, but costlier.
|
|
|
|
|
|
.. image:: img/shadow_omni_dp_cm.png
|
|
|
|
|
@@ -199,16 +199,16 @@ stop functioning for spots, and you should consider using an Omni light instead.
|
|
|
Shadow atlas
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
-Unlike Directional lights which have their own shadow texture, Omni and Spot lights are assigned to slots of a shadow atlas.
|
|
|
+Unlike Directional lights, which have their own shadow texture, Omni and Spot lights are assigned to slots of a shadow atlas.
|
|
|
This atlas can be configured in Project Settings -> Rendering -> Quality -> Shadow Atlas.
|
|
|
|
|
|
.. image:: img/shadow_atlas.png
|
|
|
|
|
|
-The resolution applies to the whole Shadow Atlas. This atlas is divided in four quadrants:
|
|
|
+The resolution applies to the whole Shadow Atlas. This atlas is divided into four quadrants:
|
|
|
|
|
|
.. image:: img/shadow_quadrants.png
|
|
|
|
|
|
-Each quadrant can be subdivided to allocate any number of shadow maps. The following is the default subdivision:
|
|
|
+Each quadrant can be subdivided to allocate any number of shadow maps; the following is the default subdivision:
|
|
|
|
|
|
.. image:: img/shadow_quadrants2.png
|
|
|
|
|
@@ -217,16 +217,16 @@ represents a light the size of the screen (or bigger).
|
|
|
Subdivisions (smaller maps) represent shadows for lights that are further away
|
|
|
from view and proportionally smaller.
|
|
|
|
|
|
-Every frame, the following logic is done for all lights:
|
|
|
+Every frame, the following procedure is performed for all lights:
|
|
|
|
|
|
1. Check if the light is on a slot of the right size. If not, re-render it and move it to a larger/smaller slot.
|
|
|
2. Check if any object affecting the shadow map has changed. If it did, re-render the light.
|
|
|
3. If neither of the above has happened, nothing is done, and the shadow is left untouched.
|
|
|
|
|
|
-If the slots in a quadrant are full, lights are pushed back to smaller slots depending on size and distance.
|
|
|
+If the slots in a quadrant are full, lights are pushed back to smaller slots, depending on size and distance.
|
|
|
|
|
|
-This allocation strategy works for most games, but you may want to use a separate one in some cases (as example, a top-down game where
|
|
|
-all lights are around the same size and quadrants may have all the same subdivision).
|
|
|
+This allocation strategy works for most games, but you may want to use a separate one in some cases (for example, a top-down game where
|
|
|
+all lights are around the same size and quadrants may all have the same subdivision).
|
|
|
|
|
|
Shadow filter quality
|
|
|
~~~~~~~~~~~~~~~~~~~~~
|