MCPcopy
hub / github.com/zju3dv/4K4D / render

Method render

easyvolcap/utils/gl_utils.py:1045–1064  ·  view source on GitHub ↗
(self, camera: Camera)

Source from the content-addressed store, hash-verified

1043 # The actual rendering function
1044 @torch.no_grad()
1045 def render(self, camera: Camera):
1046 # Perform actual gaussian rendering
1047 batch = add_batch(to_cuda(camera.to_batch()))
1048 sh0 = rgb2sh0(self.rgb[..., None])
1049 xyz = self.pts
1050 occ = (self.occ * self.alpha_mult).clip(0, 1)
1051 rad = self.rad * self.radius_mult
1052
1053 rgb, acc, dpt = self.render_radius(*add_batch([xyz, sh0, rad, occ]), batch)
1054 rgb, acc, dpt = rgb[0], acc[0], dpt[0]
1055
1056 if self.view_depth:
1057 rgba = torch.cat([depth_curve_fn(dpt, cm=self.dpt_cm), acc], dim=-1) # H, W, 4
1058 else:
1059 rgba = torch.cat([rgb, acc], dim=-1) # H, W, 4
1060
1061 # Copy rendered tensor to screen
1062 rgba = (rgba.clip(0, 1) * 255).type(torch.uint8).flip(0) # transform
1063 self.quad.copy_to_texture(rgba)
1064 self.quad.render()
1065
1066 def render_imgui(mesh, viewer: 'VolumetricVideoViewer', batch: dotdict):
1067 super().render_imgui(viewer, batch)

Callers

nothing calls this directly

Calls 9

add_batchFunction · 0.90
to_cudaFunction · 0.90
rgb2sh0Function · 0.90
depth_curve_fnFunction · 0.90
to_batchMethod · 0.80
render_radiusMethod · 0.80
copy_to_textureMethod · 0.80
typeMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected