Skip to content

Commit

Permalink
use always_copy_new_props for final renders
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPerlman committed Jun 30, 2023
1 parent 1e14731 commit 886c243
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/controllers/nerf-rendering-controller.cu
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ void NeRFRenderingController::submit(
}

// prepare for rendering and dispatch tasks
bool requested_preview = (request->flags & RenderFlags::Preview) == RenderFlags::Preview;
bool requested_final = (request->flags & RenderFlags::Final) == RenderFlags::Final;

renderer.prepare_for_rendering(ctx, request->camera, nerfs, n_rays_max);
renderer.prepare_for_rendering(ctx, request->camera, nerfs, n_rays_max, requested_final);

// preview task cannot be canceled
bool requested_preview = (request->flags & RenderFlags::Preview) == RenderFlags::Preview;
if (factory->can_preview() && requested_preview) {
auto& preview_task = tasks[0];
renderer.perform_task(ctx, preview_task);
Expand All @@ -108,7 +109,6 @@ void NeRFRenderingController::submit(
}

// final_tasks are all other tasks after the optional first one
bool requested_final = (request->flags & RenderFlags::Final) == RenderFlags::Final;
if (requested_final) {
const int final_tasks_start = factory->can_preview() ? 1 : 0;

Expand Down
11 changes: 7 additions & 4 deletions src/core/renderer.cu
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ void Renderer::prepare_for_rendering(
Renderer::Context& ctx,
const Camera& camera,
const std::vector<NeRF*>& nerfs,
const uint32_t& n_rays
const uint32_t& n_rays,
bool always_copy_new_props
) {
cudaStream_t stream = ctx.stream;
auto& render_ws = ctx.render_ws;
Expand Down Expand Up @@ -67,6 +68,8 @@ void Renderer::prepare_for_rendering(
)
);

bool needs_copy = always_copy_new_props || needs_update;

for (int i = 0; i < n_nerfs; i++) {
const NeRF* nerf = nerfs[i];

Expand All @@ -77,15 +80,15 @@ void Renderer::prepare_for_rendering(
}

// copy updatable properties (these only get copied if their is_dirty flag is set)
if (needs_update || proxy->render_bbox.is_dirty()) {
if (needs_copy || proxy->render_bbox.is_dirty()) {
proxy->render_bbox.copy_to_device(scene_ws.render_bboxes + i, stream);
}

if (needs_update || proxy->training_bbox.is_dirty()) {
if (needs_copy || proxy->training_bbox.is_dirty()) {
proxy->training_bbox.copy_to_device(scene_ws.training_bboxes + i, stream);
}

if (needs_update || proxy->transform.is_dirty()) {
if (needs_copy || proxy->transform.is_dirty()) {
proxy->transform.copy_to_device(scene_ws.nerf_transforms + i, stream);
}

Expand Down
3 changes: 2 additions & 1 deletion src/core/renderer.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ struct Renderer {
Context& ctx,
const Camera& camera,
const std::vector<NeRF*>& nerfs,
const uint32_t& n_rays
const uint32_t& n_rays,
bool always_copy_new_props
);
};

Expand Down

0 comments on commit 886c243

Please sign in to comment.