This is a fork of the original rasterization engine diff-gaussian-rasterization for the paper "3D Gaussian Splatting for Real-Time Rendering of Radiance Fields". We add a new salar attribute namely "importance" to each guassian, and implement both forward & backward pass for it.
⚪ Forward
Following the definition of rendered image color C, which derives from the accumulation of guassian color multiplied by a learnable opacityi both exponentially decayed w.r.t. the depth from viewpoint and zig-zagly decayed w.r.t. the sorted depth order:
C=∑i∈Nciαii−1∑j=1(1−αj)
where αi=opacityi∗epower, and power<=0 interprets as the viewpoint depth.
We define here the importance map O in pixel space as:
O=∑i∈Noiαii−1∑j=1(1−αj)
⚪ Backward
Since the per-pixel importance Oi is derived from the accumulation per-Gaussian importance oi, conducting the chaining rule to obtain the gradients:
∂L∂oi=∂L∂O∗∂O∂oi=∂L∂O∗[αii−1∑j=1(1−αj)]
noted that the right part [⋅] has already been computed in the forward pass, we might simply cache it and reuse; but the original repo code recomputes it again (like pytorch checkpointing mechanism), trading time for less VRAM usage
Additionally, the importance oi interacts with opacity αi, hence the gradients of opacity will add this new term:
∂L∂αi+=∂L∂O∗∂O∂αi=∂L∂O∗[oii−1∑j=1(1−αj)]
again the right part [⋅] is implemented in a recursive way following the original code, by making good use of the forward formula, here we show the rough idea:
oii−1∑j=1(1−αj)=O−∑j−1k=1Okαi
ℹ We provide source code only, for compiling how-tos follow the original guide
from diff_gaussian_rasterization_ks import GaussianRasterizationSettings, GaussianRasterizer
# modified version with importance attribute
pc: GaussianModel
# [num_points, D=1], alike opacity
importance = pc.get_importance
rasterizer = GaussianRasterizer(raster_settings=...)
rendered_image, importance_map, radii = rasterizer(
means3D = means3D,
means2D = means2D,
shs = shs,
colors_precomp = colors_precomp,
opacities = opacity,
importances = importance, # <- new pointcloud attributes
scales = scales,
rotations = rotations,
cov3D_precomp = cov3D_precomp,
)
# [H, W], alike rendered_image but without channel dim C
importance_map # <- rendered in pixel space
@Article{kerbl3Dgaussians,
author = {Kerbl, Bernhard and Kopanas, Georgios and Leimk{\"u}hler, Thomas and Drettakis, George},
title = {3D Gaussian Splatting for Real-Time Radiance Field Rendering},
journal = {ACM Transactions on Graphics},
number = {4},
volume = {42},
month = {July},
year = {2023},
url = {https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/}
}
by Armit 2024/03/27
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。