Skip to content

Commit

Permalink
[gi] improved quality
Browse files Browse the repository at this point in the history
  • Loading branch information
PanosK92 committed Jan 17, 2025
1 parent fcd5c9b commit 5ed8c5f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
9 changes: 4 additions & 5 deletions runtime/RHI/Vulkan/Vulkan_FidelityFX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,6 @@ namespace spartan
const uint32_t cascade_offset = 16; // 0 - 8 is for static, 8 - 16 is for dynamic, 16 - 24 is for static + dynamic (merged)
const uint32_t cascade_index_start = cascade_offset + 0;
const uint32_t cascade_index_end = cascade_offset + cascade_count - 1;
const uint32_t cascade_resolution = 64;
const bool sdf_center_around_camera = true;
const float sdf_ray_normal_offset = 0.5f; // distance from a surface along the normal vector to offset the ray origin - below 0.5 I see artifacts
const float sdf_ray_epsilon = 0.5f; // epsilon value for ray marching to be used with brixelizer for rays
Expand Down Expand Up @@ -1376,8 +1375,8 @@ namespace spartan
set_ffx_float16(brixelizer_gi::description_dispatch_gi.prevProjection, projection_previous);

// set resources
brixelizer_gi::description_dispatch_gi.environmentMap = to_ffx_resource(texture_skybox.get(), L"brixelizer_gi__environment");
brixelizer_gi::description_dispatch_gi.prevLitOutput = to_ffx_resource(tex_frame, L"brixelizer_gi_lit_output_previous");
brixelizer_gi::description_dispatch_gi.environmentMap = to_ffx_resource(texture_skybox.get(), L"brixelizer_gi_environment");
brixelizer_gi::description_dispatch_gi.prevLitOutput = to_ffx_resource(tex_frame, L"brixelizer_gi_lit_output_previous"); // linear
brixelizer_gi::description_dispatch_gi.depth = to_ffx_resource(tex_depth, L"brixelizer_gi_depth");
brixelizer_gi::description_dispatch_gi.historyDepth = to_ffx_resource(brixelizer_gi::texture_depth_previous.get(), L"brixelizer_gi_depth_previous");
brixelizer_gi::description_dispatch_gi.normal = to_ffx_resource(tex_normal, L"brixelizer_gi_normal");
Expand Down Expand Up @@ -1406,9 +1405,9 @@ namespace spartan
brixelizer_gi::description_dispatch_gi.tMax = brixelizer_gi::t_max;
brixelizer_gi::description_dispatch_gi.normalsUnpackMul = 1.0f;
brixelizer_gi::description_dispatch_gi.normalsUnpackAdd = 0.0f;
brixelizer_gi::description_dispatch_gi.isRoughnessPerceptual = true; // if false, we assume roughness squared was stored in the Gbuffer
brixelizer_gi::description_dispatch_gi.isRoughnessPerceptual = true; // false for squared g-buffer roughness
brixelizer_gi::description_dispatch_gi.roughnessChannel = 0; // the channel to read the roughness from the roughness texture
brixelizer_gi::description_dispatch_gi.roughnessThreshold = 1.0f; // regions with a roughness value greater than this threshold won't spawn specular rays
brixelizer_gi::description_dispatch_gi.roughnessThreshold = 0.8f; // regions with a roughness value greater than this threshold won't spawn specular rays
brixelizer_gi::description_dispatch_gi.environmentMapIntensity = 0.0f; // value to scale the contribution from the environment map
brixelizer_gi::description_dispatch_gi.motionVectorScale.x = -1.0f;
brixelizer_gi::description_dispatch_gi.motionVectorScale.y = -1.0f;
Expand Down
1 change: 1 addition & 0 deletions runtime/Rendering/Renderer_Definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ namespace spartan
light_shadow,
light_volumetric,
frame_render,
frame_render_pre_post_process,
frame_output,
frame_output_2,
ssao,
Expand Down
4 changes: 3 additions & 1 deletion runtime/Rendering/Renderer_Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,8 @@ namespace spartan
Pass_Light_GlobalIllumination(cmd_list_graphics); // compute global illumination
Pass_Light_Composition(cmd_list_graphics, is_transparent); // compose all light (diffuse, specular, etc.)
Pass_Light_ImageBased(cmd_list_graphics, is_transparent); // apply IBL (skysphere, ssr, global illumination etc.)

cmd_list_graphics->Blit(rt_render, GetRenderTarget(Renderer_RenderTarget::frame_render_pre_post_process), false);
}

// upscale to output resolution
Expand Down Expand Up @@ -1210,7 +1212,7 @@ namespace spartan
RHI_FidelityFX::BrixelizerGI_Dispatch(
cmd_list,
&m_cb_frame_cpu,
GetRenderTarget(Renderer_RenderTarget::frame_output), // previous lit output
GetRenderTarget(Renderer_RenderTarget::frame_render_pre_post_process),
GetRenderTarget(Renderer_RenderTarget::gbuffer_depth),
GetRenderTarget(Renderer_RenderTarget::gbuffer_velocity),
GetRenderTarget(Renderer_RenderTarget::gbuffer_normal),
Expand Down
1 change: 1 addition & 0 deletions runtime/Rendering/Renderer_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ namespace spartan
{
// frame
render_target(Renderer_RenderTarget::frame_render) = make_shared<RHI_Texture>(RHI_Texture_Type::Type2D, width_render, height_render, 1, 1, RHI_Format::R16G16B16A16_Float, flags_rt_clearable, "frame_render");
render_target(Renderer_RenderTarget::frame_render_pre_post_process) = make_shared<RHI_Texture>(RHI_Texture_Type::Type2D, width_render, height_render, 1, 1, RHI_Format::R16G16B16A16_Float, flags_rt_clearable, "frame_render_pre_post_process");

// g-buffer
{
Expand Down

0 comments on commit 5ed8c5f

Please sign in to comment.