Fix #123972: Hydra storm crash with USD sub-d meshes
When using the USD export method with Hydra storm[1], problems can occur because of how this was integrated alongside the direct Hydra method. The direct hydra support was initially added in Blender 4.0 and the USD option was integrated at the same time in order to provide a mechanism for comparison and double-checking each implementation. In the context of this bug, for Viewport previews and renders, the Hydra engine is initially triggered and executed as part of an "engine update" call from the various v3d draw managers. During this call the USD export is attempted. For sub-d meshes the USD export machinery will, by default, attempt to apply the correct Subdivision Scheme attribute to mesh data. That means it will export the unsubdivided base mesh with an attribute letting the downstream receiver of the data know they should do the subdivision on their own. This subdivision scheme support was added in 4.1. However, in order to do this, USD must first disable the Subdivision modifiers in Blender before exporting the mesh. Disabling modifiers triggers depsgraph processing and, unfortunately, this processing will also trigger an "engine update" for Hydra... again. Reentrancy is not supported here. See stack trace in original bug. So, instead, change the USD export option to output a subdivided mesh to begin with. This has the following ramifications: - Viewport material preview and render modes no longer crash when sub-d is used - While F12/final renders did not crash, changing this option will now properly render the subdivided geometry when using the USD export method. Allowing our USD / Hydra render tests to align more closely. The direct Hydra option was already pre-subdividing mesh data anyhow. This will require updating the USD reference render images. - The underlying integration issue is not fixed. Triggering a USD export inside the "engine update" call path seems error-prone and can lead to similar issues in the future. Pull Request: https://projects.blender.org/blender/blender/pulls/125840
This commit is contained in:
committed by
Jesse Yurkovich
parent
3ea292db8d
commit
2f7b66f634
@@ -55,6 +55,7 @@ void USDSceneDelegate::populate(Depsgraph *depsgraph)
|
||||
params.use_instancing = true;
|
||||
params.relative_paths = false; /* Unnecessary. */
|
||||
params.export_textures = false; /* Don't copy all textures, is slow. */
|
||||
params.export_subdiv = USD_SUBDIV_TESSELLATE;
|
||||
params.evaluation_mode = DEG_get_mode(depsgraph);
|
||||
params.generate_preview_surface = !use_materialx;
|
||||
params.generate_materialx_network = use_materialx;
|
||||
|
||||
Reference in New Issue
Block a user