We (AL) have encountered an bug where we see a color shift which seems to be due to an issue with the _localTextureMap and the texture manager becoming out of sync. We have a workflow where the stage contains a geom and material in one variant and we need to switch to another variant where the geom and material do not exist, during the switching there are two important things happen:
The geom and its material will be removed from the stage, the corresponding HdVP2Material and the texture is destroyed and released as expected;
We have a custom script would run after switching to the new variant and creates a native Maya geometry and references the same texture file, which causes the MTextureManager loads and caches the texture file globally.
If we then switch back to previous variant, we can observe a color shift
This seems to be due to the fact that Maya's MTextureManager still holds a reference to the texture (and will return early), but the HdVP2TextureInfoSharedPtr object which holds the HdVP2TextureInfo _isColorSpaceSRGB info has been destroyed during the de-construction of HdVP2Material, in our case, _LoadTexture returns the texture but leaving the isSRGB and uvScaleOffset being default value which is the discrepancy we found
I have attached a code snippet, layer and jpg texture to repro this
Could you advise on the best option to fix this?
Steps to reproduce
Steps to reproduce the behavior:
Download/save the attached srgbColorChart.jpg texture and simplePlaneMaterial.usda layer
Update the rootLayer and srgbTexture path variables in the attached srgb_texture_scene_setup.py file and execute
You should observe the following color shift
USD Geom on the left, Maya poly mesh on the right
Expected behavior
We would expect no color shift to take place during variant switching / activation toggling
Describe the bug Hi there,
We (AL) have encountered an bug where we see a color shift which seems to be due to an issue with the _localTextureMap and the texture manager becoming out of sync. We have a workflow where the stage contains a geom and material in one variant and we need to switch to another variant where the geom and material do not exist, during the switching there are two important things happen:
If we then switch back to previous variant, we can observe a color shift This seems to be due to the fact that Maya's MTextureManager still holds a reference to the texture (and will return early), but the HdVP2TextureInfoSharedPtr object which holds the HdVP2TextureInfo _isColorSpaceSRGB info has been destroyed during the de-construction of HdVP2Material, in our case, _LoadTexture returns the texture but leaving the isSRGB and uvScaleOffset being default value which is the discrepancy we found I have attached a code snippet, layer and jpg texture to repro this Could you advise on the best option to fix this?
Steps to reproduce Steps to reproduce the behavior:
srgbColorChart.jpg
texture andsimplePlaneMaterial.usda
layerExpected behavior We would expect no color shift to take place during variant switching / activation toggling
Attachments
simplePlaneMaterial.usda
srgb_texture_scene_setup.py
Specs (if applicable):
Additional context Add any other context about the problem here.