AGPHVT-39 : Add a clear depth param in FramePass and clear the aov ta… - #18
Conversation
…sk cache cache , tentative in adding a unit test
There was a problem hiding this comment.
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 };
| // Renders 10 times (i.e., arbitrary number to guarantee best result). | ||
| int frameCount = 10; |
There was a problem hiding this comment.
[nitpick] Consider replacing the magic number '10' with a named constant to improve maintainability.
| // 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; |
sebastienberube-adsk
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
[Minor]
End sentence with "."
| _bufferManager->SetRenderOutputClearColor( | ||
| HdAovTokens->depth, VtValue(_passParams.backgroundDepth)); | ||
| } | ||
|
|
There was a problem hiding this comment.
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.
| bool clearBackground { true }; | ||
| float backgroundDepth {1.0f}; | ||
| bool clearBackground{ true }; | ||
| bool clearBackgroundDepth { false }; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@sebastienberube-adsk Could you create a Jira ticket with all your comments and assign it to @sm-adsk ?
| hvt::FramePassParams& params = framePass1.sceneFramePass->params(); | ||
|
|
||
| params.renderBufferSize = GfVec2i(width, height); | ||
| // To display on the left part of the viewport. |
There was a problem hiding this comment.
@sebastienberube-adsk Visually the model display seems to be on the right side of the viewport! Did I miss something?
|
@sebastienberube-adsk When running on |
…sk cache cache , tentative in adding a unit test