SSGI depth rejection slider
This commit is contained in:
+35
-18
@@ -940,22 +940,6 @@ void GraphicsWindow::Create(EditorComponent* _editor)
|
||||
AddWidget(&raytracedDiffuseCheckBox);
|
||||
raytracedDiffuseCheckBox.SetEnabled(wi::graphics::GetDevice()->CheckCapability(GraphicsDeviceCapability::RAYTRACING));
|
||||
|
||||
ssgiCheckBox.Create("SSGI: ");
|
||||
ssgiCheckBox.SetTooltip("Enable Screen Space Global Illumination, this can add a light bounce effect coming from objects on the screen.");
|
||||
ssgiCheckBox.SetScriptTip("RenderPath3D::SetSSGIEnabled(bool value)");
|
||||
ssgiCheckBox.SetSize(XMFLOAT2(hei, hei));
|
||||
ssgiCheckBox.SetPos(XMFLOAT2(x + 140, y));
|
||||
if (editor->main->config.GetSection("graphics").Has("ssgi"))
|
||||
{
|
||||
editor->renderPath->setSSGIEnabled(editor->main->config.GetSection("graphics").GetBool("ssgi"));
|
||||
}
|
||||
ssgiCheckBox.OnClick([=](wi::gui::EventArgs args) {
|
||||
editor->renderPath->setSSGIEnabled(args.bValue);
|
||||
editor->main->config.GetSection("graphics").Set("ssgi", args.bValue);
|
||||
editor->main->config.Commit();
|
||||
});
|
||||
AddWidget(&ssgiCheckBox);
|
||||
|
||||
raytracedDiffuseRangeSlider.Create(1.0f, 100.0f, 1, 1000, "RTDiffuse.Range: ");
|
||||
raytracedDiffuseRangeSlider.SetText("Range: ");
|
||||
raytracedDiffuseRangeSlider.SetTooltip("Set Reflection ray length for Ray traced diffuse.");
|
||||
@@ -973,6 +957,38 @@ void GraphicsWindow::Create(EditorComponent* _editor)
|
||||
AddWidget(&raytracedDiffuseRangeSlider);
|
||||
raytracedDiffuseRangeSlider.SetEnabled(wi::graphics::GetDevice()->CheckCapability(GraphicsDeviceCapability::RAYTRACING));
|
||||
|
||||
ssgiCheckBox.Create("SSGI: ");
|
||||
ssgiCheckBox.SetTooltip("Enable Screen Space Global Illumination, this can add a light bounce effect coming from objects on the screen.");
|
||||
ssgiCheckBox.SetScriptTip("RenderPath3D::SetSSGIEnabled(bool value)");
|
||||
ssgiCheckBox.SetSize(XMFLOAT2(hei, hei));
|
||||
ssgiCheckBox.SetPos(XMFLOAT2(x + 140, y));
|
||||
if (editor->main->config.GetSection("graphics").Has("ssgi"))
|
||||
{
|
||||
editor->renderPath->setSSGIEnabled(editor->main->config.GetSection("graphics").GetBool("ssgi"));
|
||||
}
|
||||
ssgiCheckBox.OnClick([=](wi::gui::EventArgs args) {
|
||||
editor->renderPath->setSSGIEnabled(args.bValue);
|
||||
editor->main->config.GetSection("graphics").Set("ssgi", args.bValue);
|
||||
editor->main->config.Commit();
|
||||
});
|
||||
AddWidget(&ssgiCheckBox);
|
||||
|
||||
ssgiDepthRejectionSlider.Create(0.1f, 100.0f, 8, 1000, "SSGI.DepthRejection");
|
||||
ssgiDepthRejectionSlider.SetText("Depth: ");
|
||||
ssgiDepthRejectionSlider.SetTooltip("SSGI depth rejection distance.");
|
||||
ssgiDepthRejectionSlider.SetSize(XMFLOAT2(mod_wid, hei));
|
||||
ssgiDepthRejectionSlider.SetPos(XMFLOAT2(x + 100, y));
|
||||
if (editor->main->config.GetSection("graphics").Has("ssgi_depthrejection"))
|
||||
{
|
||||
editor->renderPath->setSSGIDepthRejection(editor->main->config.GetSection("graphics").GetFloat("ssgi_depthrejection"));
|
||||
}
|
||||
ssgiDepthRejectionSlider.OnSlide([=](wi::gui::EventArgs args) {
|
||||
editor->renderPath->setSSGIDepthRejection(args.fValue);
|
||||
editor->main->config.GetSection("graphics").Set("ssgi_depthrejection", args.fValue);
|
||||
editor->main->config.Commit();
|
||||
});
|
||||
AddWidget(&ssgiDepthRejectionSlider);
|
||||
|
||||
screenSpaceShadowsCheckBox.Create("Screen Shadows: ");
|
||||
screenSpaceShadowsCheckBox.SetTooltip("Enable screen space contact shadows. This can add small shadows details to shadow maps in screen space.");
|
||||
screenSpaceShadowsCheckBox.SetSize(XMFLOAT2(hei, hei));
|
||||
@@ -1545,6 +1561,7 @@ void GraphicsWindow::Update()
|
||||
raytracedDiffuseRangeSlider.SetValue(editor->renderPath->getRaytracedDiffuseRange());
|
||||
screenSpaceShadowsCheckBox.SetCheck(wi::renderer::GetScreenSpaceShadowsEnabled());
|
||||
screenSpaceShadowsRangeSlider.SetValue((float)editor->renderPath->getScreenSpaceShadowRange());
|
||||
ssgiDepthRejectionSlider.SetValue((float)editor->renderPath->getSSGIDepthRejection());
|
||||
screenSpaceShadowsStepCountSlider.SetValue((float)editor->renderPath->getScreenSpaceShadowSampleCount());
|
||||
eyeAdaptionCheckBox.SetCheck(editor->renderPath->getEyeAdaptionEnabled());
|
||||
eyeAdaptionKeySlider.SetValue(editor->renderPath->getEyeAdaptionKey());
|
||||
@@ -1804,8 +1821,8 @@ void GraphicsWindow::ResizeLayout()
|
||||
ssrCheckBox.SetPos(XMFLOAT2(reflectionsRoughnessCutoffSlider.GetPos().x - ssrCheckBox.GetSize().x - 80, reflectionsRoughnessCutoffSlider.GetPos().y));
|
||||
add_right(raytracedReflectionsRangeSlider);
|
||||
raytracedReflectionsCheckBox.SetPos(XMFLOAT2(raytracedReflectionsRangeSlider.GetPos().x - raytracedReflectionsCheckBox.GetSize().x - 80, raytracedReflectionsRangeSlider.GetPos().y));
|
||||
add_right(ssgiCheckBox);
|
||||
ssgiCheckBox.SetPos(XMFLOAT2(raytracedReflectionsCheckBox.GetPos().x, ssgiCheckBox.GetPos().y));
|
||||
add_right(ssgiDepthRejectionSlider);
|
||||
ssgiCheckBox.SetPos(XMFLOAT2(ssgiDepthRejectionSlider.GetPos().x - ssgiCheckBox.GetSize().x - 80, ssgiDepthRejectionSlider.GetPos().y));
|
||||
add_right(raytracedDiffuseRangeSlider);
|
||||
raytracedDiffuseCheckBox.SetPos(XMFLOAT2(raytracedDiffuseRangeSlider.GetPos().x - raytracedDiffuseCheckBox.GetSize().x - 80, raytracedDiffuseRangeSlider.GetPos().y));
|
||||
add_right(screenSpaceShadowsStepCountSlider);
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
wi::gui::CheckBox raytracedDiffuseCheckBox;
|
||||
wi::gui::Slider raytracedDiffuseRangeSlider;
|
||||
wi::gui::CheckBox ssgiCheckBox;
|
||||
wi::gui::Slider ssgiDepthRejectionSlider;
|
||||
wi::gui::CheckBox screenSpaceShadowsCheckBox;
|
||||
wi::gui::Slider screenSpaceShadowsStepCountSlider;
|
||||
wi::gui::Slider screenSpaceShadowsRangeSlider;
|
||||
|
||||
@@ -28,9 +28,6 @@ inline uint coord_to_cache(int2 coord)
|
||||
return flatten2D(clamp(coord, 0, TILE_SIZE - 1), TILE_SIZE);
|
||||
}
|
||||
|
||||
static const float depthRejection = 8;
|
||||
static const float depthRejection_rcp = rcp(depthRejection);
|
||||
|
||||
float3 compute_diffuse(
|
||||
float3 origin_position,
|
||||
float3 origin_normal,
|
||||
@@ -46,8 +43,8 @@ float3 compute_diffuse(
|
||||
sample_position.z = cache_z[t];
|
||||
sample_position.xy = unpack_half2(cache_xy[t]);
|
||||
const float3 origin_to_sample = sample_position - origin_position;
|
||||
float occlusion = saturate(dot(origin_normal, origin_to_sample)); // normal falloff
|
||||
occlusion *= saturate(1 + origin_to_sample.z * depthRejection_rcp); // depth falloff
|
||||
float occlusion = saturate(dot(origin_normal, origin_to_sample)); // normal falloff
|
||||
occlusion *= saturate(1 + origin_to_sample.z * postprocess.params0.w); // depth rejection
|
||||
|
||||
if(occlusion > 0)
|
||||
{
|
||||
|
||||
@@ -1749,7 +1749,8 @@ namespace wi
|
||||
depthBuffer_Copy,
|
||||
visibilityResources.texture_normals,
|
||||
rtSSGI,
|
||||
cmd
|
||||
cmd,
|
||||
getSSGIDepthRejection()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace wi
|
||||
float raytracedDiffuseRange = 10;
|
||||
float raytracedReflectionsRange = 10000.0f;
|
||||
float reflectionRoughnessCutoff = 0.6f;
|
||||
float ssgiDepthRejection = 8;
|
||||
wi::renderer::Tonemap tonemap = wi::renderer::Tonemap::ACES;
|
||||
|
||||
AO ao = AO_DISABLED;
|
||||
@@ -235,6 +236,7 @@ namespace wi
|
||||
constexpr float getRaytracedDiffuseRange() const { return raytracedDiffuseRange; }
|
||||
constexpr float getRaytracedReflectionsRange() const { return raytracedReflectionsRange; }
|
||||
constexpr float getReflectionRoughnessCutoff() const { return reflectionRoughnessCutoff; }
|
||||
constexpr float getSSGIDepthRejection() const { return ssgiDepthRejection; }
|
||||
constexpr wi::renderer::Tonemap getTonemap() const { return tonemap; }
|
||||
|
||||
constexpr bool getAOEnabled() const { return ao != AO_DISABLED; }
|
||||
@@ -290,6 +292,7 @@ namespace wi
|
||||
constexpr void setRaytracedDiffuseRange(float value) { raytracedDiffuseRange = value; }
|
||||
constexpr void setRaytracedReflectionsRange(float value) { raytracedReflectionsRange = value; }
|
||||
constexpr void setReflectionRoughnessCutoff(float value) { reflectionRoughnessCutoff = value; }
|
||||
constexpr void setSSGIDepthRejection(float value) { ssgiDepthRejection = value; }
|
||||
constexpr void setTonemap(wi::renderer::Tonemap value) { tonemap = value; }
|
||||
|
||||
void setAO(AO value);
|
||||
|
||||
@@ -12506,7 +12506,8 @@ void Postprocess_SSGI(
|
||||
const Texture& input_depth,
|
||||
const Texture& input_normal,
|
||||
const Texture& output,
|
||||
CommandList cmd
|
||||
CommandList cmd,
|
||||
float depthRejection
|
||||
)
|
||||
{
|
||||
device->EventBegin("Postprocess_SSGI", cmd);
|
||||
@@ -12596,6 +12597,8 @@ void Postprocess_SSGI(
|
||||
{
|
||||
device->EventBegin("SSGI - diffuse", cmd);
|
||||
|
||||
postprocess.params0.w = 1.0f / depthRejection;
|
||||
|
||||
// Wide sampling passes:
|
||||
device->BindComputeShader(&shaders[CSTYPE_POSTPROCESS_SSGI_WIDE], cmd);
|
||||
|
||||
|
||||
@@ -568,7 +568,8 @@ namespace wi::renderer
|
||||
const wi::graphics::Texture& input_depth,
|
||||
const wi::graphics::Texture& input_normal,
|
||||
const wi::graphics::Texture& output,
|
||||
wi::graphics::CommandList cmd
|
||||
wi::graphics::CommandList cmd,
|
||||
float depthRejection = 8
|
||||
);
|
||||
struct RTReflectionResources
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wi::version
|
||||
// minor features, major updates, breaking compatibility changes
|
||||
const int minor = 71;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 419;
|
||||
const int revision = 420;
|
||||
|
||||
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ Humanoid rig
|
||||
Animation retargeting
|
||||
Video decoding: H264
|
||||
3D path finding
|
||||
Screen Space Global Illumination (SSGI)
|
||||
|
||||
GLTF 2.0 - KHR extensions supported:
|
||||
KHR_materials_unlit
|
||||
|
||||
Reference in New Issue
Block a user