Lighting And Shadows Flashcards

1
Q

What is Global Illumination (GI)

A

Gi is a system that models how light is bounced off of surfaces onto other surfaces, Indirect light, rather than being limited to just the light that hits a surface directly from a light source

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Modeling indirect lighting allows for effects that make the virtual world seem more realistic and connected, since objects affect each other’s appearance

A

True. An example is color bleeding, where sunlight hitting a red sofa will cause red light to be bounced onto the wall behind it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Color bleeding is where light is leaked or bounced off one surface onto another

A

Another example is when sunlight hits the floor at the opening of a cave and bounces around inside so the inner parts of the cave are illuminated too.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Limitations of baked GI
Both Baked GI and precomputed real-time GI have the limitation that only static objects can be included in the bake/precomputation.

A

Moving objects cannot bounce light onto other objects and vice versa.
But they can still pick up bounce light from static objects using light probes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are light probes

A

Light probes are positions in the scene where the light is measured, or probed, during the bake/precomputation, and then at runtime the indirect light that hits non static objects is approximated using the values from the probes that the object is closest to at any given moment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Examples of GI effects.
Changing the direction and color of a direction and color of a directional light to simulate the effect of the sun moving across the sky.

A

By modifying the skybox along with the directional light it is possible to create a realistic time of day effect that is updated at runtime.
As the day progresses the sunlight streaming in through a window moves onto the floor and bounced across the room and onto the ceiling.
When te sunlight reaches a red sofa, the red light is bounced onto the walls behind it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Emissions in lighting

A

Animating the emissiveness of a neon signs materials so it starts glowing onto its surroundings when it’s turned on is an example of GI effects aswell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How are shadow’s formed in unity

A

Unitys lights can cast Shadows from an object onto other parts of itself or onto other nearby objects.
Shadows add a degree of depth and realism to a scene since they bring out the scale and position of objects that otherwise look flat

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do shadow’s work

A

The simplest case is of a scene with a single light source.
Light rays travel in straight lines from that source and may eventually hit objects in the scene.
Once a ray has hit an object, it can’t travel any further to illuminate anything else, it bounces off the first object and doesn’t pass through. The shadows cast by the object are simply the areas that are not illuminated because the light couldnt reach them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a shadow map

A

The light uses the same principle as a camera to render the scene internally from its point of view.
A depth buffer system, as used by the scene camera, keeps track of the surfaces that are closest to the light, surfaces in a direct line of sight receive illumination but all the others are in shadow.
The depth map is also known as a shadow map

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Enable the shadow properties using the inspector

A

Use the shadow type property in the inspector to enable and define shadows for an individual light
You can change the shadow type, strength, resolution, bias, normal bias and shadow near plane

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Mesh renderer for shadows

A

Each mesh renderer in the scene also has a cast shadow and a receive shadows property, which must be enabled as appropriate.
Mesh renderer property in the inspector must have cast Shadows on. Receive shadows can be turned on and off

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Casting shadows

A

Enable cast Shadows by selecting On from the drop down menu to enable or disable shadow casting for the mesh. Alternatively select Two Sided to allow shadows to be cast by either side of the surface, so backface culling is ignored for shadow casting purposes, or shadows only to allow shadows to be cast by an invisible gameObject

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the Shadow mapping and Bias property

A

The shadows for a given Light are determined during the final scene rendering.
When the scene is rendered to the main camera view, each pixel position in the view is transformed into the coordinate system of light.
The distance of a pixel from the light is then compared to the corresponding pixel in the shadow map.
If the pixel is more distant than the shadow map pixel, then it is presumably obscured from the light by another GameObject and it obtains no illumination.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Shadows on GameObjects

A

Correct shadowing. A surface directly illuminated by a light sometimes appears to be partly in shadow. Pixels that should be exactly at the distance specified in the shadow map are sometimes calculated as being further away, this is a consequence of using shadow filtering, or a low resolution image for the shadow map. The result is arbitrary of pixels in the shadow when they should really be lit, giving a visual effect known as Shadow Acne.
Shadow acne in the form of false self shadowing artifacts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How to prevent shadow acne

A

To prevent shadow acne, a bias value can be added to the distance in the shadow map to ensure that pixels on the borderline definitely pass the comparison as they should, or to ensure that while rendering into the shadow map, gameObjects can be inset a little bit along their normals.
These values are set by the Bias AND Normal bias properties in the light inspector window when shadows are enabled.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Bias with shadows

A

