Batch Convert MegaScan to USD using MatX for Karma

   420   5   3
User Avatar
Member
13 posts
Joined: 11月 2017
Offline
Hi,

This tool ( Download link below ) will Batch Convert your MegaScan Files to Houdini Solaris Nodes.



Once they are built you can easily export those files into a proper USD file structure with a push of a button. Among other things this includes the USD files like Payload, Material and Variants. The Solaris Nodes are based on the Component Builder and the Materials are made with MaterialX.
https://www.orbolt.com/asset/Carlo_Jongen::Megascan_USD_Builder::1.3?show_latest_approved
Edited by Carlo_Jongen - 2025年1月5日 07:23:37
User Avatar
Member
6 posts
Joined: 5月 2024
Offline
Hi Carlo,

Thanks for this awesome tool. I'm currently going through building a library of Megascan assets into lops/usd. Your timing is great for me, but I hope you release soon (I could use this immediately TBH ).

Please let us know when it's available, or pm me, or whatever it takes (if you're on patreon, etc.).

Happy New Year, and thank you again,

Bill
BillyCoopDraws
@ Meridian Design Studio
User Avatar
Member
13 posts
Joined: 11月 2017
Offline
The MegaScan USD Builder is now available via Orbolt:
https://www.orbolt.com/asset/Carlo_Jongen::Megascan_USD_Builder::1.3?show_latest_approved
Edited by Carlo_Jongen - 2025年1月3日 04:02:28
User Avatar
Member
2 posts
Joined: 7月 2022
Offline
Thanks for this. Tried to batch output but getting the following error. Any ideas?

---

Traceback (most recent call last):
File "Carlo_Jongen::Lop/Megascan_USD_Builder::1.3/batch_convert", line 1, in <module>
File "Carlo_Jongen::Lop/Megascan_USD_Builder::1.3, PythonModule", line 841, in BuildSolarisNodes
File "Carlo_Jongen::Lop/Megascan_USD_Builder::1.3, PythonModule", line 594, in GetMegaScanDict
UnboundLocalError: cannot access local variable 'PreviewSourceFile' where it is not associated with a value
User Avatar
Member
13 posts
Joined: 11月 2017
Offline
aramz
Thanks for this. Tried to batch output but getting the following error. Any ideas?

---

Traceback (most recent call last):
File "Carlo_Jongen::Lop/Megascan_USD_Builder::1.3/batch_convert", line 1, in <module>
File "Carlo_Jongen::Lop/Megascan_USD_Builder::1.3, PythonModule", line 841, in BuildSolarisNodes
File "Carlo_Jongen::Lop/Megascan_USD_Builder::1.3, PythonModule", line 594, in GetMegaScanDict
UnboundLocalError: cannot access local variable 'PreviewSourceFile' where it is not associated with a value

Make a new directory called "MegaScan_Test", copy like 5 MegaScan folders into the "MegaScan_Test" folder. Your "MegaScan_Test" folder should have for example folders like this inside:

E:/MegaScan_Test
- tree_trunk_ugggcjmla,
- wood_root_rkswd,
- Nature_Rock_vceicdsga,
- etc...

Set the MegaScan_Test directory as your Source Directory inside the HDA. Now also make a new directory and call it "MegaScan_Test_OUT" and set this directory as the Target Directory. Make sure that the "MegaScan_Test_OUT" is not inside the "MegaScan_Test" folder.
The point is to use only a few MegaScans files for debugging.  
Open the Optional Settings and push the "Save Debug File". This will save a "MegaScanDebug.json" into your source directory.
Open the "MegaScanDebug.json" and look for the line with "PreviewSourceFile": Next to this line you should see a folder structure and a preview file, for example:

"PreviewSourceFile": "E:/MEGASCAN_TEST/tree_trunk_ufwgaaifa/ufwgaaifa_Preview.png"

Check if these files actually exist. It looks like your Preview files are missing.
When you download your files from MegaScans you should not rename or remove any of the files or file structure inside. During the making of this HDA I've noticed several inconsistencies in the way MegaScan files are structured. I thought I had everything figured out but maybe you've downloaded files that are not compatible with the way my HDA works.
Try to Batch convert a few files first before you try to convert all your MegaScan files. PM or email me if this doesn't solve your problem. My email address is in the Info tab of the HDA.
Edited by Carlo_Jongen - 昨日 18:34:10
User Avatar
Member
2 posts
Joined: 7月 2022
Offline
Carlo_Jongen
aramz
Thanks for this. Tried to batch output but getting the following error. Any ideas?

---

Traceback (most recent call last):
File "Carlo_Jongen::Lop/Megascan_USD_Builder::1.3/batch_convert", line 1, in <module>
File "Carlo_Jongen::Lop/Megascan_USD_Builder::1.3, PythonModule", line 841, in BuildSolarisNodes
File "Carlo_Jongen::Lop/Megascan_USD_Builder::1.3, PythonModule", line 594, in GetMegaScanDict
UnboundLocalError: cannot access local variable 'PreviewSourceFile' where it is not associated with a value

Make a new directory called "MegaScan_Test", copy like 5 MegaScan folders into the "MegaScan_Test" folder. Your "MegaScan_Test" folder should have for example folders like this inside:

E:/MegaScan_Test
- tree_trunk_ugggcjmla,
- wood_root_rkswd,
- Nature_Rock_vceicdsga,
- etc...

Set the MegaScan_Test directory as your Source Directory inside the HDA. Now also make a new directory and call it "MegaScan_Test_OUT" and set this directory as the Target Directory. Make sure that the "MegaScan_Test_OUT" is not inside the "MegaScan_Test" folder.
The point is to use only a few MegaScans files for debugging.  
Open the Optional Settings and push the "Save Debug File". This will save a "MegaScanDebug.json" into your source directory.
Open the "MegaScanDebug.json" and look for the line with "PreviewSourceFile": Next to this line you should see a folder structure and a preview file, for example:

"PreviewSourceFile": "E:/MEGASCAN_TEST/tree_trunk_ufwgaaifa/ufwgaaifa_Preview.png"

Check if these files actually exist. It looks like your Preview files are missing.
When you download your files from MegaScans you should not rename or remove any of the files or file structure inside. During the making of this HDA I've noticed several inconsistencies in the way MegaScan files are structured. I thought I had everything figured out but maybe you've downloaded files that are not compatible with the way my HDA works.
Try to Batch convert a few files first before you try to convert all your MegaScan files. PM or email me if this doesn't solve your problem. My email address is in the Info tab of the HDA.

Thank you for the full breakdown. I had tried these steps, but this time I tried to rename the preview file. When I export from megascans via bridge, I get a preview file named simply "preview.png" - When I rename this to the id + "_Preview.png" the conversion works.

Thanks again for the amazing work!
  • Quick Links