Skip to content

Commit 8f8ce10

Browse files
committed
Allow to render accumulation
1 parent 0955231 commit 8f8ce10

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
url = https://gitlab.inria.fr/bkerbl/simple-knn.git
44
[submodule "submodules/diff-gaussian-rasterization"]
55
path = submodules/diff-gaussian-rasterization
6-
url = https://github.com/graphdeco-inria/diff-gaussian-rasterization
6+
url = https://github.com/jkulhanek/fork-diff-gaussian-rasterization.git
77
[submodule "SIBR_viewers"]
88
path = SIBR_viewers
99
url = https://gitlab.inria.fr/sibr/sibr_core.git

gaussian_renderer/__init__.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from scene.gaussian_model import GaussianModel
1616
from utils.sh_utils import eval_sh
1717

18-
def render(viewpoint_camera, pc : GaussianModel, pipe, bg_color : torch.Tensor, scaling_modifier = 1.0, override_color = None):
18+
def render(viewpoint_camera, pc : GaussianModel, pipe, bg_color : torch.Tensor, scaling_modifier = 1.0, override_color = None, return_accumulation=False):
1919
"""
2020
Render the scene.
2121
@@ -32,7 +32,6 @@ def render(viewpoint_camera, pc : GaussianModel, pipe, bg_color : torch.Tensor,
3232
# Set up rasterization configuration
3333
tanfovx = math.tan(viewpoint_camera.FoVx * 0.5)
3434
tanfovy = math.tan(viewpoint_camera.FoVy * 0.5)
35-
3635
raster_settings = GaussianRasterizationSettings(
3736
image_height=int(viewpoint_camera.image_height),
3837
image_width=int(viewpoint_camera.image_width),
@@ -45,7 +44,8 @@ def render(viewpoint_camera, pc : GaussianModel, pipe, bg_color : torch.Tensor,
4544
sh_degree=pc.active_sh_degree,
4645
campos=viewpoint_camera.camera_center,
4746
prefiltered=False,
48-
debug=pipe.debug
47+
debug=pipe.debug,
48+
return_accumulation=return_accumulation
4949
)
5050

5151
rasterizer = GaussianRasterizer(raster_settings=raster_settings)
@@ -82,7 +82,7 @@ def render(viewpoint_camera, pc : GaussianModel, pipe, bg_color : torch.Tensor,
8282
colors_precomp = override_color
8383

8484
# Rasterize visible Gaussians to image, obtain their radii (on screen).
85-
rendered_image, radii = rasterizer(
85+
rendered_image, radii, accumulation = rasterizer(
8686
means3D = means3D,
8787
means2D = means2D,
8888
shs = shs,
@@ -94,7 +94,10 @@ def render(viewpoint_camera, pc : GaussianModel, pipe, bg_color : torch.Tensor,
9494

9595
# Those Gaussians that were frustum culled or had a radius of 0 were not visible.
9696
# They will be excluded from value updates used in the splitting criteria.
97-
return {"render": rendered_image,
98-
"viewspace_points": screenspace_points,
99-
"visibility_filter" : radii > 0,
100-
"radii": radii}
97+
out = {"render": rendered_image,
98+
"viewspace_points": screenspace_points,
99+
"visibility_filter" : radii > 0,
100+
"radii": radii}
101+
if raster_settings.return_accumulation:
102+
out["accumulation"] = accumulation
103+
return out

train.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ def training(dataset, opt, pipe, testing_iterations, saving_iterations, checkpoi
5656
net_image_bytes = None
5757
custom_cam, do_training, pipe.convert_SHs_python, pipe.compute_cov3D_python, keep_alive, scaling_modifer = network_gui.receive()
5858
if custom_cam != None:
59-
net_image = render(custom_cam, gaussians, pipe, background, scaling_modifer)["render"]
59+
out = render(custom_cam, gaussians, pipe, background, scaling_modifer, return_accumulation=True)
60+
# net_image = out["render"]
61+
net_image = out["accumulation"][None].repeat(3, 1, 1)
6062
net_image_bytes = memoryview((torch.clamp(net_image, min=0, max=1.0) * 255).byte().permute(1, 2, 0).contiguous().cpu().numpy())
6163
network_gui.send(net_image_bytes, dataset.source_path)
6264
if do_training and ((iteration < int(opt.iterations)) or not keep_alive):

0 commit comments

Comments
 (0)