Do not set the Bias value too high, because areas around a shadow near the GameObject casting it are sometimes falsely illuminated.
This results in a disconnected shadow, making the GameObject look as if it is flying above the ground.
A high Bias value makes the shadow appear disconnected from the GameObject

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Normal Bias with shadows

A

Setting the Normal Bias value too high makes the shadow appear too narrow for the GameObject..
Normal Bias can cause unwanted effects called, light bleeding, where light bleeds through the nearby geometry into areas that shouldn’t be shadowed.
A potential solution is to open the GameObjects mesh renderer and change the cast Shadows property to Two Sided.
This can sometimes help, although it can be more resource intensive and increase performance overhead when rendering the scene.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Bias values

A

Bias values for a light may need tweaking to make sure that unwanted effects do not occur. It is generally easier to gauge the right value by eye rather than attempting to calculate it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Shadow Pancaking

A

To further prevent shadow acne, a technique called Shadow pancaking is used. This generally works well, but can create visual artifacts for very large triangles.
A low shadow near plane offset value can create the appearance of holes in shadows.

21
Q

Shadow near plane offset

A

Tweak the shadow near plane offset property to troubleshoot this problem. Setting this value too high introduces shadow acne.

22
Q

Directional light shadows

A

A directional light typically simulates sunlight and a single light can illuminate the whole of a scene.
This means that the shadow map will often cover a large portion of the scene at once and this makes the shadows susceptible to a problem called perspective aliasing. Perspective aliasing means that shadow map pixels seen close to the camera look enlarged and chunky compared to those father away.

23
Q

Shadow pancaking

A

To further prevent shadow acne we use a technique called Shadow pancaking.
The idea is to reduce the range of the light space used when rendering the shadow map along the light direction.
This lead to an increased precision in the shadow map, reducing shadow acne.
Clamp the shadow casters to the near clip plane of the optimized space, in the vertex shader. This can create artifacts for very large triangles crossing the near clip plane.

24
Q

Shadow Cascades

A

The reason perspective aliasing occurs is that different areas of the shadow map are scaled disproportionately by the cameras perspective.
The shadow map from a light needs to cover only part of the screen visible to the camera, which is defined by the cameras view ?frustum?

25
Q

Cascaded shadow maps

A

Staged reductions in shadow map size, sometimes called Parallel Split Shadow Maps.
From the Quality Settings, you can set zero, two or four cascades for a given quality level.

26
Q

Shadow options

A

Shadows, hard and soft shadows and other
Shadow resolution, very high, high, low etc
Shadow projection, close fit and other
Shadow distance, you set the numerical value input, Ie, 80
Shadow near plane of, you set the numerical value input, Ie, 2
Shadow Cascades, zero, two, or four

27
Q

Shadow Cascades

A

The more Cascades you use, the less your shadows will be affected by perspective aliasing. Increasing the number comes with a higher rendering overhead.
The overhead is still less than it would be if you were to use a high resolution map across the whole shadow.

28
Q

Shadow distance

A

Shadows from objects tend to become less noticeable the farther the objects are from the camera, they appear smaller onscreen and are usually not the focus of attention.
The shadow distance property in the Quality Settings, let’s you take advantage of this effect. Objects beyond this distance, from the camera, cast no shadows at all, while the shadows from objects approaching this distance gradually fade out.
Set the shadow distance as low as possible to help rendering performance.

29
Q

Types of shadows

A

Hard shadows, produces shadows with a sharp edge. Not as realistic as soft shadows but involves less processing
Soft shadows, tend to reduce the blocky aliasing effect from the shadow map

30
Q

Light types, point lights

A

Point lights are located at a point in space and sends light out in ALL DIRECTIONS equally. The direction of hitting a surface is the line from the point of contact back to the center of the light object. The intensity diminishes with the distance from the light, reaching zero at a specified range. Light intensity is inversely proportional to the square of the distance from the source.
This is known as, Inverse Square Law, and is similar to how light behaves in the real world.

31
Q

What are point lights useful for

A

Point lights are useful for simulating lamps and other local sources of light in a scene. You can also use them to make a spark or explosion illuminate it’s surroundings in a convincing way.

32
Q

What are Spot Lights
Generally used for artificial light sources such as flashlights, car headlights and searchlights. With the direction controlled from a script or animation, a moving spot light will illuminate just a small area of the scene and create dramatic lighting effects

A

A Spot light has a specified location and range over which the light falls off. However, the Spot Light is constrained to an angle, resulting in a CONE Shaped region of illumination. The center of the cone points in the forward (z) direction of the light object.
Light also diminishes at the edge of the spot lights cone. Widening the angle increases the width of the cone and with it increases the size or this fade, know as the PENUMBRA

33
Q

Directional Light

A

Directional lights are very useful for creating effects such as sunlight in your scenes. Behaving in many ways like the sun. Directional lights can be thought of as distant light sources which exist infinitely far away.
A directional light does not have any identifiable source position and so the light object can be placed anywhere in the scene.
All objects in the scene are illuminated as if the light is always from the same direction. The distance of the light from the target object is not defined and so the light does not diminish

34
Q

Directional light represents large, distant sources that come from a position outside the range of the game world

A

In a realistic scene, they can be used to simulate the sun or moon.
In the abstract game world, they can be a useful way to add convincing shading to objects without exactly specifiying where light is coming from.

35
Q

When checking an object in the scene view, to see how its mesh, shader and material look, a directional light is often the quickest way to get an impression of how it’s shading will appear. You simply want to see the object look solid and look for glitches in the model

A

By default every new unity scene contains a directional light. In Unity 5, this is linked to the procedural sky system defined in the Environment Lighting section of the Lighting Panel. Lighting, Scene, Skybox. You can change this behavior by deleting the default directional light and creating a new light or simply by specifying different GameObject from the sun parameter. Lighting, scene, sun. Rotating the default directional light, or sun, causes the skybox to update.

36
Q

Area lights
The lighting calculation is quite processor intensive, area lights are not available at runtime and can only be baked into light maps

A

An Area light is defined by a rectangle in space. Light is emitted in all directions uniformly across their surface area, but only from one side of the rectangle.
There is no manual control for the range of an area light, however intensity will deminish at inverse square of the distance as it travels away from the source.

37
Q

Area lights illuminates an object from several different directions at once, the shading tends to be more soft and subtle than the other light types

A

Area lights can be used to create a realistic street light or a bank of lights close to the player. A small are light can simulate smaller sources of light, such as interior house lighting, but with a more realistic effect than a point light.

38
Q

Emissive materials

Soft lighting effects in real-time are still possible using emissive materials

A

Emissive materials emit light across their surface area. They contribute to bounced light in your scene and associated properties such as color and intensity can be changed during game play.

39
Q

Area lights are not supported by Precomputed real-time GI

A

True

40
Q

Emission is a property of the standard shader which allows static objects in our scene to emit light.

A

By default the value of emission is set to zero. This means that no light will be emitted by objects assigned materials using the standard shader

41
Q

Emissions will only be received by objects marked as static or lightmap static from the inspector.

A

Emissive materials applied to non static or dynamic geometry such as characters will not contribute to scene lighting.
There is no range value for emissive materials but light emitted will again falloff at a quadratic rate.

42
Q

Ambient Light is light that is present all around the scene and doesn’t come from any specific source object

A

It can be an important contributor to the overall look and brightness of a scene.

43
Q

When is Ambient Light useful? In a number of cases, depending upon your chosen art style it can be useful

A

A bright cartoon style rendering where dark shadows may be undesirable or where lighting is perhaps hand painted into textures.
An ambient light can also be useful if you need to increase the overall brightness of a scene without adjusting individual lights

44
Q

Light baking
The behavior of a light component when you set its mode property to baked. Also known as baked lights
Unity performs calculations for baked lights in the unity editor and saves the results to the disk as lighting data. This process is called baking
Baking lights are useful for lighting things that won’t change at runtime, such as scenery

A

Unity bakes both direct light and indirect lighting from baked lights into Lightmaps
Unity bakes both direct and indirect lighting from baked lights into light probes

45
Q

Limitations of baked lights
You cannot change the properties of baked lights at runtime
Baked lights do not contribute to specular lighting
Dynamic GameObjects do not receive light or shadow from baked lights

A

If you disable baked global illumination in your scene, Unity forces baked lights to behave as though you set their mode to realtime. When this happens Unity displays a warning on the light component of the inspector

46
Q

Lightmaps
A pre rendered texture that contains the effects of light sources on static objects in the scene.
Lightmaps are overlaid on top of scene geometry to create the effect of lighting

A
47
Q

Culling mask in unity
The Unity camera class has a culling mask such that each camera can be set to only display a subset of the available layers.
This is handy for placing 3D objects in one layers visible to the camera, and say the GUI in another layer visible by a different camera

A
48
Q

Light.culling mask
This is used to light certain objects in the scene selectively
A GameObject will only be illuminated by a light if that lights culling mask includes the layer chosen for the GameObject.
Ie. The mask bit for the layer must be set to 1 for the object to receive any light

A