MCPcopy Create free account
hub / github.com/JasonLSC/GSCodec_Studio / rasterization_2dgs

Function rasterization_2dgs

gsplat/rendering.py:1002–1321  ·  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,
    quats: Tensor,
    scales: Tensor,
    opacities: Tensor,
    colors: Tensor,
    viewmats: Tensor,
    Ks: Tensor,
    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

1000
1001###### 2DGS ######
1002def rasterization_2dgs(
1003 means: Tensor,
1004 quats: Tensor,
1005 scales: Tensor,
1006 opacities: Tensor,
1007 colors: Tensor,
1008 viewmats: Tensor,
1009 Ks: Tensor,
1010 width: int,
1011 height: int,
1012 near_plane: float = 0.01,
1013 far_plane: float = 1e10,
1014 radius_clip: float = 0.0,
1015 eps2d: float = 0.3,
1016 sh_degree: Optional[int] = None,
1017 packed: bool = False,
1018 tile_size: int = 16,
1019 backgrounds: Optional[Tensor] = None,
1020 render_mode: Literal["RGB", "D", "ED", "RGB+D", "RGB+ED"] = "RGB",
1021 sparse_grad: bool = False,
1022 absgrad: bool = False,
1023 distloss: bool = False,
1024 depth_mode: Literal["expected", "median"] = "expected",
1025) -> Tuple[Tensor, Tensor, Tensor, Tensor, Tensor, Tensor, Dict]:
1026 """Rasterize a set of 2D Gaussians (N) to a batch of image planes (C).
1027
1028 This function supports a handful of features, similar to the :func:`rasterization` function.
1029
1030 .. warning::
1031 This function is currently not differentiable w.r.t. the camera intrinsics `Ks`.
1032
1033 Args:
1034 means: The 3D centers of the Gaussians. [N, 3]
1035 quats: The quaternions of the Gaussians (wxyz convension). It's not required to be normalized. [N, 4]
1036 scales: The scales of the Gaussians. [N, 3]
1037 opacities: The opacities of the Gaussians. [N]
1038 colors: The colors of the Gaussians. [(C,) N, D] or [(C,) N, K, 3] for SH coefficients.
1039 viewmats: The world-to-cam transformation of the cameras. [C, 4, 4]
1040 Ks: The camera intrinsics. [C, 3, 3]
1041 width: The width of the image.
1042 height: The height of the image.
1043 near_plane: The near plane for clipping. Default is 0.01.
1044 far_plane: The far plane for clipping. Default is 1e10.
1045 radius_clip: Gaussians with 2D radius smaller or equal than this value will be
1046 skipped. This is extremely helpful for speeding up large scale scenes.
1047 Default is 0.0.
1048 eps2d: An epsilon added to the egienvalues of projected 2D covariance matrices.
1049 This will prevents the projected GS to be too small. For example eps2d=0.3
1050 leads to minimal 3 pixel unit. Default is 0.3.
1051 sh_degree: The SH degree to use, which can be smaller than the total
1052 number of bands. If set, the `colors` should be [(C,) N, K, 3] SH coefficients,
1053 else the `colors` should [(C,) N, D] post-activation color values. Default is None.
1054 packed: Whether to use packed mode which is more memory efficient but might or
1055 might not be as fast. Default is True.
1056 tile_size: The size of the tiles for rasterization. Default is 16.
1057 (Note: other values are not tested)
1058 backgrounds: The background colors. [C, D]. Default is None.
1059 render_mode: The rendering mode. Supported modes are "RGB", "D", "ED", "RGB+D",

Callers 1

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