three.js icon indicating copy to clipboard operation
three.js copied to clipboard

USDZExporter: Support metalness/roughness factor and Image combination

Open optimus007 opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe. Currently in usdzExporter , the roughnessMap and metalnessMap is only exported if roughness is 1 and metalness 1. https://github.com/mrdoob/three.js/pull/22201 this was due to the limitation that usdz generated does not have support for both a factor and image .

A clear and concise description of what the problem is. On a metal ring model I exported which had roughness of 0.75 and a dark roughness map , due to the conditions above the image was skipped and the model was exported with just float inputs:roughness = 0.75 which made the usdz model very rough and inconsistent with the three js render

Describe the solution you'd like Since there have been some good updates from @sunag and @yuta-hayashi ,I was wondering if we can revisit this topic and implement a alternate solution

fiddle to Test

USD

optimus007 avatar Jun 02 '22 10:06 optimus007

I was looking for references but only found this one based on NodeGraph: Do you know some other reference too?

https://github.com/PixarAnimationStudios/USD/blob/dev/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/NodeGraphs.usda

sunag avatar Jun 07 '22 12:06 sunag

something from here might come in handy https://github.com/google/usd_from_gltf/blob/master/convert/materializer.cc

from usd_from_gltf

optimus007 avatar Jun 08 '22 06:06 optimus007

I think this is a good issue too.

sdarpeng avatar Aug 10 '22 21:08 sdarpeng

Possibly related: this example when loading AR on an iPhone uses USDZExporter to create the file for Quick Look, but we get the message "Object requires a newer version of iOS", which is Apple's lovely message meaning something went wrong parsing the USDZ. In this case, the object has a factor but no texture at all. Does anyone know if there's a way to support that in USDZ? @mrdoob @grorg.

elalish avatar Aug 17 '22 16:08 elalish

@elalish The case of zero textures and just factors like roughness:0.1 and metalness:1 should export correctly , like you said that error message can be caused due to wide variety of reasons (one silly case i remember is presence of symbols in the material names )

Made a fiddle please test it out, (the usdz file can renamed to .zip and can be opened on any os and the materials info can be checked)

optimus007 avatar Aug 25 '22 12:08 optimus007