-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cull and lightmap probe influence benchmarks (#74)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
- Loading branch information
1 parent
f1ee9eb
commit 23461ea
Showing
2 changed files
with
165 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
extends Benchmark | ||
|
||
const NUMBER_OF_OBJECTS := 1000 | ||
const NUMBER_OF_PROBES := 500 | ||
|
||
|
||
func _init() -> void: | ||
test_render_cpu = true | ||
test_render_gpu = true | ||
|
||
|
||
class TestScene: | ||
extends Node3D | ||
|
||
var sponza_scene := preload("res://supplemental/sponza.tscn") | ||
var sponza: Node | ||
var time_accum := 0.0 | ||
var objects: Array[MeshInstance3D] | ||
|
||
func _init() -> void: | ||
sponza = sponza_scene.instantiate() | ||
add_child(sponza) | ||
|
||
func _ready() -> void: | ||
$"Sponza/OmniLights".visible = false | ||
var lightmap := LightmapGI.new() | ||
lightmap.light_data = load("res://supplemental/sponza.lmbake") | ||
$Sponza.add_child(lightmap) | ||
|
||
var meshes: Array[PrimitiveMesh] = [ | ||
BoxMesh.new(), | ||
SphereMesh.new(), | ||
CapsuleMesh.new(), | ||
CylinderMesh.new(), | ||
PrismMesh.new(), | ||
] | ||
var half_objects := NUMBER_OF_OBJECTS / 2 | ||
for i in NUMBER_OF_OBJECTS: | ||
var ins := MeshInstance3D.new() | ||
ins.gi_mode = GeometryInstance3D.GI_MODE_DYNAMIC | ||
ins.mesh = meshes[i % meshes.size()] | ||
ins.position.y = 1 | ||
ins.position.z = i - half_objects | ||
$Sponza.add_child(ins) | ||
objects.append(ins) | ||
|
||
func _process(delta: float) -> void: | ||
time_accum += delta * 2.0 | ||
for i in objects.size(): | ||
objects[i].position.x = sin(time_accum) * 6.0 | ||
|
||
func _exit_tree() -> void: | ||
RenderingServer.free_rid(sponza) | ||
|
||
|
||
func benchmark_lightmap_probe_influence() -> TestScene: | ||
return TestScene.new() |