MCPcopy
hub / github.com/nerfstudio-project/gsplat / rasterization_2dgs

Function rasterization_2dgs

gsplat/rendering.py:1270–1627  ·  view source on GitHub ↗

Rasterize a set of 2D Gaussians (N) to a batch of image planes (C). This function supports a handful of features, similar to the :func:`rasterization` function. .. warning:: This function is currently not differentiable w.r.t. the camera intrinsics `Ks`. Args: means: T

(
    means: Tensor,  # [..., N, 3]
    quats: Tensor,  # [..., N, 4]
    scales: Tensor,  # [..., N, 3]
    opacities: Tensor,  # [..., N]
    colors: Tensor,  # [..., (C,) N, D] or [..., (C,) N, K, 3]
    viewmats: Tensor,  # [..., C, 4, 4]
    Ks: Tensor,  # [..., C, 3, 3]
    width: int,
    height: int,
    near_plane: float = 0.01,
    far_plane: float = 1e10,
    radius_clip: float = 0.0,
    eps2d: float = 0.3,
    sh_degree: Optional[int] = None,
    packed: bool = False,
    tile_size: int = 16,
    backgrounds: Optional[Tensor] = None,
    render_mode: Literal["RGB", "D", "ED", "RGB+D", "RGB+ED"] = "RGB",
    sparse_grad: bool = False,
    absgrad: bool = False,
    distloss: bool = False,
    depth_mode: Literal["expected", "median"] = "expected",
)

Source from the content-addressed store, hash-verified

1268
1269###### 2DGS ######
1270def rasterization_2dgs(
1271 means: Tensor, # [..., N, 3]
1272 quats: Tensor, # [..., N, 4]
1273 scales: Tensor, # [..., N, 3]
1274 opacities: Tensor, # [..., N]
1275 colors: Tensor, # [..., (C,) N, D] or [..., (C,) N, K, 3]
1276 viewmats: Tensor, # [..., C, 4, 4]
1277 Ks: Tensor, # [..., C, 3, 3]
1278 width: int,
1279 height: int,
1280 near_plane: float = 0.01,
1281 far_plane: float = 1e10,
1282 radius_clip: float = 0.0,
1283 eps2d: float = 0.3,
1284 sh_degree: Optional[int] = None,
1285 packed: bool = False,
1286 tile_size: int = 16,
1287 backgrounds: Optional[Tensor] = None,
1288 render_mode: Literal["RGB", "D", "ED", "RGB+D", "RGB+ED"] = "RGB",
1289 sparse_grad: bool = False,
1290 absgrad: bool = False,
1291 distloss: bool = False,
1292 depth_mode: Literal["expected", "median"] = "expected",
1293) -> Tuple[Tensor, Tensor, Tensor, Tensor, Tensor, Tensor, Dict]:
1294 """Rasterize a set of 2D Gaussians (N) to a batch of image planes (C).
1295
1296 This function supports a handful of features, similar to the :func:`rasterization` function.
1297
1298 .. warning::
1299 This function is currently not differentiable w.r.t. the camera intrinsics `Ks`.
1300
1301 Args:
1302 means: The 3D centers of the Gaussians. [..., N, 3]
1303 quats: The quaternions of the Gaussians (wxyz convension). It's not required to be normalized. [..., N, 4]
1304 scales: The scales of the Gaussians. [..., N, 3]
1305 opacities: The opacities of the Gaussians. [..., N]
1306 colors: The colors of the Gaussians. [..., (C,) N, D] or [..., (C,) N, K, 3] for SH coefficients.
1307 viewmats: The world-to-cam transformation of the cameras. [..., C, 4, 4]
1308 Ks: The camera intrinsics. [..., C, 3, 3]
1309 width: The width of the image.
1310 height: The height of the image.
1311 near_plane: The near plane for clipping. Default is 0.01.
1312 far_plane: The far plane for clipping. Default is 1e10.
1313 radius_clip: Gaussians with 2D radius smaller or equal than this value will be
1314 skipped. This is extremely helpful for speeding up large scale scenes.
1315 Default is 0.0.
1316 eps2d: An epsilon added to the egienvalues of projected 2D covariance matrices.
1317 This will prevents the projected GS to be too small. For example eps2d=0.3
1318 leads to minimal 3 pixel unit. Default is 0.3.
1319 sh_degree: The SH degree to use, which can be smaller than the total
1320 number of bands. If set, the `colors` should be [(C,) N, K, 3] SH coefficients,
1321 else the `colors` should [(C,) N, D] post-activation color values. Default is None.
1322 packed: Whether to use packed mode which is more memory efficient but might or
1323 might not be as fast. Default is True.
1324 tile_size: The size of the tiles for rasterization. Default is 16.
1325 (Note: other values are not tested)
1326 backgrounds: The background colors. [C, D]. Default is None.
1327 render_mode: The rendering mode. Supported modes are "RGB", "D", "ED", "RGB+D",

Callers 2

viewer_render_fnFunction · 0.90
rasterize_splatsMethod · 0.90

Calls 6

isect_tilesFunction · 0.85
isect_offset_encodeFunction · 0.85
spherical_harmonicsFunction · 0.85
rasterize_to_pixels_2dgsFunction · 0.85
depth_to_normalFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…