MDLAsset loads texture in usdz file loaded with wrong colorspace

I have a very basic usdz file from this repo

I call loadTextures() after loading the usdz via MDLAsset. Inspecting the MDLTexture object I can tell it is assigning a colorspace of linear rgb instead of srgb although the image file in the usdz is srgb.

This causes the textures to ultimately render as over saturated.

In the code I later convert the MDLTexture to MTLTexture via MTKTextureLoader but if I set the srgb option it seems to ignore it.

This significantly impacts the usefulness of Model I/O if it can't load a simple usdz texture correctly. Am I missing something?

Thanks!

Answered by DTS Engineer in 818643022

Hi,

FWIW I can't reproduce the issue with Reality Composer Pro or the Xcode viewer.

It's unclear what's going with the transfer function (gamma vs linear) and/or jpeg support without more details.

Since this may be a defect in ModelIO or Metal, please file a bug report with the Feedback Assistant. To help expedite attach a focused sample project that demonstrates this issue.

Also of note, jpeg format doesn't support an alpha channel.

Facing the same issue. MTKTextureLoader.Option.SRGB option does not work and the loaded texture object always has _isLinearTexture=false (in my case the textures are in jpg format).

Hi,

FWIW I can't reproduce the issue with Reality Composer Pro or the Xcode viewer.

It's unclear what's going with the transfer function (gamma vs linear) and/or jpeg support without more details.

Since this may be a defect in ModelIO or Metal, please file a bug report with the Feedback Assistant. To help expedite attach a focused sample project that demonstrates this issue.

Also of note, jpeg format doesn't support an alpha channel.

Thanks for looking into it. I will file a feedback as you requested.

Regarding the xcode viewer and reality compose they display the texture just fine. Even macOS preview does.

It‘s just in a custom app using model IO (about as basic as possible) the texture colors are saturated.

Thanks again.

MDLAsset loads texture in usdz file loaded with wrong colorspace
 
 
Q