diff --git a/source/blender/render/hydra/final_engine.cc b/source/blender/render/hydra/final_engine.cc index ebc6d91c9218..88a4d451402c 100644 --- a/source/blender/render/hydra/final_engine.cc +++ b/source/blender/render/hydra/final_engine.cc @@ -109,7 +109,7 @@ void FinalEngine::prepare_for_render(Depsgraph *depsgraph) if (light_tasks_delegate_) { light_tasks_delegate_->set_camera_and_viewport( free_camera_delegate_->GetCameraId(), pxr::GfVec4d(0, 0, resolution_[0], resolution_[1])); - tasks_ = light_tasks_delegate_->get_tasks(); + tasks_ = light_tasks_delegate_->get_tasks(scene->r.alphamode == R_ALPHAPREMUL); } tasks_.push_back(render_task_delegate_->get_task()); @@ -147,7 +147,7 @@ void FinalEngineGPU::render(Depsgraph *depsgraph) GPU_framebuffer_bind(framebuffer); - float clear_color[4] = {0.0f, 0.0f, 0.0f, 1.0f}; + float clear_color[4] = {0.0f, 0.0f, 0.0f, 0.0f}; GPU_framebuffer_clear_color_depth(framebuffer, clear_color, 1.0f); diff --git a/source/blender/render/hydra/light_tasks_delegate.cc b/source/blender/render/hydra/light_tasks_delegate.cc index 237ac8b0fc4b..dc817d17ce2a 100644 --- a/source/blender/render/hydra/light_tasks_delegate.cc +++ b/source/blender/render/hydra/light_tasks_delegate.cc @@ -18,12 +18,17 @@ LightTasksDelegate::LightTasksDelegate(pxr::HdRenderIndex *parent_index, GetRenderIndex().InsertTask(this, simple_task_id_); } -pxr::HdTaskSharedPtrVector LightTasksDelegate::get_tasks() +pxr::HdTaskSharedPtrVector LightTasksDelegate::get_tasks(const bool isTransparent) { /*Note that this task is intended to be the first "Render Task", so that the AOV's are properly cleared, however it does not spawn a HdRenderPass.*/ - return {GetRenderIndex().GetTask(skydome_task_id_), GetRenderIndex().GetTask(simple_task_id_)}; + pxr::HdTaskSharedPtrVector tasks; + if (!isTransparent) { + tasks.push_back(GetRenderIndex().GetTask(skydome_task_id_)); + } + tasks.push_back(GetRenderIndex().GetTask(simple_task_id_)); + return tasks; } void LightTasksDelegate::set_camera_and_viewport(pxr::SdfPath const &camera_id, diff --git a/source/blender/render/hydra/light_tasks_delegate.h b/source/blender/render/hydra/light_tasks_delegate.h index ac99e4932623..ea1db5adba43 100644 --- a/source/blender/render/hydra/light_tasks_delegate.h +++ b/source/blender/render/hydra/light_tasks_delegate.h @@ -14,7 +14,7 @@ class LightTasksDelegate : public pxr::HdSceneDelegate { LightTasksDelegate(pxr::HdRenderIndex *parentIndex, pxr::SdfPath const &delegate_id); ~LightTasksDelegate() override = default; - pxr::HdTaskSharedPtrVector get_tasks(); + pxr::HdTaskSharedPtrVector get_tasks(const bool isTransparent); void set_camera_and_viewport(pxr::SdfPath const &camera_id, pxr::GfVec4d const &viewport); /* Delegate methods */ diff --git a/source/blender/render/hydra/viewport_engine.cc b/source/blender/render/hydra/viewport_engine.cc index b16c4ad776ae..1d02441fcea5 100644 --- a/source/blender/render/hydra/viewport_engine.cc +++ b/source/blender/render/hydra/viewport_engine.cc @@ -222,9 +222,10 @@ void ViewportEngine::render(Depsgraph * /* depsgraph */) /* Empty function */ } -void ViewportEngine::render(Depsgraph * /* depsgraph */, bContext *context) +void ViewportEngine::render(Depsgraph *depsgraph, bContext *context) { ViewSettings view_settings(context); + const Scene *scene = DEG_get_evaluated_scene(depsgraph); if (view_settings.width() * view_settings.height() == 0) { return; }; @@ -254,7 +255,7 @@ void ViewportEngine::render(Depsgraph * /* depsgraph */, bContext *context) pxr::HdTaskSharedPtrVector tasks; if (light_tasks_delegate_) { - tasks = light_tasks_delegate_->get_tasks(); + tasks = light_tasks_delegate_->get_tasks(scene->r.alphamode == R_ALPHAPREMUL); } tasks.push_back(render_task_delegate_->get_task());