Blender templates to convert OBJs exported from VAM into OBJs that use UDIM

Other Blender templates to convert OBJs exported from VAM into OBJs that use UDIM

zoidberg

Well-known member
Messages
115
Reactions
504
Points
93
zoidberg submitted a new resource:

Blender templates to convert OBJs exported from VAM into OBJs that use UDIM - Why do all the work when a script can do it ?

1. Unzip the File.
2. Load the blendfile/template for female or male model.
3. Import the OBJ.
4. Click on the "Run script" icon (the "Play button" icon) in the text window (the window showing
the script) titlebar to run the script.
5. Export the OBJ, but disable "Materials" in the "Geometry Export" settings on the exporter (else you get
your UVs sorted into UDIM tiles, but still split per material in Substance Painter).

Read more about this resource...
 
Hi,
Would you be willing to add a little more information on what this is for, for noobs like me who don't know what UDIM is and will be starting with Blender soon(ish)?
Just one sentence would be enough to get an idea.
Thanks 🙇‍♂️
 
Hi,
Would you be willing to add a little more information on what this is for, for noobs like me who don't know what UDIM is and will be starting with Blender soon(ish)?
Just one sentence would be enough to get an idea.
Thanks 🙇‍♂️
When you export a obj from VAM (in the "Control & Physics1" tab, on the person atom), and then try to load the exported OBJ into Substance Painter, your get this result (SP_shared_UDIM_Tile) ,where all textures share the same UDIM tile, and you can't seamlesly paint across texture borders (e.g. face to neck to torso etc.)
With the processed OBJ, you get the vertex UVs moved into different tiles, which allows to paint seamless across the texture borders in SP (see SP_UDIM_Tiled).
 

Attachments

  • SP_shared_UDIM_Tile.png
    SP_shared_UDIM_Tile.png
    665.1 KB · Views: 0
  • SP_UDIM_Tiled.png
    SP_UDIM_Tiled.png
    774.3 KB · Views: 0
Last edited:
I see.
I haven't used Substance Painter and am just starting with DAZ, Blender, etc.
Thanks, I now understand where it fits in when I reach this stage 👍
 
Would you dare maybe create a plugin to somehow export the atoms with clothes and hair? 😅
 
Would you dare maybe create a plugin to somehow export the atoms with clothes and hair? 😅
I'm sorry, but I have to dissapoint you. I don't realy know C#, and I don't know Python (only Monty Python). I literally just watched this video (
), where I picked up the "import bpy" thing, then just did the things I would to to manualy move the vertices in the UV editor, and picked up the BPY operations it shows in the Info window, copying them to the text/script window, + check what extra steps to perform, like changing the context before doing operations (e.g., when I don't use the "bpy.context.area.ui_type = 'UV'" lines, it will move the vertices in the 3D editor, not just the UV editor).
So, it's more like "I know how to record a macro" than "I can code" ... :geek:
 
Last edited:
I'm getting this: "RuntimeError: Operator bpy.ops.object.editmode_toggle.poll() failed, context is incorrect"
 
I'm getting this: "RuntimeError: Operator bpy.ops.object.editmode_toggle.poll() failed, context is incorrect"
I can only replicate this error when I try to run the script without any object in the scene.
 
I can only replicate this error when I try to run the script without any object in the scene.
Ok, so importing and just running the script without selecting the object gives me that error. But even when the script runs without error it doesn't generate the UDIM's. Exporting and opening in SP gives me only one UDIM
 
That's strange. Im using the current version of Blender (v3.3.0), and VAM 1.20.77.9 (tthough I don't think that export option in VAM changed), SP is
Substance 3D Painter, version 8.1.3 Build 1860 .
This is what it looks like for me, after loading the blendfile, then importing the OBJ. Next picture is a look at the original vertex layout in the UV editor (by using the tab-key to swap from object to editmode). Next pic shows the layout after the scipt did run (in this case, had to switch back to object mode before running the scipt). Last pic show how the OBJ exported from Blender looks when used in SP.
 

Attachments

  • Blender BPY Object loaded.png
    Blender BPY Object loaded.png
    343.7 KB · Views: 0
  • Blender BPY Object loaded (Editmode).png
    Blender BPY Object loaded (Editmode).png
    359.3 KB · Views: 0
  • Blender BPY after running script.png
    Blender BPY after running script.png
    430.6 KB · Views: 0
  • BPY processed OBJ in SP.png
    BPY processed OBJ in SP.png
    326.7 KB · Views: 0
I get a single texture. Running script gives this in console. Any ideas to what I'm doing wrong please?
 

Attachments

  • errorvam1.jpg
    errorvam1.jpg
    39 KB · Views: 0
I get a single texture. Running script gives this in console. Any ideas to what I'm doing wrong please?
my guess (since the error mentions blender 2.90), use a recent version (3.3.0)... oops, 3.3.1 now need to update ,too . If you are worried about blender plugins etc that just run with older versions: you can always download the portable version of blender, it can be found under the "macOS, Linux and other versions" selector. this lets you download a zip file, just unzip it (with its directory structure), and you can run that blender version from the directory you unziped it to. https://www.blender.org/download/
 
I get a single texture. Running script gives this in console. Any ideas to what I'm doing wrong please?
My error running older version of blender. With 3.3 I now get the UDIM tiles but after running script they are empty.
 
My error running older version of blender. With 3.3 I now get the UDIM tiles but after running script they are empty.
hmm, let me check , just downloading the recent portable 3.3.1

just tried it with v3.3.1, script runs fine for me
1665407084815.png
 
Script runs fine now. Buy how do I get this into SP. I tried importing the .obj as a resource but nothing happens. What am I doing wrong?
 
Script runs fine now. Buy how do I get this into SP. I tried importing the .obj as a resource but nothing happens. What am I doing wrong?
I tried opening a new project using the .obj and SB crashes 'invalid binary data'?
 
I tried opening a new project using the .obj and SB crashes 'invalid binary data'?
just tried it, works still fine for me. I exported the OBJ after the script did move the UVs, making sure to disable "Materials" in the OBJ export options, and then used the saved OBJ as the file to work on in SP.
1665563202922.png
 
no problem, I'm not a pro but merely a hobbyist, but this 3d stuff is pretty complex, and all these programs sure have their quirks.
I remember when I got excited when the first versions of substance painter with udim support were release, because I've see youtube tutorials showing how nice and easy it is now to paint on DAZ Genesis 8 figures..... only to be frustrated when I found out that the Genesis 2 figures VAM uses don't have udim ... :)
 
Hi, can we use this script with the skinned versions (posed) of the obj. Also when importing the obj do we need to select anything in the geometry like "keep vert order" or "split by group". I only managed to get it to work once and was wondering if I was importing the obj wrong. Thank you so much for your time :D
 
When you did run the script, and then remove the figure and load another OBJ, or even just load a OBJ, remove and load another one, it will give you an error.
1665840466965.png


Easiest way to fix this is: load the *.blend file again, so it will be reset, or: be persistent .
You will need to change the mode of the 3d viewport to "object" (press Tab when the mosue cursor is in that area), you will need to set the lower mid window back to text (press "shift F11" when the mouse cursor is in the area, so it shows the script, then click on the first line of the script, so the linenumber "1" gets highlighted red. Now the script should run.
Oh, and the only difference between the regular and the skinned OBJ is, the skinned one uses the active pose of the person atom when you exported the OBJ, the regular OBJ is allways in T-pose.
 
@zoidberg.

Thank you! Using the newer obj import did the trick. I'm only encountering one last problem where the gens texture is stretched over 2 uv tiles for the male version. Other than that everything works great!

Capture2.PNG
 
damn, you're right, just tried it with several male skins, it fails on everything that does not use the "Base male" UVs. Need to update my scripts/blendfiles with seperate files for Base male and non-Base male UVs.
 
Back
Top Bottom