Create UV Templates directly from Poser



  • OK, getting close to something useful now. A python script which finds the geometry associated with the currently selected actor, or allows the user to choose a Wavefront OBJ file, if nothing is selected in the scene, and creates a new, planar mesh object from the texture vertices (UVs) of the original prop or figure. Obviously, if the prop/figure is not UVmapped, the output is degenerate (all vertices at the origin). NOTE: this is not a substitute for a proper UV Mapping application, but if the mapping has been done, this can generate objects which can be converted through rendering into usable templates.

    ***=NSFW content *** Unwrapped, naked mesh ******

    click to show

    Here's the Genesis 8 Female loaded directly into Poser from a .duf file as a static, unposable prop, with the UV templates generated from the prop. This figure very helpfully has each separate UV material offset by 1 in the U direction from the previous UV map. Saves all the messy overlap which most figures with multiple materials default to.



  • Another step. Automatic W (as in UVW) separation by material index of the V4 templates.

    0_1503900108491_Screen Shot 2017-08-28 at 3.58.28 pm.png

    Interesting to note that texture polygons spanning two materials suggest obvious instances where UV templates can be merged automatically. I'll look into that.

    Separation was done by post-processing the facet texture vertices and assigning the material index directly to a W coordinate. When the texture vertices are converted to actual vertices, that automatically becomes a Z coordinate (though Z-scaled down to fit in this image).



  • I think that this is really neat.

    However, UVMapper "Lite" is free and easy to use, at least with anything able to be converted to a Wavefront.obj file.

    It'd be really nice to find a way to add "seamguides", though. ie: Like the V4 ones and other supplied by.. uh.. "Lion" somethingorother. Sorry, can't remember the user-name.

    IOW - A UVmap with indicators where the seams actually meet between mapped groups. Generally, a color border that matches it's mate, with some lettered/numbered faces to show how they line up against each other so they can be oriented correctly. (Integrate with applying Materials to certain faces, generate font numbers to overlay over certain key bordering faces between groups?)



  • This has a promise of being very useful indeed. It is a key step in developing some funcionality like in Marvelous Designer. If the UV's are flat and true-size and seams, indeed, are known, and the 'material' making the seams can be made to shrink to zero in simulation, in principle the cloth room could do the refits I now do in MD, and the Poser geometry tools can be used to size the panels.

    BTW where did you find that script to rip the geometry out of a .duf file?



  • @morkonan UVX from Steve Cox, the original developer of UVMapper has long been obsolete and incompatible with the latest versions of MacOS (last release in 2006). That's where I come from, and why I'm far more interested in a tool available directly within Poser. If I wanted to actually UV Map things (I used to use Hexagon, but it's another zombie product abandoned in the DAZ buy-complementary-software-and-starve-it-to-death dungeon) I would take a deep breath and push my head into the gaping maw of Blender, but I can code more things and continue to be productive with Python, which would necessarily cease during the weeks it would take me to trawl through all the tutorials and plugins and undocumented key-bindings to become proficient with that in Blender. [It's right an the top of my Things To Procrastinate About list]

    Coincidentally, I was just thinking about SnowSultan's seam guides in the minutes before I saw the email informing me of your post. Yes, absolutely, the UV vertex seams, or at least their edge-polygons could certainly be colour-coded. I was also recently reminded that I'd had to delve into the Python PIL (Python Image Library) package (or its non-broken-on-MacOS derivative - Pillow) to sort out why ShaderWorks' Postwork Manager python plugin couldn't save .jpg files when I wanted to watermark my renders and post .jpg rather than .png to meet this forum's file size restrictions. PIL has drawing methods which are exactly what is required to actually render (and colour) a UV map to be saved as an image file. So that's the next step: Automate UVmap renders to images from the constructed objects. All possible without needing a GUI for customisation.

    That said, a GUI for the tool will be in the pipeline, once the core functionality is stable.

    @fverbaas Mk I eyeball, experience gained playing with .obj file formatting and DAZ's own documentation on the file formats DSON File Format Specification. .duf & .dsf are DSON files which is a JSON derivative. Python bundles JSON and gzip modules, and StackOverflow has a wealth of relevant questions and helpful examples. The bits which aren't amenable to visual inspection and decoding are their .dhdm subdivision morph files, which a DAZ developer has apologetically admitted on DAZ fora are not publicly available. (May even be encrypted, unlike Poser's .pmd files, which though binary and undocumented, have actually been decoded [Thanks @adp])



  • @morkonan said in Create UV Templates directly from Poser:

    It'd be really nice to find a way to add "seamguides", though. ie: Like the V4 ones and other supplied by.. uh.. "Lion" somethingorother. Sorry, can't remember the user-name.

    As @anomalaus pointed out, it's Snowsultan you're thinking of. That Lion something or other. ;) https://www.snowsultan.com/seam-guides/

    @anomalaus said in Create UV Templates directly from Poser:

    It's right an the top of my Things To Procrastinate About list

    I plan to steal that phrase and use it often. Just as soon as I get around to it. :)



  • @englishbob Snow sultan said he stopped making seam guides because DAZ inform him that no one wanted or needed them any more.



  • @anomalaus
    Thank you for the pointer to the definitions. Notepad++ nicely lists the content of the .dsf files. I slowly begin to understand the system.
    The ones I saw were in fact .cr2's with embedded geometry expressed in nanometre precision. UVmap and morphs are in separate (include) files.



  • Woo hoo! In spitting distance now! This version is only drawing black edges on a white background, so far.

    0_1504119393823_Screen Shot 2017-08-31 at 4.54.14 am.png

    V8 (with modesty cube, LOL) and PIL generated UV templates derived straight from the figure (well, at this stage, it's still only a static prop loaded from a .duf file).

    The PIL doco says it will open these temporary files in whatever image viewer the Python build for the OS knows about. On macOS, it's Preview.

    Next step: working out whether I have sufficient logic to colour match seams. Hmmm. I think I'm going to have to derive a list of edges from the facets and colour those edges (or more correctly their facets) which have more than one set of corresponding texture edges...

    I guess I'll have to change the drawing method from lines to actual polygons, if I want to be able to fill specific facets with a pastel version of whichever saturated colour the edges are drawn, a la SnowSultan's scheme.



  • OK, one more river (Any Aussie Crawl fans out there?)

    Here's V4 given the UDIM treatment by detecting that all materials are using the default UV tile and post-processing based on digit underscore prefixed material names assigned to separate UV tiles. All automatic, as was shading colour assignment. Not quite got around to UV seam detection yet.

    0_1504182823467_Screen Shot 2017-08-31 at 10.28.17 pm.png

    This is drawing UV polygons with a black outline and 25% saturation fill with hues equally spaced so the number of materials fills the hue gamut. Not a lot of contrast, but it didn't require user input or any fore-knowledge of the object's materials



  • @anomalaus I am not very clear as to how this would work but it would be nice to create UV maps in Poser for figures and objects, right now I export as objects and import into Cheetah 3d to see the map. It would be nice to stay in Poser. But like I said I am unclear as to how the process would work.



  • It might be because I'm not really a texturing guy, but honestly, I'm not really seeing the point of all this. I thought UV maps were usually made in the modelling program with the figure's mesh. At least, that's how it works forr me in Blender. Why would i want to do this in Poser?



  • @eclark1849 said in Create UV Templates directly from Poser:

    It might be because I'm not really a texturing guy, but honestly, I'm not really seeing the point of all this. I thought UV maps were usually made in the modelling program with the figure's mesh. At least, that's how it works forr me in Blender. Why would i want to do this in Poser?

    Texture artists would probably find it convenient being able to generate the maps from within Poser, it would save hunting for the object file in the runtime then opening it in a modeller or UV software just to generate the maps.

    but I assume that being able to generate the UV coordinates of an imported model with python is in some way allowing anomalaus to further her/his ultimate goal of getting duf models from DS into poser without the DSON plugin, which would be quite an achievement - and it's totally fascinating watching poser daz object files be dismantled ;)



  • @adi I'm not criticizing, I just didn't understand the point.



  • @anomalaus said in Create UV Templates directly from Poser:

    @morkonan UVX from Steve Cox, the original developer of UVMapper has long been obsolete and incompatible with the latest versions of MacOS (last release in 2006). That's where I come from, and why I'm far more interested in a tool available directly within Poser.

    Ah, I see!

    There are other free mappers/exporters, some that are probably fine with a Mac OS. BUT, that's not to say that what you're doing isn't valuable! I think it's pretty darn cool, really. I wouldn't have a use for it, specifically, but I have long wanted a UV export function in Poser. Considering that its almost a "dev tool" now, there's no reason why there shouldn't be one.

    Note: There are some strange practices around actually redistributing uv maps for 3D models, perhaps due to certain reconstruction possibilities. I'm not sure I understand them well, though. But, that could be a concern and why there isn't a native UV export feature in Poser. /shrug?



  • @englishbob said in Create UV Templates directly from Poser:

    @morkonan said in Create UV Templates directly from Poser:

    It'd be really nice to find a way to add "seamguides", though. ie: Like the V4 ones and other supplied by.. uh.. "Lion" somethingorother. Sorry, can't remember the user-name.

    As @anomalaus pointed out, it's Snowsultan you're thinking of. That Lion something or other. ;) https://www.snowsultan.com/seam-guides/

    Yup!

    Sorry... There's a painting of a snow leopard on my wall. So, when anyone say's "snow noun" I immediately think of some sort of snow-cat thing... Somehow, I got "lion" out of that. Aaaaand, that's probably far too much of my muddled thinking processes being revealed at once. :)

    My apologies to the wonderful Snowsultan! (Though, snow leopards are cool, too.)



  • How are things coming along with this, please? I can hardly keep my enthusiasm contained!



  • @Glen85 thanks for your enthusiasm. I have been distracted with multiple projects, working with @willdial 's Genesis3Updater code to produce a native Mac version and stuck in dual-boot hell, trying to get my iMac's windows 10 bootcamp partition updated with the latest Poser 11 so I can test python scripts on both platforms. Windows was proving a complete pain to update with only 1% free space on the 100GB Bootcamp partition I've allocated on my MacOS HD. Every app I've tried (fortunately excluding Poser 11) wants to install things on C:, so it all grinds to a halt.

    Back on the UV mapping, my first attempt at running the script under P11 on Windows gave me a black window in Photos with the message: "it appears the file was moved or renamed". GRRR. Research shows that apparently the image.show() method relies on the application associated with the default image file format used by the platform (.png on MacOS and .bmp on Windows) responding with an appropriate handshake to a /wait command from the show() method, which intends to waits until the image window is closed by the viewer app before deleting the temporary file. In Windows 10, Photos doesn't handshake, so PIL deletes the temporary .bmp file before Photos even attempts to open it. The solution appears to be to associate Paint.exe with .bmp files, which does handshake correctly. Figures!

    Anyway, TL;DR

    Here's Andy UV templated in Paint on Windows 10

    0_1506163917392_Capture201709232050.PNG



  • @Glen85 further to the Windows dual-boot saga (sorry to dump on you, I just need to vent for a bit. If your eyes haven't already rolled back in your head, just skip to the end) it's taken me weeks of frustratingly failed attempts to get windows successfully booting again after upgrading to MacOS Sierra, because I forgot that Windows won't always boot if it can't locate a pointing device, and it apparently wasn't seeing my trackpad and kept giving me SYSTEM_KERNEL_SECURITY_FAILURE or some such messages.

    Eventually I noticed the wireless mouse sitting ignored in a corner and something clicked. As soon as I'd turned it on, Windows grudgingly conceded that it might actually try to complete the boot process without endless cycles of "There appears to be a problem, so I'll just reboot for you. M'kay?" </rant>



  • Yikes! Well, thank you for the update! I don't really understand any of that, but good luck with it all! If you need a tester then let me know, but I don't understand booting, coding and all that jazz.


Log in to reply
 

Looks like your connection to Graphics Forum was lost, please wait while we try to reconnect.