@@ -266,11 +266,13 @@ renderCUDA(
266
266
int W, int H,
267
267
const float2 * __restrict__ points_xy_image,
268
268
const float * __restrict__ features,
269
+ const float * __restrict__ depths,
269
270
const float4 * __restrict__ conic_opacity,
270
271
float * __restrict__ final_T,
271
272
uint32_t * __restrict__ n_contrib,
272
273
const float * __restrict__ bg_color,
273
- float * __restrict__ out_color)
274
+ float * __restrict__ out_color,
275
+ float * __restrict__ out_depth)
274
276
{
275
277
// Identify current tile and associated min/max pixel range.
276
278
auto block = cg::this_thread_block ();
@@ -301,6 +303,7 @@ renderCUDA(
301
303
uint32_t contributor = 0 ;
302
304
uint32_t last_contributor = 0 ;
303
305
float C[CHANNELS] = { 0 };
306
+ float D = { 0 };
304
307
305
308
// Iterate over batches until all done or range is complete
306
309
for (int i = 0 ; i < rounds; i++, toDo -= BLOCK_SIZE)
@@ -353,6 +356,7 @@ renderCUDA(
353
356
// Eq. (3) from 3D Gaussian splatting paper.
354
357
for (int ch = 0 ; ch < CHANNELS; ch++)
355
358
C[ch] += features[collected_id[j] * CHANNELS + ch] * alpha * T;
359
+ D += depths[collected_id[j]] * alpha * T;
356
360
357
361
T = test_T;
358
362
@@ -370,6 +374,7 @@ renderCUDA(
370
374
n_contrib[pix_id] = last_contributor;
371
375
for (int ch = 0 ; ch < CHANNELS; ch++)
372
376
out_color[ch * H * W + pix_id] = C[ch] + T * bg_color[ch];
377
+ out_depth[pix_id] = D;
373
378
}
374
379
}
375
380
@@ -380,23 +385,27 @@ void FORWARD::render(
380
385
int W, int H,
381
386
const float2 * means2D,
382
387
const float * colors,
388
+ const float * depths,
383
389
const float4 * conic_opacity,
384
390
float * final_T,
385
391
uint32_t * n_contrib,
386
392
const float * bg_color,
387
- float * out_color)
393
+ float * out_color,
394
+ float * out_depth)
388
395
{
389
396
renderCUDA<NUM_CHANNELS> << <grid, block >> > (
390
397
ranges,
391
398
point_list,
392
399
W, H,
393
400
means2D,
394
401
colors,
402
+ depths,
395
403
conic_opacity,
396
404
final_T,
397
405
n_contrib,
398
406
bg_color,
399
- out_color);
407
+ out_color,
408
+ out_depth);
400
409
}
401
410
402
411
void FORWARD::preprocess (int P, int D, int M,
@@ -452,4 +461,4 @@ void FORWARD::preprocess(int P, int D, int M,
452
461
tiles_touched,
453
462
prefiltered
454
463
);
455
- }
464
+ }
0 commit comments