WIP: Support more AOVs #72

Closed
Georgiy Markelov wants to merge 6 commits from DagerD/blender:BLEN-461 into hydra-render

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 15 additions and 3 deletions
Showing only changes of commit eabc10c758 - Show all commits

View File

@ -141,6 +141,10 @@ class HydraRenderEngine(bpy.types.RenderEngine):
_bpy_hydra.engine_view_draw(self.engine_ptr, depsgraph.as_pointer(), context.as_pointer())
def update_render_passes(self, scene, render_layer):
if render_layer.use_pass_z:
self.register_pass(scene, render_layer, 'Depth', 1, 'Z', 'VALUE')
def export_mtlx(material):
""" Exports material to .mtlx file. It is called from Blender source code. """

View File

@ -23,10 +23,12 @@ void FinalEngine::render(Depsgraph *depsgraph)
{
prepare_for_render(depsgraph);
render_task_delegate_->set_renderer_aov(pxr::HdAovTokens->color);
render_task_delegate_->set_renderer_aov(pxr::HdAovTokens->depth);
engine_->Execute(render_index_.get(), &tasks_);
std::vector<float> &pixels = render_images_["Combined"];
std::vector<float> &pixels_depth = render_images_["Depth"];
std::vector<float> &pixels_combined = render_images_["Combined"];
char elapsed_time[32];
double time_begin = PIL_check_seconds_timer();
float percent_done = 0.0;
@ -48,11 +50,13 @@ void FinalEngine::render(Depsgraph *depsgraph)
break;
}
render_task_delegate_->get_renderer_aov_data(pxr::HdAovTokens->color, pixels.data());
render_task_delegate_->get_renderer_aov_data(pxr::HdAovTokens->color, pixels_combined.data());
render_task_delegate_->get_renderer_aov_data(pxr::HdAovTokens->depth, pixels_depth.data());
update_render_result();
}
render_task_delegate_->get_renderer_aov_data(pxr::HdAovTokens->color, pixels.data());
render_task_delegate_->get_renderer_aov_data(pxr::HdAovTokens->color, pixels_combined.data());
render_task_delegate_->get_renderer_aov_data(pxr::HdAovTokens->depth, pixels_depth.data());
update_render_result();
}
@ -116,6 +120,10 @@ void FinalEngine::prepare_for_render(Depsgraph *depsgraph)
render_images_.emplace(
"Combined",
std::vector<float>(resolution_[0] * resolution_[1] * 4)); /* 4 - number of channels. */
render_images_.emplace(
"Depth",
std::vector<float>(resolution_[0] * resolution_[1] * 1)); /* 1 - number of channels. */
}
void FinalEngineGPU::render(Depsgraph *depsgraph)