MCPcopy Create free account
hub / github.com/XPandora/PhysGaussian / load_params_from_gs

Function load_params_from_gs

utils/render_utils.py:59–110  ·  view source on GitHub ↗
(
    pc: GaussianModel, pipe, scaling_modifier=1.0, override_color=None
)

Source from the content-addressed store, hash-verified

57
58
59def load_params_from_gs(
60 pc: GaussianModel, pipe, scaling_modifier=1.0, override_color=None
61):
62 # Create zero tensor. We will use it to make pytorch return gradients of the 2D (screen-space) means
63 screenspace_points = (
64 torch.zeros_like(
65 pc.get_xyz, dtype=pc.get_xyz.dtype, requires_grad=True, device="cuda"
66 )
67 + 0
68 )
69 try:
70 screenspace_points.retain_grad()
71 except:
72 pass
73
74 means3D = pc.get_xyz
75 means2D = screenspace_points
76 opacity = pc.get_opacity
77
78 # If precomputed 3d covariance is provided, use it. If not, then it will be computed from
79 # scaling / rotation by the rasterizer.
80 scales = None
81 rotations = None
82 cov3D_precomp = None
83 if pipe.compute_cov3D_python:
84 cov3D_precomp = pc.get_covariance(scaling_modifier)
85 else:
86 scales = pc.get_scaling
87 rotations = pc.get_rotation
88
89 # If precomputed colors are provided, use them. Otherwise, if it is desired to precompute colors
90 # from SHs in Python, do it. If not, then SH -> RGB conversion will be done by rasterizer.
91 shs = None
92 colors_precomp = None
93 if override_color is None:
94 shs = pc.get_features
95 else:
96 colors_precomp = override_color
97
98 # # Those Gaussians that were frustum culled or had a radius of 0 were not visible.
99 # # They will be excluded from value updates used in the splitting criteria.
100
101 return {
102 "pos": means3D,
103 "screen_points": means2D,
104 "shs": shs,
105 "colors_precomp": colors_precomp,
106 "opacity": opacity,
107 "scales": scales,
108 "rotations": rotations,
109 "cov3D_precomp": cov3D_precomp,
110 }
111
112
113def convert_SH(

Callers 1

gs_simulation.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected