Open lilike-adsk opened 6 days ago
Filed as internal issue #USD-10420
Another solution might be use an absolute node path as TextureDescriptor.texturePrim? Currently, seems a relative node path is used at https://github.com/PixarAnimationStudios/OpenUSD/blob/release/pxr/imaging/hdSt/materialNetwork.cpp#L684
Description of Issue
There's a performance optimization in HdStMaterial::Sync(), where the texture prim path is used as the hash code when HdStMaterial is already initialized (_isInitialized is true), see https://github.com/PixarAnimationStudios/OpenUSD/blob/release/pxr/imaging/hdSt/material.cpp#L159, however, this optimization can cause problem in some workflows as not like texture file path, the texture prim path can easily collide with others.
Steps to Reproduce
One problematic case we're having:
E.g., there're lots of texture prim named as
/full_color_texture
in the ALab scene, when different USD prims with materials refer to its own/full_color_texture
are put together into the scene, and the problem happens when we do "texture off" and "texture on" mode switch on the scene:HdDataSourceMaterialNetworkInterface::DeleteNodeInputConnection()
, then some prims might be drawn in a batch now as the texture inputs are disconnected.HdStMaterial::Sync(...)
, the previous batched draw prims are still not broken as now the texture prim path are all/full_color_texture
, which produces same hash code due to that perf optimization code, and the drawing result is incorrect as those prims are actually refering to different texture files.One proposal to fix is, when
_isInitialized
is true, adding another check on thatTextureDescriptor
to see if the old texture prim path is same as the current texture prim path, if yes, we can still usetexturePrim
as hash.System Information (OS, Hardware)
Windows
Package Versions
USD 24.08
Build Flags