Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cmake/test.cmake

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Add the capability to add a suffix to create a test with a different label from an existing scene. This is used in this branch to run tests with Hydra v1 render settings as well as Hydra v2 render settings.

Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ endfunction()
# [RENDERED_IMAGE_SUBDIR <dir>]
# [RENDERED_IMAGE_NAME <file_name>]
# [RENDERER_ARGS <extra_args>]
# [TEST_NAME_SUFFIX <suffix>]
# [COPY_SCENE]
# [ENV <varname>=<varvalue> ...])
#
Expand All @@ -769,6 +770,7 @@ endfunction()
# RENDERED_IMAGE_NAME - Rendered image file name (default test name)
# RENDERER_ARGS - Additional command line arguments to pass to the
# renderer.
# TEST_NAME_SUFFIX - Suffix to append to the Maya scene file name to create the test name.
# COPY_SCENE - If set, copies the scene file to the temporary project
# before rendering.
# ENV - Set or append the indicated environment variables;
Expand All @@ -782,7 +784,7 @@ function(mayaHydra_add_cmd_line_render_test SCENE_FILE_LABELED)

cmake_parse_arguments(ARG
"COPY_SCENE" # Boolean options.
"RENDERER;SCENE_FILE;WORKING_DIRECTORY;RENDERED_IMAGE_SUBDIR;RENDERED_IMAGE_NAME;IMAGE_EXTENSION;FAIL;FAILPERCENT;RENDERER_ARGS" # one_value keywords
"RENDERER;SCENE_FILE;WORKING_DIRECTORY;RENDERED_IMAGE_SUBDIR;RENDERED_IMAGE_NAME;IMAGE_EXTENSION;FAIL;FAILPERCENT;RENDERER_ARGS;TEST_NAME_SUFFIX" # one_value keywords
"ENV" # multi_value keywords
${ARGN}
)
Expand Down Expand Up @@ -811,6 +813,9 @@ function(mayaHydra_add_cmd_line_render_test SCENE_FILE_LABELED)
get_testfile_and_labels(ALL_LABELS SCENE_FILE ${SCENE_FILE_LABELED})
# Remove extension to define the test name
mayaUsd_get_unittest_target(test_name ${SCENE_FILE})
if(ARG_TEST_NAME_SUFFIX)
set(test_name "${test_name}_${ARG_TEST_NAME_SUFFIX}")
endif()

set(IMAGE_EXTENSION "png")
if(ARG_IMAGE_EXTENSION)
Expand Down Expand Up @@ -865,6 +870,11 @@ function(mayaHydra_add_cmd_line_render_test SCENE_FILE_LABELED)
set(RENDERED_IMAGE_DIR "${RENDERED_IMAGE_ROOT_DIR}/${RENDERED_IMAGE_SUBDIR}")
set(RENDERED_IMAGE_PATH "${RENDERED_IMAGE_DIR}/${RENDERED_IMAGE_NAME}.${IMAGE_EXTENSION}")
cmake_path(REPLACE_EXTENSION SRC_SCENE_PATH ".${IMAGE_EXTENSION}" OUTPUT_VARIABLE EXPECTED_IMAGE_PATH)
if(ARG_TEST_NAME_SUFFIX)
cmake_path(GET EXPECTED_IMAGE_PATH STEM LAST_ONLY _expected_stem)
cmake_path(GET EXPECTED_IMAGE_PATH PARENT_PATH _expected_dir)
set(EXPECTED_IMAGE_PATH "${_expected_dir}/${_expected_stem}_${ARG_TEST_NAME_SUFFIX}.${IMAGE_EXTENSION}")
endif()

# Always use the discovered idiff binary; do not fall back to PATH
if (IMAGE_DIFF_TOOL)
Expand Down
13 changes: 9 additions & 4 deletions lib/mayaHydra/hydraExtensions/sceneIndex/mayaHydraSceneIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,12 @@ void MayaHydraSceneIndex::InsertDag(const MDagPath& dag)
return;
}

// Cameras can be invisible and still be renderable, so adapter creation

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Tests with Hydra v2 render settings were failing as Maya cameras were not being translated into the Hydra scene. For Hydra v1 render settings we translate using camera parameters and do not check the visibility status of cameras.

// must occur before the visibility check.
if (CreateCameraAdapter(dag)) {
return;
}

// In batch mode (useMeshAdapter), MItDag visits every DAG node including
// LOD meshes and corrective blend-shape targets that VP2 never makes render
// items for. Skip shapes that are not visible so that only the intended
Expand All @@ -1585,14 +1591,13 @@ void MayaHydraSceneIndex::InsertDag(const MDagPath& dag)
return;
}

// Custom lights don't have MFn::kLight.
// Invisible lights don't contribute to the scene, so light adapter
// creation after the visibility check above is correct. Custom lights
// don't have MFn::kLight.
if (CreateLightAdapter(dag)) {
return;
}

