Forum: Poser - OFFICIAL


Subject: Is there a Python fix for buggy Poser 5=>Wavefront mtl export?

Jovial opened this issue on Jul 30, 2005 ยท 4 posts


Jovial posted Sat, 30 July 2005 at 8:06 AM

Hi,

When I use Export from Poser 5 to Wavefront OBJ format
(in order to use PoseRay - because my latest scene will not render in P5!), there is a partner scene .mtl file created that seems to be written incorrectly.

If a scene had (for example) two victoria 3 figures and these had two different sets of textures applied, then the .mtl file is written with all of the material reference names for both figures as those for the last figure added.

This is probably best explained with a little example of the .mtl file:

Figure 1 uses Lovely_Body_Tex.jpg
Figure 2 uses Some_Other_Body_Tex.jpg

but the .mtl file is written with

newmtl SkinTorso:1
Ns 19
Ka 0 0 0
Kd 1 1 1
Ks 0.066667 0.066667 0.066667
map_Kd Some_Other_Body_Tex.jpg

newmtl SkinTorso:2
Ns 19
Ka 0 0 0
Kd 1 1 1
Ks 0.066667 0.066667 0.066667
map_Kd Some_Other_Body_Tex.jpg

and the same problem for all the other material zones.

So the first figure has now lost all of its texture references.

I was wondering if anyone had written a Python name mangler so that each internal material group name has (for example) the figure name or other unique id added into the name so that the export would work correctly.

I guess that this would be similar concept to the crosstalk killer but for material zone names.

Any help or suggestions greatly appreciated.

Regards,
Jovial.


Aeneas posted Sat, 30 July 2005 at 3:19 PM

http://market.renderosity.com/softgood.ez?ViewSoftgood=233 can't guarantee this is the solution, but you can ask Chris whether his texture extractor can handle this problem.

I have tried prudent planning long enough. From now I'll be mad. (Rumi)


stewer posted Sat, 30 July 2005 at 6:16 PM

Attached Link: http://www.stewreo.de/poser/scripts/exportOBJ.py

Try this one.

Jovial posted Sun, 31 July 2005 at 9:52 AM

Hi Stewer,

Thankyou very much for your help. I was getting there with a home grown python script to write the materials for my characters into a .mtl file. Your input has put the icing on the cake and I now have a complete .mtl file writing solution.

Unfortunately Poser 5 seems to be a bit mucked up internally as I cannot get the script to replicate the ordering and numbering of the materials that Poser 5 uses when it writes the wavefront .obj and .mtl files. I do not think this is a problem with the script but rather that Poser is not outputing the .mtl materials in a consistent way. There seems to be some confusion with parented props (e.g. Hair) but it is not predictable.

My research has indicated that you can now save the actual transprency map (if there is one) because Pose-Ray 3.8.11 handles these correctly. This is really useful for those transmapped eyelashes - and the like!

Now I probably need to get a Python programming book as the online documentation at Python.org is extensive but somewhat less than helpful.

Regards from Jovial.