Skip to content

Commit f0ad39a

Browse files
committed
Merge branch 'dev/adunn/weighted_blended_oit' into 'main'
Weighted Blended OIT See merge request lightspeedrtx/dxvk-remix-nv!1657
2 parents 9b21813 + 230d7db commit f0ad39a

19 files changed

+1060
-192
lines changed

RtxOptions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,9 @@ Tables below enumerate all the options and their defaults set by RTX Remix. Note
878878
|rtx.volumetrics.transmittanceColor|float3|0.999, 0.999, 0.999|||The color to use for calculating transmittance measured at a specific distance\.<br>Note that this color is assumed to be in sRGB space and gamma encoded as it will be converted to linear for use in volumetrics\.|
879879
|rtx.volumetrics.transmittanceMeasurementDistanceMeters|float|200|||The distance the specified transmittance color was measured at\. Lower distances indicate a denser medium\. The unit of measurement is meters, respects scene scale\.|
880880
|rtx.volumetrics.visibilityReuse|bool|True|||Determines whether to reuse visibility ray samples spatially across the reservoir\.<br>Results in slightly less noise with the volumetric froxel grid light samples at the cost of a ray per froxel cell each frame and should generally be enabled\.|
881+
|rtx.wboitDepthWeightTuning|float|2|||Allows for tuning the weighted blended OIT depth weight \- which can be used to fine tune blending for various circumstances\. This control has a side effect, larger numbers here can adversely affect brightness of emissive blended materials\.|
882+
|rtx.wboitEnabled|bool|True|||Enables the new rendering mode for handling alpha blended objects\. Changing this will trigger a shader recompile\. The new mode improves rendering accuracy, especially in cases where there are many layers of transparent things being rendered\.|
883+
|rtx.wboitEnergyLossCompensation|float|4|||Multiplier for the coverage term in the weighted blended OIT imlementation \- allows for some configuration to recover energy loss from the technique\. This is non physical, be careful overtuning |
881884
|rtx.worldSpaceUiBackgroundOffset|float|-0.01|||Distance along normal to offset objects rendered as worldspace UI, specifically for the background of screens\.|
882885
|rtx.zUp|bool|False|||Indicates that the Z axis is the "upward" axis in the world when true, otherwise the Y axis when false\.|
883886

src/dxvk/imgui/dxvk_imgui.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3366,7 +3366,14 @@ namespace dxvk {
33663366

33673367
ImGui::Separator();
33683368
ImGui::SliderFloat("Particle Softness", &RtxOptions::particleSoftnessFactorObject(), 0.f, 0.5f);
3369-
3369+
ImGui::Separator();
3370+
if (ImGui::CollapsingHeader("Weighted Blended OIT", collapsingHeaderClosedFlags)) {
3371+
ImGui::Checkbox("Enable", &RtxOptions::wboitEnabledObject());
3372+
ImGui::BeginDisabled(!RtxOptions::wboitEnabled());
3373+
ImGui::SliderFloat("Energy Compensation", &RtxOptions::wboitEnergyLossCompensationObject(), 1.f, 10.f);
3374+
ImGui::SliderFloat("Depth Weight Tuning", &RtxOptions::wboitDepthWeightTuningObject(), 0.01f, 10.f);
3375+
ImGui::EndDisabled();
3376+
}
33703377
common->metaComposite().showStochasticAlphaBlendImguiSettings();
33713378
ImGui::Unindent();
33723379
}

src/dxvk/rtx_render/rtx_context.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,10 @@ namespace dxvk {
12411241

12421242
constants.primaryDirectMissLinearViewZ = primaryDirectNrdArgs.missLinearViewZ;
12431243

1244+
constants.wboitEnergyLossCompensation = RtxOptions::wboitEnergyLossCompensation();
1245+
constants.wboitDepthWeightTuning = RtxOptions::wboitDepthWeightTuning();
1246+
constants.wboitEnabled = RtxOptions::wboitEnabled();
1247+
12441248
// Upload the constants to the GPU
12451249
{
12461250
Rc<DxvkBuffer> cb = getResourceManager().getConstantsBuffer();

src/dxvk/rtx_render/rtx_options.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,9 @@ namespace dxvk {
784784
"When an object is added to the cutout textures list it will have a cutout alpha mode forced on it, using this value for the alpha test.\n"
785785
"This is meant to improve the look of some legacy mode materials using low-resolution textures and alpha blending instead of alpha cutout as this can cause blurry halos around edges due to the difficulty of handling this sort of blending in Remix.\n"
786786
"Such objects are generally better handled with actual replacement assets using fully opaque geometry replacements or alpha cutout with higher resolution textures, so this should only be relied on until proper replacements can be authored.");
787+
RTX_OPTION("rtx", float, wboitEnergyLossCompensation, 4.f, "Multiplier for the coverage term in the weighted blended OIT imlementation - allows for some configuration to recover energy loss from the technique. This is non physical, be careful overtuning ");
788+
RTX_OPTION("rtx", float, wboitDepthWeightTuning, 2.f, "Allows for tuning the weighted blended OIT depth weight - which can be used to fine tune blending for various circumstances. This control has a side effect, larger numbers here can adversely affect brightness of emissive blended materials.");
789+
RTX_OPTION("rtx", bool, wboitEnabled, true, "Enables the new rendering mode for handling alpha blended objects. Changing this will trigger a shader recompile. The new mode improves rendering accuracy, especially in cases where there are many layers of transparent things being rendered.");
787790

788791
// Ray Portal Options
789792
// Note: Not a set as the ordering of the hashes is important. Keep this list small to avoid expensive O(n) searching (should only have 2 or 4 elements usually).

0 commit comments

Comments
 (0)