usdz export wont include texture into usdz file

usdz export wont include texture into usdz file

mambrus
Enthusiast Enthusiast
1,081 Views
6 Replies
Message 1 of 7

usdz export wont include texture into usdz file

mambrus
Enthusiast
Enthusiast

Hello everyone,

I have this strange behaviour of my max script solution to automate usdz exports ... 

I actually create geometry and apply a material with a texture map. 

 

If I then export this object manually via export_selected and as usdz, the texture will be included in the usdz (at least this is what I see regarding the file-size of the usdz)

But if I perform this code however ... the usdz gets exported without the texture. It wont be included (regarding the filesize again)
Since the texture has around 4mb it feels obvious if the texture was included or not by just reviewing the filesize.
Whats going wrong here? Thanks in advance!

Just in case it is important to you ... the original texture map is located in a different folder (so not within this given export folder)

 

 

usdzExportParams = USDExporter.CreateOptions()

usdzExportParams.Meshes = true
usdzExportParams.Lights = false
usdzExportParams.Cameras = false
usdzExportParams.Materials = true
usdzExportParams.FileFormat = #usdz
usdzExportParams.UpAxis = #z
usdzExportParams.LogLevel = #info					
usdzExportParams.PreserveEdgeOrientation = true
usdzExportParams.Normals = #none
usdzExportParams.TimeMode = #current
logPath = "C:\\Users\\marku\\Documents\\3ds Max 2022\\export\\automated_export_log_v1.txt"
usdzExportParams.LogPath = logPath
			
-- update the UI to match these settings:
USDexporter.UIOptions = usdzExportParams

exportFilePathAndFileName = "C:\\Users\\marku\\Documents\\3ds Max 2022\\export\\automated_export_v1.usdz"

-- export current object as usdz
USDExporter.ExportFile exportFilePathAndFileName exportOptions:usdzExportParams contentSource=#selected	

 


EDIT:

As a short note: 
I made a test recently:
Part1: if I export my object manually via "export selected/as usdz/with same config as I do in my script" the usdz includes the texture
Part2: if I use my script right after this manual export and create my object + export it via script, the resulting usdz also includes the texture (as desired)
but 
Part3: if I restart 3ds max and do another export by script ... the resulting usdz wont include the texture
Maybe this tells you something about the possible problem?

0 Likes
Accepted solutions (1)
1,082 Views
6 Replies
Replies (6)
Message 2 of 7

mambrus
Enthusiast
Enthusiast

@eric.brosseau

any ideas? Thanks!

0 Likes
Message 3 of 7

mambrus
Enthusiast
Enthusiast

@julien.deboise
may I ask for your help?

 

0 Likes
Message 4 of 7

julien.deboise
Autodesk
Autodesk
Accepted solution

Hi, 

 

This issue was fixed recently but the fix is only on the private beta (which you would be welcome to jjoin!) - however, an easy work around is to set the current working directory to the directory of the file you are exporting. 

Say you are exporting to d:/tmp/test.usdz then you would do this like so :

 

python.execute("os.chdir(\"D:/tmp/\")")

 

The root of the issue is the relative paths that fail to resolve on the usd side.

 

Hope this helps.

0 Likes
Message 5 of 7

mambrus
Enthusiast
Enthusiast

Hello Julien, thanks for this background information.
EDIT: please ignore my lack of brain and the next line *smile*
(can I include python into my maxscript code? is there an equivalent to the python in maxscript?)

I realy love to join the beta - where to apply?

0 Likes
Message 6 of 7

julien.deboise
Autodesk
Autodesk
You can run python from maxscript using python.execute(), so what i posted above is actually maxscript code already.

You can apply to the 3dsmax beta here : https://feedback.autodesk.com/welcome/default.html?key=3dsMaxBetaApplication

Let me know if anything else,

Julien
0 Likes
Message 7 of 7

mambrus
Enthusiast
Enthusiast

Thank you!

0 Likes