问题
Hello everyone I'm trying to unzip a USDZ file, modify a texture, and then zip the USDZ file again, but it breaks.
Is there any special way to zip the file back? Even if I decompress and compress again it stops working and has different file size.
I'm using no compression and no encryption to zip the file. One thing I have noticed is that the attribute "Needed to extract" for the USDZ file is "2.0 or later" while my new zip file value is "1.0 or later". Also the files in the original USDZ zip have some extra fields I cannot read or add to my new file.
What could be happening? Any help would be appreciated.
回答1:
First Step (unzip usdz
file)
To unzip a
usdz
file in macOS Mojave use the following method (or if you don't have a Mac just use a Hackintosh):
- In Finder change the extension of
.usdz
file to.zip
. - Uncompress
.zip
file usingArchive_Utility.app
orRAR_Extractor.app
. - Open unzipped directory and change the
.png
textures of your model.
Second Step (create usdz
again)
Make sure that Xcode 10.2 is installed.
To convert a content of unzipped folder (binary
usdc
file and its textures) tousdz
file format again, use the following command inTerminal.app
:
cd ~/Desktop/Gramophone_Directory/
xcrun usdz_converter Gramophone.usdc Gramophone.usdz
-g GramophoneMesh
-color_map Gramophone_Albedo.png
-metallic_map Gramophone_Metallic.png
-roughness_map Gramophone_Roughness.png
-normal_map Gramophone_Normal.png
-ao_map Gramophone_AO.png
And here are a full list of options (type xcrun usdz_converter -h
in Terminal):
-g groupName [groupNames ...] Apply subsequent material properties to the named group(s).
-m materialName [materialNames ...] Apply subsequent material properties to the named material(s).
-h Display help.
-a Generate a .usda intermediate file. Default is .usdc.
-l Leave the intermediate .usd file in the source folder.
-v Verbose output.
-f filePath Read commands from a file.
-texCoordSet set The name of the texturemap coordinate set to use if multiple exist (no quotes).
-opacity o Floating point value 0.0...1.0
-color_default r g b a Floating point values 0.0...1.0
-normal_default r g b a Floating point values 0.0...1.0
-emissive_default r g b a Floating point values 0.0...1.0
-metallic_default r g b a Floating point values 0.0...1.0
-roughness_default r g b a Floating point values 0.0...1.0
-ao_default r g b a Floating point values 0.0...1.0
-color_map filePath
-normal_map filePath
-emissive_map filePath
-metallic_map filePath
-roughness_map filePath
-ao_map filePath
Hope this helps.
回答2:
To pack my modified USDZ file back, I used the tools provided here: https://github.com/PixarAnimationStudios/USD (usdzip) which works in Windows and Linux.
来源:https://stackoverflow.com/questions/55544185/how-to-generate-usdz-file-again-from-zip-file