Skip to content

Commit a11bd46

Browse files
committed
Merge branch 'bloom-radius-option' into 'main'
[REMIX-4427] Add an option to control a blooming radius See merge request lightspeedrtx/dxvk-remix-nv!1603
2 parents fcbff76 + 65dcff7 commit a11bd46

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

RtxOptions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ Tables below enumerate all the options and their defaults set by RTX Remix. Note
9595
|rtx.bloom.burnIntensity|float|1|||Amount of bloom to add to the final image\.|
9696
|rtx.bloom.enable|bool|True|||Enable bloom \- glowing halos around intense, bright areas\.|
9797
|rtx.bloom.luminanceThreshold|float|0.25|||Adjust the bloom threshold to suppress blooming of the dim areas\. Pixels with luminance lower than the threshold are multiplied by the weight value that smoothly transitions from 1\.0 \(at luminance=threshold\) to 0\.0 \(at luminance=0\)\.|
98+
|rtx.bloom.steps|int|5|1|8|Number of downsampling steps to perform \[1\.\.8\]\. A higher value produces a wider blooming radius\.|
9899
|rtx.calculateLightIntensityUsingLeastSquares|bool|True|||Enable usage of least squares for approximating a light's falloff curve rather than a more basic single point approach\. This will generally result in more accurate matching of the original application's custom light attenuation curves, especially with non physically based linear\-style attenuation\.|
99100
|rtx.camera.enableFreeCamera|bool|False|||Enables free camera\.|
100101
|rtx.camera.freeCameraPitch|float|0|||Free camera's pitch\.|

src/dxvk/rtx_render/rtx_bloom.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ namespace dxvk {
8989
ImGui::Indent();
9090
ImGui::DragFloat("Intensity##bloom", &burnIntensityObject(), 0.05f, 0.f, 5.f, "%.2f");
9191
ImGui::DragFloat("Threshold##bloom", &luminanceThresholdObject(), 0.05f, 0.f, 100.f, "%.2f");
92+
ImGui::SliderInt("Radius##bloom", &stepsObject(), 4, MaxBloomSteps);
9293
ImGui::Unindent();
9394
ImGui::Unindent();
9495
}
@@ -108,14 +109,19 @@ namespace dxvk {
108109
&m_bloomBuffer[2],
109110
&m_bloomBuffer[3],
110111
&m_bloomBuffer[4],
112+
&m_bloomBuffer[5],
113+
&m_bloomBuffer[6],
114+
&m_bloomBuffer[7],
111115
};
112-
assert(std::size(m_bloomBuffer) == std::size(res) - 1);
116+
static_assert(MaxBloomSteps == std::size(res) - 1);
113117

114-
for (uint32_t i = 0; i < std::size(res) - 1; i++) {
118+
const int bloomDepth = std::clamp(steps(), 1, MaxBloomSteps);
119+
120+
for (int i = 0; i < bloomDepth; i++) {
115121
dispatchDownsampleStep(ctx, linearSampler, *res[i], *res[i + 1], i == 0);
116122
}
117123

118-
for (uint32_t i = std::size(res) - 1; i > 1; i--) {
124+
for (int i = bloomDepth; i > 1; i--) {
119125
dispatchUpsampleStep(ctx, linearSampler, *res[i], *res[i - 1]);
120126
}
121127

src/dxvk/rtx_render/rtx_bloom.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,20 @@ namespace dxvk {
7474

7575
Rc<vk::DeviceFn> m_vkd;
7676

77+
constexpr static int MaxBloomSteps = 8;
7778
// Each image is 1/2 resolution of the previous.
78-
// Here, 5 steps are chosen: so the last image would be 1/(2^5) = 1/32 of the target resolution,
79-
// and at 4K resolution, it's ~67 pixels height, which is fine enough -- as on other hand,
80-
// we would like to keep the amount of steps as few as possible.
81-
Resources::Resource m_bloomBuffer[5] = {};
79+
Resources::Resource m_bloomBuffer[MaxBloomSteps] = {};
8280

8381
RTX_OPTION_ENV("rtx.bloom", bool, enable, true, "RTX_BLOOM_ENABLE", "Enable bloom - glowing halos around intense, bright areas.");
8482
RTX_OPTION("rtx.bloom", float, burnIntensity, 1.0f, "Amount of bloom to add to the final image.");
8583
RTX_OPTION("rtx.bloom", float, luminanceThreshold, 0.25f,
8684
"Adjust the bloom threshold to suppress blooming of the dim areas. "
8785
"Pixels with luminance lower than the threshold are multiplied by "
8886
"the weight value that smoothly transitions from 1.0 (at luminance=threshold) to 0.0 (at luminance=0).");
87+
RTX_OPTION_ARGS("rtx.bloom", int, steps, 5,
88+
"Number of downsampling steps to perform [1..8]. A higher value produces a wider blooming radius.",
89+
args.minValue = 1,
90+
args.maxValue = MaxBloomSteps);
8991
};
9092

9193
}

0 commit comments

Comments
 (0)