|
1 | 1 | --- |
2 | | -title: 3D Light |
| 2 | +title: 3D Lights |
3 | 3 | --- |
4 | | -# 3D Light |
| 4 | +# 3D Lights |
5 | 5 |
|
6 | | -## Choose the right light |
| 6 | +3D Light objects can be moved around the scene and emit light from their center. They can also cast shadows for 3D objects. |
7 | 7 |
|
8 | | -Light objects illuminate some part of the scene whereas light effects illuminate the whole scene. |
| 8 | +- A [spot light](/gdevelop5/extensions/light3d/#3d-spot-light) lights up a cone-shaped area, similar to a flashlight. |
| 9 | +- A [point light](/gdevelop5/extensions/light3d/#3d-point-light) lights up in all directions, similar to a fire or a light bulb. |
9 | 10 |
|
10 | | -### Light objects |
| 11 | + |
11 | 12 |
|
12 | | -Light objects can be moved. They emit light from their center. They can cast shadows for 3D objects. |
| 13 | +## Light layer effects |
13 | 14 |
|
14 | | -- [Spot light](/gdevelop5/extensions/light3d/#3d-spot-light) lights up a cone like a flashlight. |
15 | | -- [Point light](/gdevelop5/extensions/light3d/#3d-point-light) lights up in all directions like a fire. |
| 15 | +Light effects are "global lights" configured through [layer effects](/gdevelop5/interface/scene-editor/layer-effects): |
16 | 16 |
|
17 | | -### Light layer effects |
| 17 | +- A [directional light](/gdevelop5/all-features/scene3d/reference/#effect-directional-light) acts as a very distant light source, like the sun. It can cast shadows for 3D objects. When used on its own, the unlit side of an object appears completely black, which is why it's commonly paired with a hemisphere light. |
| 18 | +- An [ambient light](/gdevelop5/all-features/scene3d/reference/#effect-ambient-light) illuminates objects evenly from every direction. Since it produces no shading, objects can look flat — this is why a hemisphere light is usually preferred. |
| 19 | +- A [hemisphere light](/gdevelop5/all-features/scene3d/reference/#effect-hemisphere-light) illuminates objects from every direction using a gradient between two colors. It is often combined with a directional light for more realistic lighting. |
18 | 20 |
|
19 | | -Light effects don't have a position in the scene, but you can change the direction of the light with 2 angles. Light effects can be set up through [layers effects](/gdevelop5/interface/scene-editor/layer-effects). |
| 21 | +Contrary to 3D light objects, light effects don't have a position in the scene, but their direction can be adjusted using two angles. |
20 | 22 |
|
21 | | -- [Directional light](/gdevelop5/all-features/scene3d/reference/#effect-directional-light) is a very far light source like the sun. It can cast shadows for 3D objects. When it's used alone, the part of the object in the darkness is pitch black. This is why it's often used along with a hemisphere light. |
22 | | -- [Ambient light](/gdevelop5/all-features/scene3d/reference/#effect-ambient-light) illuminates objects from every direction. It doesn't give any shade to the objects which tend to look flat. This is why the hemisphere light is usually preferred. |
23 | | -- [Hemisphere light](/gdevelop5/all-features/scene3d/reference/#effect-hemisphere-light) illuminates objects from every direction with a gradient of 2 colors. It is often used along with a directional light. |
| 23 | +## Avoiding shadow artifacts |
24 | 24 |
|
25 | | -## Avoid shadow artefacts |
| 25 | +When [3D model objects](/gdevelop5/objects/3d-model/) both cast and receive shadows, you may notice darkened patterns appearing on their surfaces. The **Shadow bias** property of lights can be used to prevent this issue, known as "shadow acne". Choose a value small enough to avoid creating a visible gap between shadows and objects (such as `0.001`), but not so small that it causes shadow glitches at low or medium quality settings. |
26 | 26 |
|
27 | | -When [3D model objects](/gdevelop5/objects/3d-model/) are both casting and receiving shadows, you might see some darkened patterns on them. The **Shadow bias** property of lights can be used to avoid this "shadow acne". Choose a value small enough like `0.001` to avoid creating distance between shadows and objects but not too small to avoid shadow glitches on low/medium quality. |
| 27 | +## Displaying more light objects |
28 | 28 |
|
29 | | -## Display more light objects |
30 | | - |
31 | | -Light objects can be heavy on the GPU especially when they cast shadows. In order to allow game creators to add many lights in the scene, the engine automatically hide lights the furthest away from the camera. By default, the limits are: |
| 29 | +Light objects can be demanding on the GPU, especially when they cast shadows. To allow game creators to add many lights to a scene, the engine automatically hides the lights farthest from the camera. By default, the limits are: |
32 | 30 |
|
33 | 31 | - 20 visible light objects |
34 | 32 | - 4 light objects casting shadows |
35 | 33 |
|
36 | | -These limits can be changed with **Max lights count** and **Max lights with shadow count** actions. Be aware that setting too high values can make games crash because of WebGL own limit. |
| 34 | +These limits can be adjusted using the **Max lights count** and **Max lights with shadow count** actions. Be aware that setting values too high can cause games to crash, as WebGL has its own internal limits. |
0 commit comments