MCPcopy
hub / github.com/junshutang/Make-It-3D / forward

Method forward

raymarching/raymarching.py:422–444  ·  view source on GitHub ↗

composite rays' rgbs, according to the ray marching formula. (for inference) Args: n_alive: int, number of alive rays n_step: int, how many steps we march rays_alive: int, [n_alive], the alive rays' IDs in N (N >= n_alive) rays_t: float, [N],

(ctx, n_alive, n_step, rays_alive, rays_t, sigmas, rgbs, normals, deltas, weights_sum, depth, image, normal, T_thresh=1e-2)

Source from the content-addressed store, hash-verified

420 @staticmethod
421 @custom_fwd(cast_inputs=torch.float32) # need to cast sigmas & rgbs to float
422 def forward(ctx, n_alive, n_step, rays_alive, rays_t, sigmas, rgbs, normals, deltas, weights_sum, depth, image, normal, T_thresh=1e-2):
423 ''' composite rays' rgbs, according to the ray marching formula. (for inference)
424 Args:
425 n_alive: int, number of alive rays
426 n_step: int, how many steps we march
427 rays_alive: int, [n_alive], the alive rays' IDs in N (N >= n_alive)
428 rays_t: float, [N], the alive rays' time
429 sigmas: float, [n_alive * n_step,]
430 rgbs: float, [n_alive * n_step, 3]
431 normals: float, [n_alive * n_step, 3]
432 deltas: float, [n_alive * n_step, 2], all generated points' deltas (here we record two deltas, the first is for RGB, the second for depth).
433 In-place Outputs:
434 weights_sum: float, [N,], the alpha channel
435 depth: float, [N,], the depth value
436 image: float, [N, 3], the RGB channel (after multiplying alpha!)
437 normal: float, [N, 3], the normal value
438 '''
439 sigmas = sigmas.float().contiguous()
440 rgbs = rgbs.float().contiguous()
441 normals = normals.float().contiguous()
442
443 get_backend().composite_rays(n_alive, n_step, T_thresh, rays_alive, rays_t, sigmas, rgbs, normals, deltas, weights_sum, depth, image, normal)
444 return tuple()
445
446
447composite_rays = _composite_rays.apply

Callers

nothing calls this directly

Calls 1

get_backendFunction · 0.85

Tested by

no test coverage detected