Skip to content

AGPHVT-39 : Add a clear depth param in FramePass and clear the aov ta… - #18

Merged
sebastienberube-adsk merged 3 commits into
mainfrom
lanierd/AGPHVT-39
Jul 3, 2025
Merged

AGPHVT-39 : Add a clear depth param in FramePass and clear the aov ta…#18
sebastienberube-adsk merged 3 commits into
mainfrom
lanierd/AGPHVT-39

Conversation

@lanierd-adsk

Copy link
Copy Markdown
Contributor

…sk cache cache , tentative in adding a unit test

…sk cache cache , tentative in adding a unit test

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a clear depth parameter in the FramePass workflow and integrates support to clear the AOV task cache accordingly, along with an accompanying unit test to validate the behavior. The key changes include:

  • Adding new parameters (backgroundDepth and clearBackgroundDepth) to FramePassParams.
  • Modifying FramePass and RenderBufferManager to support clearing the depth buffer.
  • Introducing a new unit test in testFramePasses.cpp to verify multi-viewport behavior with depth clearing.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/tests/testFramePasses.cpp New unit test for multi-viewport clear depth handling.
source/engine/renderBufferManager.cpp Added ResetRenderOutputClear to clear the AOV task cache.
source/engine/framePass.cpp Updated to set clear depth values based on new FramePassParams.
include/hvt/engine/framePass.h Introduced backgroundDepth and clearBackgroundDepth parameters.
CMakeLists.txt Minor fix in a comment regarding vcpkg dependency options.
Comments suppressed due to low confidence (3)

test/tests/testFramePasses.cpp:28

  • [nitpick] Confirm that the inclusion of 'framePassUtils.h' is necessary for the test since its functions do not appear to be directly used.
#include <hvt/engine/framePassUtils.h>

include/hvt/engine/framePass.h:130

  • [nitpick] Consider adding a doc comment to describe the purpose and usage of backgroundDepth for clarity.
    float backgroundDepth {1.0f};

include/hvt/engine/framePass.h:132

  • [nitpick] Consider documenting clearBackgroundDepth to explain when and why the depth buffer should be cleared.
    bool clearBackgroundDepth { false };

Comment on lines +563 to +564
// Renders 10 times (i.e., arbitrary number to guarantee best result).
int frameCount = 10;

Copilot AI Jun 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider replacing the magic number '10' with a named constant to improve maintainability.

Suggested change
// Renders 10 times (i.e., arbitrary number to guarantee best result).
int frameCount = 10;
// Renders a default number of times to guarantee best result.
const int DEFAULT_RENDER_FRAME_COUNT = 10;
int frameCount = DEFAULT_RENDER_FRAME_COUNT;

Copilot uses AI. Check for mistakes.
@lanierd-adsk
lanierd-adsk marked this pull request as draft June 30, 2025 09:01

@sebastienberube-adsk sebastienberube-adsk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to clear the depth buffer and to reset the clear parameters make sense and fix a known issue with multiple frame passes.

We might update the RenderBufferManager API to improve and clarify how the buffers are cleared at some point in the future, but this iteration does the trick for now.

void SetViewportRenderOutput(const TfToken& name, HdRenderBuffer* aovBuffer,
HdRenderBuffer* depthBuffer, const SdfPath& controllerId);

/// Resets the clear values

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Minor]
End sentence with "."

_bufferManager->SetRenderOutputClearColor(
HdAovTokens->depth, VtValue(_passParams.backgroundDepth));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking maybe ResetRenderOutputClear() could be made public in RenderBufferManager, and be called here (ln 318) before setting the color and depth clear color.

@sebastienberube-adsk
sebastienberube-adsk marked this pull request as ready for review July 3, 2025 01:54
bool clearBackground { true };
float backgroundDepth {1.0f};
bool clearBackground{ true };
bool clearBackgroundDepth { false };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: At one point, we might want to rename clearBackground to clearBackgroundColor.
Not needed for this PR, but as already mentioned by @lanierd-adsk, it would be clearer and more consistent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebastienberube-adsk Could you create a Jira ticket with all your comments and assign it to @sm-adsk ?

@sebastienberube-adsk
sebastienberube-adsk merged commit 8f90658 into main Jul 3, 2025
10 checks passed
@sebastienberube-adsk
sebastienberube-adsk deleted the lanierd/AGPHVT-39 branch July 3, 2025 20:18
hvt::FramePassParams& params = framePass1.sceneFramePass->params();

params.renderBufferSize = GfVec2i(width, height);
// To display on the left part of the viewport.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebastienberube-adsk Visually the model display seems to be on the right side of the viewport! Did I miss something?

@hodoulp

hodoulp commented Jul 4, 2025

Copy link
Copy Markdown
Contributor

@sebastienberube-adsk When running on macOS with XCode, the new unit test generates lot of errors on the console:

[ RUN      ] TestViewportToolbox.TestFramePasses_MultiViewportsClearDepth
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for color."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for depth."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for color."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for depth."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for color."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for depth."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for color."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for depth."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for color."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for depth."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for color."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for depth."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for color."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for depth."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for color."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for depth."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for color."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for depth."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for color."
[]: Error issued : /Users/hodoulp/dev/agp/hvt_publ_1/source/engine/framePassUtils.cpp - HVT_NS_v0_25_03::CreateRenderBufferProxy(136): "The frame pass is not initialized for depth."
[       OK ] TestViewportToolbox.TestFramePasses_MultiViewportsClearDepth (217 ms)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants