mirror of
https://github.com/johndoe6345789/SDL3CPlusPlus.git
synced 2026-04-24 21:55:09 +00:00
feat(render-graph): Add support for SDF, SSGI, DDGI, VXGI, motion blur, and depth of field in render graph
This commit is contained in:
@@ -881,6 +881,12 @@ function get_render_graph()
|
||||
local enable_shadows = resolve_boolean(atmospherics.enable_shadows, true)
|
||||
local enable_volumetrics = resolve_boolean(atmospherics.enable_volumetric_lighting, true)
|
||||
local enable_tonemap = resolve_boolean(atmospherics.enable_tone_mapping, true)
|
||||
local enable_sdf = resolve_boolean(rendering.enable_sdf, false)
|
||||
local enable_ssgi = resolve_boolean(rendering.enable_ssgi, false)
|
||||
local enable_ddgi = resolve_boolean(rendering.enable_ddgi, false)
|
||||
local enable_vxgi = resolve_boolean(rendering.enable_vxgi, false)
|
||||
local enable_depth_of_field = resolve_boolean(rendering.enable_depth_of_field, false)
|
||||
local enable_motion_blur = resolve_boolean(rendering.enable_motion_blur, false)
|
||||
local pipeline_mode = resolve_string(rendering.pipeline, "deferred")
|
||||
local use_forward_plus = pipeline_mode == "forward_plus"
|
||||
or pipeline_mode == "forward+"
|
||||
@@ -891,19 +897,50 @@ function get_render_graph()
|
||||
name = "shadow_csm",
|
||||
kind = "shadow_csm",
|
||||
output = "shadow_atlas",
|
||||
settings = {enabled = enable_shadows, cascades = 4, bias = 0.002, normal_bias = 0.02, pcf = 5},
|
||||
settings = {
|
||||
enabled = enable_shadows,
|
||||
cascades = 4,
|
||||
bias = 0.002,
|
||||
normal_bias = 0.02,
|
||||
pcf = 7,
|
||||
filter = "pcf",
|
||||
softness = 0.6,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "shadow_spot",
|
||||
kind = "shadow_spot",
|
||||
output = "shadow_atlas",
|
||||
settings = {enabled = enable_shadows, lights = 4, atlas_slice = 1, bias = 0.0015, pcf = 3},
|
||||
settings = {
|
||||
enabled = enable_shadows,
|
||||
lights = 4,
|
||||
atlas_slice = 1,
|
||||
bias = 0.0015,
|
||||
pcf = 5,
|
||||
filter = "pcf",
|
||||
softness = 0.5,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "shadow_point",
|
||||
kind = "shadow_point",
|
||||
output = "shadow_atlas",
|
||||
settings = {enabled = enable_shadows, lights = 2, atlas_slice = 2, bias = 0.002, pcf = 3},
|
||||
settings = {
|
||||
enabled = enable_shadows,
|
||||
lights = 2,
|
||||
atlas_slice = 2,
|
||||
bias = 0.002,
|
||||
pcf = 5,
|
||||
filter = "pcf",
|
||||
softness = 0.5,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "sdf_build",
|
||||
kind = "sdf_build",
|
||||
shader = "sdf_build",
|
||||
output = "sdf_atlas",
|
||||
settings = {enabled = enable_sdf, voxel_size = 0.15, max_distance = 8.0},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -923,9 +960,33 @@ function get_render_graph()
|
||||
kind = "fullscreen",
|
||||
shader = "ssao",
|
||||
inputs = {depth = "depth", normal = "normal_rough"},
|
||||
output = "ao",
|
||||
output = "ao_ssao",
|
||||
settings = {radius = 0.5, power = 1.3},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "sdf_ao",
|
||||
kind = "fullscreen",
|
||||
shader = "sdf_ao",
|
||||
inputs = {depth = "depth", normal = "normal_rough", sdf = "sdf_atlas"},
|
||||
output = "ao_sdf",
|
||||
settings = {enabled = enable_sdf, radius = 0.6, power = 1.1},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "ao_combine",
|
||||
kind = "fullscreen",
|
||||
shader = "ao_combine",
|
||||
inputs = {ssao = "ao_ssao", sdf = "ao_sdf"},
|
||||
output = "ao",
|
||||
settings = {sdf_enabled = enable_sdf, ssao_weight = 0.7, sdf_weight = 0.3},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "sdf_soft_shadows",
|
||||
kind = "fullscreen",
|
||||
shader = "sdf_soft_shadow",
|
||||
inputs = {depth = "depth", normal = "normal_rough", sdf = "sdf_atlas"},
|
||||
output = "shadow_soft",
|
||||
settings = {enabled = enable_sdf, softness = 0.6, max_distance = 6.0},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "forward_plus",
|
||||
kind = "forward_plus",
|
||||
@@ -935,9 +996,14 @@ function get_render_graph()
|
||||
normal = "normal_rough",
|
||||
ao = "ao",
|
||||
shadow = "shadow_atlas",
|
||||
shadow_soft = "shadow_soft",
|
||||
},
|
||||
output = "scene_hdr",
|
||||
settings = {clustered = true},
|
||||
settings = {
|
||||
clustered = true,
|
||||
key_light_color = {1.0, 0.94, 0.85},
|
||||
sky_color = {0.55, 0.68, 0.92},
|
||||
},
|
||||
})
|
||||
else
|
||||
table.insert(passes, {
|
||||
@@ -956,9 +1022,33 @@ function get_render_graph()
|
||||
kind = "fullscreen",
|
||||
shader = "ssao",
|
||||
inputs = {depth = "depth", normal = "normal_rough"},
|
||||
output = "ao",
|
||||
output = "ao_ssao",
|
||||
settings = {radius = 0.5, power = 1.3},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "sdf_ao",
|
||||
kind = "fullscreen",
|
||||
shader = "sdf_ao",
|
||||
inputs = {depth = "depth", normal = "normal_rough", sdf = "sdf_atlas"},
|
||||
output = "ao_sdf",
|
||||
settings = {enabled = enable_sdf, radius = 0.6, power = 1.1},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "ao_combine",
|
||||
kind = "fullscreen",
|
||||
shader = "ao_combine",
|
||||
inputs = {ssao = "ao_ssao", sdf = "ao_sdf"},
|
||||
output = "ao",
|
||||
settings = {sdf_enabled = enable_sdf, ssao_weight = 0.7, sdf_weight = 0.3},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "sdf_soft_shadows",
|
||||
kind = "fullscreen",
|
||||
shader = "sdf_soft_shadow",
|
||||
inputs = {depth = "depth", normal = "normal_rough", sdf = "sdf_atlas"},
|
||||
output = "shadow_soft",
|
||||
settings = {enabled = enable_sdf, softness = 0.6, max_distance = 6.0},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "lighting",
|
||||
kind = "lighting",
|
||||
@@ -969,11 +1059,53 @@ function get_render_graph()
|
||||
normal = "normal_rough",
|
||||
ao = "ao",
|
||||
shadow = "shadow_atlas",
|
||||
shadow_soft = "shadow_soft",
|
||||
},
|
||||
output = "scene_hdr",
|
||||
settings = {
|
||||
key_light_color = {1.0, 0.94, 0.85},
|
||||
sky_color = {0.55, 0.68, 0.92},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
table.insert(passes, {
|
||||
name = "ssgi",
|
||||
kind = "fullscreen",
|
||||
shader = "ssgi",
|
||||
inputs = {scene = "scene_hdr", depth = "depth", normal = "normal_rough"},
|
||||
output = "gi_ssgi",
|
||||
settings = {enabled = enable_ssgi, intensity = 0.35},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "ddgi_update",
|
||||
kind = "ddgi_update",
|
||||
shader = "ddgi_update",
|
||||
inputs = {depth = "depth", normal = "normal_rough"},
|
||||
output = "ddgi_volume",
|
||||
settings = {enabled = enable_ddgi, probes = {8, 4, 8}, rays = 96},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "vxgi_update",
|
||||
kind = "vxgi_update",
|
||||
shader = "vxgi_update",
|
||||
inputs = {depth = "depth", normal = "normal_rough"},
|
||||
output = "vxgi_volume",
|
||||
settings = {enabled = enable_vxgi, voxels = 96, steps = 32},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "gi_composite",
|
||||
kind = "fullscreen",
|
||||
shader = "gi_composite",
|
||||
inputs = {
|
||||
scene = "scene_hdr",
|
||||
ssgi = "gi_ssgi",
|
||||
ddgi = "ddgi_volume",
|
||||
vxgi = "vxgi_volume",
|
||||
},
|
||||
output = "scene_hdr",
|
||||
settings = {ssgi_weight = 0.6, ddgi_weight = 0.25, vxgi_weight = 0.15},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "ssr",
|
||||
kind = "fullscreen",
|
||||
@@ -983,18 +1115,23 @@ function get_render_graph()
|
||||
settings = {max_steps = 64, thickness = 0.1, roughness_fallback = 0.7},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "volumetric_fog",
|
||||
name = "volumetric_lighting",
|
||||
kind = "fullscreen",
|
||||
shader = "volumetric",
|
||||
inputs = {scene = "scene_hdr", depth = "depth", shadow = "shadow_atlas"},
|
||||
inputs = {scene = "scene_hdr", depth = "depth", shadow = "shadow_atlas", shadow_soft = "shadow_soft"},
|
||||
output = "scene_hdr",
|
||||
settings = {enabled = enable_volumetrics, density = fog_density * 8.0},
|
||||
settings = {
|
||||
enabled = enable_volumetrics,
|
||||
density = fog_density * 4.0,
|
||||
height_start = 0.0,
|
||||
height_falloff = 0.12,
|
||||
},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "transparent",
|
||||
kind = "transparent",
|
||||
shader = "transparent",
|
||||
inputs = {scene = "scene_hdr", depth = "depth", shadow = "shadow_atlas"},
|
||||
inputs = {scene = "scene_hdr", depth = "depth", shadow = "shadow_atlas", shadow_soft = "shadow_soft"},
|
||||
output = "scene_hdr",
|
||||
})
|
||||
table.insert(passes, {
|
||||
@@ -1004,12 +1141,28 @@ function get_render_graph()
|
||||
output = "scene_hdr",
|
||||
settings = {feedback = 0.9, sharpen = 0.2},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "motion_blur",
|
||||
kind = "fullscreen",
|
||||
shader = "motion_blur",
|
||||
inputs = {scene = "scene_hdr", motion = "motion", depth = "depth"},
|
||||
output = "post_motion",
|
||||
settings = {enabled = enable_motion_blur, strength = 0.15, max_blur = 0.02},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "depth_of_field",
|
||||
kind = "fullscreen",
|
||||
shader = "depth_of_field",
|
||||
inputs = {scene = "post_motion", depth = "depth"},
|
||||
output = "scene_hdr",
|
||||
settings = {enabled = enable_depth_of_field, focus_distance = 6.0, focus_range = 3.5, max_blur = 0.015},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "bloom",
|
||||
kind = "bloom",
|
||||
input = "scene_hdr",
|
||||
output = "bloom",
|
||||
settings = {threshold = 1.0, intensity = 0.7},
|
||||
settings = {threshold = 1.2, soft_knee = 0.6, intensity = 0.35},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "color_grade",
|
||||
@@ -1025,7 +1178,13 @@ function get_render_graph()
|
||||
shader = "tonemap",
|
||||
input = "scene_hdr",
|
||||
output = "swapchain",
|
||||
settings = {enabled = enable_tonemap, exposure = exposure, gamma = gamma, curve = "aces"},
|
||||
settings = {
|
||||
enabled = enable_tonemap,
|
||||
exposure = exposure,
|
||||
gamma = gamma,
|
||||
curve = "aces",
|
||||
highlight_rolloff = 0.85,
|
||||
},
|
||||
})
|
||||
table.insert(passes, {
|
||||
name = "ui_composite",
|
||||
@@ -1042,8 +1201,16 @@ function get_render_graph()
|
||||
motion = {type = "color", format = "rg16f", size = "swapchain"},
|
||||
gbuffer_albedo = {type = "color", format = "rgba8", size = "swapchain"},
|
||||
shadow_atlas = {type = "depth_array", format = "d32", size = {4096, 4096}, layers = 8},
|
||||
sdf_atlas = {type = "color", format = "r16f", size = "half", layers = 16},
|
||||
shadow_soft = {type = "color", format = "r8", size = "half"},
|
||||
ao_ssao = {type = "color", format = "r8", size = "half"},
|
||||
ao_sdf = {type = "color", format = "r8", size = "half"},
|
||||
ao = {type = "color", format = "r8", size = "half"},
|
||||
gi_ssgi = {type = "color", format = "rgba16f", size = "half"},
|
||||
ddgi_volume = {type = "color", format = "rgba16f", size = {64, 64}, layers = 16},
|
||||
vxgi_volume = {type = "color", format = "rgba16f", size = {96, 96}, layers = 16},
|
||||
taa_history = {type = "color", format = "rgba16f", size = "swapchain"},
|
||||
post_motion = {type = "color", format = "rgba16f", size = "swapchain"},
|
||||
bloom = {type = "color", format = "rgba16f", size = "half", mips = 5},
|
||||
},
|
||||
passes = passes,
|
||||
|
||||
Reference in New Issue
Block a user