Skip to content

Commit 31b962a

Browse files
committed
Add a global illumination demo
Port of the 3.x global illumination demo, with SDFGI support added and screen-space lighting effect options added (SSAO, SSIL, or both). Lightmap options were removed as I couldn't get both indirect-only and fully baked lightmaps to work for now. They can be readded in the future.
1 parent aeba3a0 commit 31b962a

20 files changed

+249
-2351
lines changed

3d/global_illumination/README.md

+3-25
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,21 @@
11
# Global Illumination
22

33
This demo showcases Godot's global illumination systems:
4-
[GIProbe](https://docs.godotengine.org/en/stable/tutorials/3d/gi_probes.html),
5-
[BakedLightmap](https://docs.godotengine.org/en/stable/tutorials/3d/baked_lightmaps.html)
6-
(indirect only and fully baked) and
7-
[ReflectionProbe](https://docs.godotengine.org/en/stable/tutorials/3d/reflection_probes.html).
4+
VoxelGI, SDFGI, ReflectionProbe and screen-space effects like SSAO and SSIL.
85

96
Use the mouse to look around, <kbd>W</kbd>/<kbd>A</kbd>/<kbd>S</kbd>/<kbd>D</kbd>
107
or arrow keys to move.
118

129
Language: GDScript
1310

14-
Renderer: GLES 3[^1]
15-
16-
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/1290
11+
Renderer: Vulkan
1712

1813
## How does it work?
1914

20-
A glTF scene (which acts as the level mesh) is imported with its **Light Baking**
21-
option set to **Gen Lightmaps**.
22-
This is required for BakedLightmap to work (but is not required for GIProbe
23-
or BakedLightmap).
24-
25-
The level mesh is duplicated several times to allow displaying it with various bake settings:
26-
27-
- No baking (uses GIProbe or environment lighting).
28-
- Baked indirect lighting. Slower, but allows for real-time shadows to display
29-
on baked surfaces.
30-
- Baked direct *and* indirect lighting. Faster, but does not allow for real-time
31-
shadows to display on baked surfaces.
32-
3315
A sphere and box are parented to the camera to showcase dynamic object lighting.
3416
A ReflectionProbe is parented to the sphere to showcase real-time reflections.
3517
When the ReflectionProbe is hidden, it is disabled. In this case,
36-
GIProbe or environment lighting will be used to provide fallback reflections.
18+
VoxelGI, SDFGI or environment lighting will be used to provide fallback reflections.
3719

3820
## Screenshots
3921

@@ -45,7 +27,3 @@ GIProbe or environment lighting will be used to provide fallback reflections.
4527
map "zdm2" and is
4628
[licensed under CC BY 4.0 Unported](https://github.com/Calinou/game-maps-obj/blob/master/sauerbraten/zdm2.txt).
4729
The OBJ file which it was converted from is available in the [game-maps-obj](https://github.com/Calinou/game-maps-obj) repository.
48-
49-
[^1]: This demo can be made to work with GLES2, but GIProbe will not work.
50-
Additionally, lightmaps have to be rebaked with the **Atlas > Generate** property
51-
disabled in BakedLightmap.

3d/global_illumination/camera.gd

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func _input(event):
1818
rot.y -= event.relative.x * MOUSE_SENSITIVITY
1919
# Vertical mouse look.
2020
rot.x = clamp(rot.x - event.relative.y * MOUSE_SENSITIVITY, -1.57, 1.57)
21-
transform.basis = Basis(rot)
21+
transform.basis = Basis.from_euler(rot)
2222

2323
if event.is_action_pressed("toggle_mouse_capture"):
2424
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
@@ -29,9 +29,9 @@ func _input(event):
2929

3030
func _process(delta):
3131
var motion = Vector3(
32-
Input.get_axis(&"move_left", &"move_right"),
32+
Input.get_action_strength("move_right") - Input.get_action_strength("move_left"),
3333
0,
34-
Input.get_axis(&"move_forward", &"move_back")
34+
Input.get_action_strength("move_back") - Input.get_action_strength("move_forward")
3535
)
3636

3737
# Normalize motion to prevent diagonal movement from being

0 commit comments

Comments
 (0)