Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
instant-ngp-tomography
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas Pickles
instant-ngp-tomography
Commits
395e2437
Commit
395e2437
authored
2 years ago
by
Thomas Müller
Browse files
Options
Downloads
Patches
Plain Diff
DLSS: use non-premultiplied alpha (doesn't completely remove jitter, but fixes black halos)
parent
9143822f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/render_buffer.cu
+13
-1
13 additions, 1 deletion
src/render_buffer.cu
with
13 additions
and
1 deletion
src/render_buffer.cu
+
13
−
1
View file @
395e2437
...
...
@@ -534,7 +534,7 @@ __global__ void overlay_false_color_kernel(Vector2i resolution, Vector2i trainin
surf2Dwrite
(
to_float4
(
color
),
surface
,
x
*
sizeof
(
float4
),
y
);
}
__global__
void
tonemap_kernel
(
Vector2i
resolution
,
float
exposure
,
Array4f
background_color
,
Array4f
*
accumulate_buffer
,
EColorSpace
color_space
,
EColorSpace
output_color_space
,
ETonemapCurve
tonemap_curve
,
bool
clamp_output_color
,
cudaSurfaceObject_t
surface
)
{
__global__
void
tonemap_kernel
(
Vector2i
resolution
,
float
exposure
,
Array4f
background_color
,
Array4f
*
accumulate_buffer
,
EColorSpace
color_space
,
EColorSpace
output_color_space
,
ETonemapCurve
tonemap_curve
,
bool
clamp_output_color
,
bool
unmultiply_alpha
,
cudaSurfaceObject_t
surface
)
{
uint32_t
x
=
threadIdx
.
x
+
blockDim
.
x
*
blockIdx
.
x
;
uint32_t
y
=
threadIdx
.
y
+
blockDim
.
y
*
blockIdx
.
y
;
...
...
@@ -556,6 +556,11 @@ __global__ void tonemap_kernel(Vector2i resolution, float exposure, Array4f back
color
.
w
()
+=
weight
;
color
.
head
<
3
>
()
=
tonemap
(
color
.
head
<
3
>
(),
Array3f
::
Constant
(
exposure
),
tonemap_curve
,
color_space
,
output_color_space
);
if
(
unmultiply_alpha
&&
color
.
w
()
>
0.0
f
)
{
color
.
head
<
3
>
()
/=
color
.
w
();
}
if
(
clamp_output_color
)
{
color
=
color
.
cwiseMax
(
0.0
f
).
cwiseMin
(
1.0
f
);
}
...
...
@@ -577,6 +582,12 @@ __global__ void dlss_splat_kernel(
float4
color
;
surf2Dread
(
&
color
,
dlss_surface
,
x
*
sizeof
(
float4
),
y
);
// DLSS operates on non-premultiplied alpha, so multiply it back in
color
.
x
*=
color
.
w
;
color
.
y
*=
color
.
w
;
color
.
z
*=
color
.
w
;
surf2Dwrite
(
color
,
surface
,
x
*
sizeof
(
float4
),
y
);
}
...
...
@@ -663,6 +674,7 @@ void CudaRenderBuffer::tonemap(float exposure, const Array4f& background_color,
output_color_space
,
m_tonemap_curve
,
m_dlss
&&
output_color_space
==
EColorSpace
::
SRGB
,
(
bool
)
m_dlss
,
// DLSS seems to perform best with non-premultiplied alpha (probably trained on such data)
m_dlss
?
m_dlss
->
frame
()
:
surface
()
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment