[Unity] Lighting and Rendering Study Notes

1. Lighting environment (Lighting panel)

1. Skybox:

   (1) Import a custom skybox:

          Search for skybox on Google and you can find high quality cubemaps. Import it into Unity, select Cubemap as the type, drag it directly to the sky of the scene, and Unity will automatically generate the corresponding material (Shader is Skybox/Cubemap). You can also choose 6sliced ​​when customizing (requires 6 textures)

2. Ambient light:

    Optional skybox or fixed color, gradient color

3. Environment reflection:

   Optional skybox or custom.

4. Real-time global illumination

   Global illumination refers to the reflection of light from simulated objects, and the impact of this reflection on other objects

5.Mixed global illumination

    Blending means that static objects will have their colors calculated according to the baked map, and dynamic objects will be affected by lights in real time, producing correct shadows.

   (1) Subtractive: The function of mixing can be realized, but only one light is supported to have real-time effects on dynamic objects.

   (2) shadowmask: supports 4 lights, and uses the four channels of a picture to store the influence of 4 lights on an object.

   (3) distance shadowmask: Within a certain distance, static objects can also cast shadows on dynamic objects

         Edit->ProjectSettings->Quality->Shadow Mask Mode to set. The Shadow distance can be adjusted, and this property also affects the distance within which dynamic objects will produce shadows.

   (4) Bake Indirect: Only bake indirect light, others are real-time. When the distance is exceeded, no shadow is displayed.

6.Lightmap

(1) Ambient Occulusion: Ambient occlusion. Enhance the shadow effect at some corners

(2) Texture size (can be used for optimization)

Note: To save the Lightmap. You can manually generate it.

2. Lighting (Create->Lighting)

Some general properties    of lights :

   Color, Range, Intensity, Shadow Type, Cookie (Shadow Shape), Flare (Flare), Halo, Render Mode (real Time, Mixed, Baked), Culling Mask, etc.

1. Direct light: full range

2. Point light source: adjustable range

3. Spotlight: suitable for flashlight, desk lamp, etc.

4. Area light: only used for baking (applicable to static objects to generate lightmaps. Note that you need to check Generate Lightmap UVs in the model import parameters)

5. Light probe : Solve the effect of dynamic objects being affected by static object shadows in Mixed mode

6. Reflection probe : solve the reflection of objects on surrounding objects

3. Lighting-related settings on the model

1. Whether to generate shadows, whether to receive shadows

2. Is it affected by light probes and reflection probes?

3. Self-illuminating material : How to let other objects be affected by self-illuminating objects (must be set to Lightmap static for baking)

Four, camera and rendering related settings

1.Render Path:

   Forward: pixel level, supports a directional light shadow

   Defferd: supports multi-directional light shadows

   Vertex Lit: vertex level, no shadow support

2. Allow MSAA: Antialiasing

5. Project Settings for lighting rendering

1.Player->Other Settings->Rendering->Color Space:Linear比Gamma更好

2.Quality->Shadow->Shadows

6. What is screen post-processing?

Filters after rendering: Post-processing pack available for free at Asset Store

Common effects:

bloom blurs all colors on a certain color value (threshold)

motion blur motion blur, common in racing games

Antialiasing

Ambient Occlusion

Depth of field depth of field effect

Eye adaption

Color Grading

User Lut can perfectly replicate the layer style added in PS (copy layer style, apply layer style)

chromatic aberration (the effect of the vibrato icon on the edge of the lens)

vignette (black blurred edges for shots)

ambient light reflection

Seven, optimization related

What is optimization doing? Improve FPS frame rate and reduce Drawcall (CPU tells GPU to render instructions)

1. Reduce vertex count and shadows:

(1) Set some objects to be static, use non-real-time rendering, and bake lights.

(2) Use a light probe instead of a lightmask

(3) Change the resolution and size of the lightmap

2. Batch (Batches):

   Dynamic batching for dynamic objects: below 900 vertices, automatically

   Static batching for static objects: unlimited vertices, the optimization effect is more obvious

    Note: To enable these two batches in Edit->Project Settings->Player

3. Performance analysis tool: Window->Profier





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325579658&siteId=291194637