if (CreateCameraAdapter(dag)) {
return;
}
// We are inserting a single prim and
// instancer for every instanced mesh.
if (dag.isInstanced() && dag.instanceNumber() > 0) {
Expand Down

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Make sure that InsertDag is not part of the public interface of this class.

Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ class MAYAHYDRALIB_API MayaHydraSceneIndex : public HdRetainedSceneIndex
void UpdateLightsShadowCollection();

// Dag Node operations
void InsertDag(const MDagPath& dag);
void OnDagNodeAdded(const MObject& obj);
void OnDagNodeRemoved(const MObject& obj);
void AddNewInstance(const MDagPath& dag);
Expand Down Expand Up @@ -283,7 +282,9 @@ class MAYAHYDRALIB_API MayaHydraSceneIndex : public HdRetainedSceneIndex
/// producer API (checked via DataProducersNodeHashCodeToSdfPathRegistry).
MayaHydraCustomDagAdapterPtr CreateCustomAdapter(const MDagPath& dagPath);

// Utilites
void InsertDag(const MDagPath& dag);

// Utilities
bool _GetRenderItem(int fastId, MayaHydraRenderItemAdapterPtr& adapter);
void _AddPrimAncestors(const SdfPath& path);
void _RemoveEmptyAncestors(const SdfPath& path);
Expand Down
3 changes: 3 additions & 0 deletions lib/mayaHydra/mayaPlugin/batchRendering/batchRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ void BatchRenderer::_InitHydraResources()
// At time of writing (2026-06-02) only Hydra Arnold understands this
// token, requires further testing.
if (TfGetenvBool("MAYA_HYDRA_HD_ARNOLD_HYDRA_V2_RENDER_SETTINGS", false)) {
TF_DEBUG_MSG(MAYAHYDRAPLUGIN_BATCHRENDER_RENDER_SETTINGS,
"Render setting " + BatchRenderTokens->renderSettingsSrc.GetString() + " set to " + BatchRenderTokens->hydraSceneRenderSettingsSrc.GetString() + "\n");

_renderDelegate->SetRenderSetting(BatchRenderTokens->renderSettingsSrc, VtValue(BatchRenderTokens->hydraSceneRenderSettingsSrc));
}

Expand Down
4 changes: 4 additions & 0 deletions lib/mayaHydra/mayaPlugin/renderSettingsUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,17 @@ RenderSettingsType ReadRenderSettingsTypeFromRenderDelegate(const TfToken& rende
if (IsPrmanRenderSettingsDriveRenderPassEnabled(rendererName)
|| HdArnoldUseHydraV2RenderSettings(rendererName)
) {
TF_DEBUG_MSG(MAYAHYDRAPLUGIN_BATCHRENDER_CMD,
"Using Hydra v2 render settings.\n");
return RenderSettingsType::HydraV2;
}

// Check if the scene contains Usd render settings
UsdRenderSettings dummyUsdRenderSettings;// Pass a dummy UsdRenderSettings to just check for presence
const auto psPath = ExtractUsdRenderSettingsFromScene(dummyUsdRenderSettings);
if (!psPath.empty()) {
TF_DEBUG_MSG(MAYAHYDRAPLUGIN_BATCHRENDER_CMD,
"Using Hydra v1 render settings.\n");
return RenderSettingsType::HydraV1;
}

Expand Down
17 changes: 17 additions & 0 deletions test/lib/cmdLineRender/CMakeLists.txt

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Run through the HdArnold tests again, using Hydra v2 render settings in this loop.

Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,23 @@ foreach(scene ${ARNOLD_RENDER_SCENES})
)
endforeach()

foreach(scene ${ARNOLD_RENDER_SCENES})
cmake_path(GET scene STEM sceneFileNameNoExt)
set(render_dir ${CMAKE_BINARY_DIR}/test/Temporary/${sceneFileNameNoExt}_v2_rs/projects/default/images)
mayaHydra_add_cmd_line_render_test(${scene}
COPY_SCENE
RENDERER HdArnoldRendererPlugin
RENDERED_IMAGE_SUBDIR projects/default/images
RENDERED_IMAGE_NAME ${sceneFileNameNoExt}_v2_rs
RENDERER_ARGS "-x 160 -y 120 -rd \"${render_dir}\" -im ${sceneFileNameNoExt}_v2_rs"
TEST_NAME_SUFFIX v2_rs
ENV
"MAYA_HYDRA_HD_ARNOLD_HYDRA_V2_RENDER_SETTINGS=1"
"USDIMAGINGGL_ENGINE_ENABLE_SCENE_INDEX=1"
Comment on lines +86 to +87

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Awkwardly, two environment variables are needed to enable Hydra v2 render settings in Arnold. This is being discussed with the Arnold team.

"TF_DEBUG=MAYAHYDRAPLUGIN_BATCHRENDER_RENDER_SETTINGS"
)
endforeach()

mayaHydra_add_cmd_line_render_test(renderSettings/stormResolution.ma
COPY_SCENE
RENDERER HdStormRendererPlugin
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading