Create UV Templates directly from Poser

  • @anomalaus
    No problem. I only touched Macs for documentation, when features or screen shots were slightly different than the Windows version. I do have a MacBook Pro that I bought 3 years ago for work but rarely touch it because most of my software is PC-based.

    Love the look of MacOS, but to make the switch from all the software I use would be a major investment that I surely can't afford now. 8-)

  • Loading UV from OBJ file "E:\Runtime\Geometries\Lwanmtr\DPMotors\CV1.obj"
    Counted 529422 facet edges
    Counted 14802 seam edges
    Read 759466 lines from file
    Num Verts = 266794 (266794)
    Num TVerts = 229461 (229461)
    Num Norms = 0 (0)
    Num TSets = 1044228
    Num Elems = 262724
    Num Sets = 1044228
    Num Seams = 14802
    Num Sections = 0
    Num Groups = 17
    Num Materials = 59
    CV-Int-DummyLightPlastic, UDIM=1001
    CV-Int-DummyLight, UDIM=1001
    CV-Chrome, UDIM=1001
    CV-Body-RearClipStrip, UDIM=1001
    CV-Body-FrontClipStrip, UDIM=1001
    CV-Body-Side, UDIM=1001
    CV-Int, UDIM=1001
    CV-Black, UDIM=1001
    CV-Int-Trunk, UDIM=1001
    CV-ChromeBlack, UDIM=1001
    CV-Body-Glass, UDIM=1001
    CV-Body-HoodInner, UDIM=1001
    CV-Logo-Clear, UDIM=1001
    CV-Logo-Color, UDIM=1001
    CV-BlackPlastic, UDIM=1001
    CV-Body-Mirror, UDIM=1001
    CV-Body-Light-Head, UDIM=1001
    CV-Body-Light-HLite2, UDIM=1001
    CV-Body-Light-Orange, UDIM=1001
    CV-Body-Light-Cover, UDIM=1001
    CV-Body-Light-Int, UDIM=1001
    CV-Rubber, UDIM=1001
    CV-Body-Door-WinTrim, UDIM=1001
    CV-Dash-Buttons, UDIM=1001
    CV-Dash-Vents, UDIM=1001
    CV-Dash-InstNeedle, UDIM=1001
    CV-Dash-Instrument, UDIM=1001
    CV-Dash-Main, UDIM=1001
    CV-Dash-Main-2, UDIM=1001
    CV-Dash-DK, UDIM=1001
    CV-Seat, UDIM=1001
    CV-GasTank, UDIM=1001
    CV-Body-Bottom, UDIM=1001
    CV-Body-Light-Red, UDIM=1001
    CV-Dash-Env, UDIM=1001
    CV-Dash-CDDisplay, UDIM=1001
    CV-Body, UDIM=1001
    CV-Dash-InstGlass, UDIM=1001
    CV-Tire-Lores, UDIM=1001
    CV-Tire-BrakeDisc, UDIM=1001
    CV-Tire-Hubcap, UDIM=1001
    CV-Tire-Rim, UDIM=1001
    CV-Tire-Rim-Edge, UDIM=1001
    CV-Body-TrunkChrome, UDIM=1001
    CV-Body-TrunkInner, UDIM=1001
    CV-Body-Light-BULite, UDIM=1001
    CV-Body-TrunkRubber, UDIM=1001
    CV-SColumnLever, UDIM=1001
    CV-SColumnLeverHandle, UDIM=1001
    CV-SColumnDGrey, UDIM=1001
    CV-SColumn, UDIM=1001
    CV-SWheel, UDIM=1001
    CV-SWheelButton, UDIM=1001
    CV-Int-Pedals, UDIM=1001
    CV-Int-Door, UDIM=1001
    CV-Body-Door-Inner, UDIM=1001
    CV-Int-Door2, UDIM=1001
    CV-Body-MirrorBody, UDIM=1001
    CV-Body-Door-Trim, UDIM=1001
    UV Range = ((0.0, 0.99999999), (0.0, 0.99999999))
    Traceback (most recent call last):
    File "C:\Program Files\Smith Micro\Poser Pro 2014\Runtime\Python\poserScripts\ScriptsMenu\Utility\", line 769, in <module>
    CreateUDIMUVMap( UVObj, UVName, size=templateSize )
    File "C:\Program Files\Smith Micro\Poser Pro 2014\Runtime\Python\poserScripts\ScriptsMenu\Utility\", line 473, in CreateUDIMUVMap
    font = ImageFont.truetype( 'Arial.ttf' )
    TypeError: truetype() takes at least 2 arguments (1 given)

  • That's what the script is outputting, no maps or anything.

  • @Glen85 thanks, that's the debugging I need to see. Though I'm running Windows 10 on my dual boot iMac, I see now that there is a difference in the Pillow version of the PIL libraries I had to install on macOS to fix some broken functionality with saving JPEG files from PIL. The specific difference is that the font size parameter in that "font = ImageFont.truetype( 'Arial.ttf' )" call has a default value for the font size in Pillow, but not in PIL, where it has to be explicitly stated.

    I'll send you another version of the script to fix that, when I've tested it under Windows.

    The other issue is with the CV-1 model's material naming, which the debugging output gives a good handle on. Since I had not envisioned building a full UV mapping utility, I think I can give you a useful separation of UV templates by using everything before the second hyphen '-' in the material name as a key. E.g. every material starting with 'CV-Body' will be in one UDIM map and those starting with 'CV-Int' will be in another, etc.

    This won't be a perfect solution, but until I have a GUI which will let the user choose which material to place on which UDIM region, it should give you something useful, and help me confirm it works on other systems.

  • @Glen85 nothing is ever "easy" with cross-platform support, sigh.

    Adding the font size just throws up another error "The _imagingft C module is not installed". I wonder just how much of the python installation bundled with Poser was ever tested.

    Anyway, this is just to do with fonts and not relevant to your issue, which is simply to get accurate UV templates (with or without seam guides), so I can just toggle the flag which suppresses facet numbering and the fonts are not required. The script works under Windows 10 (and 7, I hope) again, as it did previously when I posted Andy's UV template. I'll throw in some UDIM separation as I mentioned above and send you another version.

  • @Glen85 sent you a revised script link. Fingers crossed it doesn't throw any errors on your system.

    I can't see whether you mentioned you have .BMP files opened by Paint by default, as Photos (which might be Windows 10 only, I can't remember) doesn't handshake properly with PIL (Python Image Libraries).

  • Thanks a lot for the updates, I haven't checked my messages yet... my internet has been giving me hell for a few days and I don't know if it's fixed yet. Doesn't seem to be my provider, as whenever it disconnects, I can access wifi on my phone just fine. Ugh, who knows? I just might disappear for a day or so at a time, that's all. ¬_¬

  • @Glen85 waiting with breath abated to hear how it went...

  • Hmmm... well, I've done the same as usual but it seems to be stuck on loading. I don't know if that's normal and means it is actually working now, or if it's doing something else funky... >.>

  • Also, just to note, I use three different drives, generally. Drive C is my solid state, which I use for the core running of Poser, E is my secondary internal drive, which I use for my runtime and G is my external USB2.0 drive, which I save projects onto. I've done it this way for years, but I'm not sure if this might confuse the script.

  • Ooh, just got this! Not sure what bit it is, but it's a bit!

  • (To clarify, C is where this script is, as it's in the default runtime, not the runtime with my trilliabytes of V4 clothes in, lol!)

  • @Glen85 OK! Now we're making some progress.

    Yes, the script can take a long time to run, and on Windows, with Paint, it can only handshake one UV template at a time. Paint will wait until you close the first template, before handshaking to the PIL method, which completes and then continues to iterate through the loop in the script, displaying one template at a time. Unfortunately, that method doesn't open an image with a meaningful name, and the script currently doesn't output the name until the show routine returns.

    Can you post what output you got from the script on this run, so I can see whether the UDIM separation worked as expected?

  • Does that output show up after all of the maps have been sent out? This looks like the outer body one.

  • @Glen85 the script doesn't care where you put stuff, because the only thing you tell it is which object to generate a template for. If the object is in the scene, it doesn't need to go looking for files at all. If you specify a file, because there was nothing selected (or just a camera) in the scene, you've just told it the only place in which it will look.

    Just looking at the previous output you posted, given the way the script will split those 59 materials (all characters up to the second hyphen or the end of the name), I think you should get 17 or 18 templates, which is approximately the number of facet groups in the object, but there will (as the first image shows) be some overlap, as the names don't obviously equate to separate template spaces in all cases.

  • @Glen85 ooh, that's a mess.

    Yes, unfortunately Python buffers its output (unless you jump through hoops to use unbuffered output) until the script completes (or explicitly allows Poser to run some commands), so you may not get any output until you've seen all 18? of the templates. :-(

    Sorry, I think I'm seriously going to have to pull my wxFinger out and write some GUI bumph to let you choose from a list which templates you want on the same UDIM page.
    I probably could help by having a separate colour legend identifying which group is what colour, but you don't see any of that until the output gets printed.

  • @Glen85 this also leads me to the question of what the model looks like when you load it from the library? Is it correctly textured like the CV-1 promo image on Rendo shows?

    If so, I might need to see the bits of the cr2 file that refer to the textures, or a screen shot in the material room with the ImageMap node's texture chooser open. The templates being generated are absolutely nothing like the one you said was supplied with the model.

  • It loads untextured, in a drab, purple colour, until one of the materials is chosen from the library. I don't have a pic of that right now, but I have one which might make you laugh... while I was bored, I had a go at using bullet physics with the car... set the live simulation and it melted, lol! It shows the colour the car loads at, but yeah... the mesh is a bit... warped!


  • Modern art masterpiece! I shall call it... 'Hot Fuzz'! XD (I could still apply the materials, right? :P )

  • @Glen85 too much depleted uranium!

    Can you show a screen capture of a textured version? With the included Police livery?