Add Sponza depth of field benchmarks (#48)

This commit is contained in:
Francisco Demartino
2024-01-17 12:47:08 -03:00
committed by GitHub
parent ff141decc4
commit 22bea74605

View File

@@ -12,6 +12,8 @@ class TestScene extends Node3D:
var using_directional_light: bool
var using_omni_lights: bool
var using_dof: bool
var dof_bokeh_shape: RenderingServer.DOFBokehShape
func _init():
sponza = sponza_scene.instantiate()
@@ -25,9 +27,21 @@ class TestScene extends Node3D:
using_omni_lights = true
return self
func with_dof(shape: RenderingServer.DOFBokehShape):
using_dof = true
dof_bokeh_shape = shape
return self
func _ready():
$"Sponza/DirectionalLight3D".visible = using_directional_light
$"Sponza/OmniLights".visible = using_omni_lights
if using_dof:
var cam_attrs = CameraAttributesPractical.new()
cam_attrs.dof_blur_near_enabled = true
cam_attrs.dof_blur_far_enabled = true
$"Sponza/Camera3D".attributes = cam_attrs
RenderingServer.camera_attributes_set_dof_blur_bokeh_shape(dof_bokeh_shape)
func _process(delta):
pass
@@ -45,3 +59,11 @@ func benchmark_sponza_directional():
func benchmark_sponza_omni():
return TestScene.new().with_omni_lights()
func benchmark_sponza_dof_box():
return TestScene.new().with_dof(RenderingServer.DOF_BOKEH_BOX)
func benchmark_sponza_dof_hex():
return TestScene.new().with_dof(RenderingServer.DOF_BOKEH_HEXAGON)
func benchmark_sponza_dof_circle():
return TestScene.new().with_dof(RenderingServer.DOF_BOKEH_CIRCLE)