Home Technical Talk

UV Packer IPackThat

13456719
polycounter lvl 7
Offline / Send Message
[PB]Snoelk polycounter lvl 7
Hello Folks,

the last weeks i have been working on a uv packer. I could not find a good packer that can handle very complex shapes or holes.
The packer from Headus UV Layout is very close to it, but they are cases when it can't find a good solution.

Follow on Twitter
Follow on Facebook

Demo available (Update 6.03.2015 Beta 26 Version 1.7.5544.319)
also available via automatic updater inside the previous demo version

IPackThat on Steam


It's not final and still Beta. They can be bugs and rants :)
Inside the Demo version you can't save. Its just for testing purpose and feature testing.

IPackThatDemo
IPackThatDemo ReadMe


Short feature list
- read and write of fbx, dae, dxf and obj files
- handling multi-mesh files
- handling mutiple uv
- overlapping uv islands will be treat as one uv island
- rotation can be enabled/disabled for entire packing process
- rotation steps can be choosen per uv island (0.01 to 90°)
- automatic recognition of circle like shapes (no rotation)
- automatic recognition of rectangle like shapes (only check from 0° to 180°)
- endless solution process until you stop
- 1 mutation per 10 solution processes
- shape margins in pixel
- border margins in pixel
- treating aspect 1:1 and 1:2
- area selection filter from min to max (% area of largest uv island)
- rotation step selection filter from min to max (in degrees)
- automatic backup when a better solution is found
- multi threading

are there some other feature that are usefull ?
here are some shots of the results.
The Start ones are handcrafted and dont respect the margin size (sometimes they are below 2 pixels)

Example_5_Preview.jpg

Example_2_Preview.jpg

Example_6_Preview.jpg

Example_1_Preview.jpg

Example_4_Preview.jpg

Replies

  • Luki
    Offline / Send Message
    Luki polycounter lvl 3
    Looks solid! Where I can download it? :)
  • [PB]Snoelk
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    nowhere yet ^^
    its still in beta and needs some polishing *g*
    i plan 2 more features
    - cluster groups (want to stay together)
    - merge uv islands to one cluster
  • .polygon
    Offline / Send Message
    .polygon polycounter lvl 11
    when a UV shell has a hole, it could use that space with smaller UVs pieces.
  • PeterK
    Offline / Send Message
    PeterK greentooth
    Can you add the shell bleeds feature that UVLayout has? it's pretty awesome.
  • throttlekitty
    - automatic backup when a better solution is found

    That sounds handy. How about a snapshot feature? It sounds like your app can present different iterations, so being able to quick save different steps would be nice.

    Can you lock rotation on shells? Sometimes it's good to say "I always want these shells to have this orientation".
  • Harbinger
    Offline / Send Message
    Harbinger polycounter lvl 8
    I don't know what complications there are for implementing FBX (Licensing?) but it'd be great to have a file format that supports more than one UV set so you could pack lightmaps. To expand on that, if you import a mesh with multiple UV sets, you could pack each set with different settings, or leave one of the sets untouched.
  • [PB]Snoelk
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    .polygon wrote: »
    when a UV shell has a hole, it could use that space with smaller UVs pieces.


    this is already a main feature. the packer can handle holes in all variation. It can put a shell inside a hole which also contains a hole. And in this one also some shells can be placed, which also can contains holes etc pp.


    That sounds handy. How about a snapshot feature? It sounds like your app can present different iterations, so being able to quick save different steps would be nice.

    Can you lock rotation on shells? Sometimes it's good to say "I always want these shells to have this orientation".


    mhh, will think about the snapshot feature.
    Locking of rotations can be done on each uv shell you want. You can select some shells and lock the rotation for them. Other you only allow rotation about 90°. Some others you allow rotation steps with 5°.


    Harbinger wrote: »
    I don't know what complications there are for implementing FBX (Licensing?) but it'd be great to have a file format that supports more than one UV set so you could pack lightmaps. To expand on that, if you import a mesh with multiple UV sets, you could pack each set with different settings, or leave one of the sets untouched.

    Will have a look into FBX. FBX is a open platform with different SDK's for reading and writing it. But its a large and complicated SDK when i checked it last time.
    Obj Fileformat can handle different UV layouts in some later versions. But not all can write this format.
    Multi-Meshes are treated as one UV-Layout so far. Have to think about this feature to treat each Mesh seperatly.
  • CheeseOnToast
    Offline / Send Message
    CheeseOnToast greentooth
    I get a fair bit of use from UV Layout's boxes, i.e. keeping certain islands together. For example, a bunch of teeth can be kept together so you don't need to hunt them down all over the map.
  • Quack!
    Offline / Send Message
    Quack! polycounter lvl 17
    This would be amazing if it works as presented. Very interested.

    One thing I also find annoying is that I need to find my overlapping UV's but every script/tool I have used only works sometimes. I often have to go searching around my UV map to find the extra UV's that are overlapped. With smaller objects this isn't a big deal, but for a 50k tri model, it is freaking annoying and a time killer.

    So if you can detect overlapping uv's 100% accurately AND offset them by 1 in U or V that would be very useful for baking.
  • JedTheKrampus
    Offline / Send Message
    JedTheKrampus polycounter lvl 8
    Keeping certain islands together is also useful if they both have the same type of material on the texture, because you can eliminate most of the gutter between them without having as many seam bleeding issues at lower mips.
  • Deadly Nightshade
    Offline / Send Message
    Deadly Nightshade polycounter lvl 10
    Would be handy if the user was able to group a couple shells together and that the exterior shape/bounds of said group is treated as a single shell. But maybe that´s what you meant with cluster groups?

    Either way, Im looking forward to watching the development of this tool. If it´s better than the packers that are currently available, IPackThat could easily become the most popular packing tool if you sell it for like 5 or 10 dollars or something. (Never underestimate microtransactions!!) Good luck!
  • [PB]Snoelk
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    Here a Demo of the current version. Its not final and still Beta. They can be bugs and rants :)
    Inside the Demo version you can't save. Its just for testing purpose and feature testing.

    IPackThatDemo
    IPackThatDemo ReadMe
  • [PB]Snoelk
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    Would be handy if the user was able to group a couple shells together and that the exterior shape/bounds of said group is treated as a single shell. But maybe that´s what you meant with cluster groups?

    Either way, Im looking forward to watching the development of this tool. If it´s better than the packers that are currently available, IPackThat could easily become the most popular packing tool if you sell it for like 5 or 10 dollars or something. (Never underestimate microtransactions!!) Good luck!

    thats what i mean with merging shells.
    The grouping feature is something different.
    You set 5 shells to group 1 and 5 shells to group 2.
    The Shells with group 1 will try to stay together and group 2 shells also.
    That way the shells are not spawned all over the area if the user uses grouping.
  • WarrenM
    The example shots looks really impressive! Would be happy to beta test this if you need people for that. :)

    Also, shut up and take my money...
  • Lucas Annunziata
    Offline / Send Message
    Lucas Annunziata polycounter lvl 13
    This looks great. I'll check out the demo when I get a chance.
  • WarrenM
    Oh, there's a download link ... derp ... playing with it now. Very cool!
  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Looks awesome. Ran it on a test but seemed quite slow. Wish there was a progress bar haha :)
  • [PB]Snoelk
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    Looks awesome. Ran it on a test but seemed quite slow. Wish there was a progress bar haha :)

    yeah, its not optimized yet.
    the progress bar is feature i want to implement also :)

    The packing algorithm i use wont be as fast as packing with via bounding boxes.
    So it will be always slower. But it can squeeze a bit more out of a uv.
    As a matter of fact it will be faster than packing by hand *g*
  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Would be nice to see something like texel density. Also was not able to zoom in and out with mousewheel. Not sure if that is in or not.
  • [PB]Snoelk
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    Would be nice to see something like texel density. Also was not able to zoom in and out with mousewheel. Not sure if that is in or not.

    while your a packing, you cant zoom in and out
    texeldensity per shell ? or over all shells ?
  • WarrenM
    Will it ever actually finish on it's own? I always stop it with ESC after a few minutes.
  • Stromberg90
    Offline / Send Message
    Stromberg90 polycounter lvl 11
    WarrenM: says in the feature list "endless solution process until you stop" :)

    I am experimenting with it now, really impressed with how tight it packs.
  • [PB]Snoelk
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    WarrenM wrote: »
    Will it ever actually finish on it's own? I always stop it with ESC after a few minutes.

    nope, it will run forever until you stop. i could build in a max solution find count. so if it hits the count its automaticly stopping.
    could be usefull for a later batch process where you fill in num obj files and pack them all thru.
  • WarrenM
    Could also have it do something where if it can't find a better solution in any given 30 second window it stops or something. I dunno...
  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 14
    [PB]Snoelk wrote: »
    while your a packing, you cant zoom in and out
    texeldensity per shell ? or over all shells ?

    Yeah sorry per shell. Guess it would be something you check before sending it off to be packed (assuming this is the primary goal and not something like UVlayout where you can manipulate)
  • Boonta
    Offline / Send Message
    Boonta polycounter lvl 13
    This looks great!! I love headus but this has some really nice little features and simplifications it looks like!!
  • [PB]Snoelk
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    WarrenM wrote: »
    Could also have it do something where if it can't find a better solution in any given 30 second window it stops or something. I dunno...

    run by time wont work on larger uv layouts. I think i will implement tomorrow a user max run count. If 0 it will pack as intentended until you stop.
    Yeah sorry per shell. Guess it would be something you check before sending it off to be packed (assuming this is the primary goal and not something like UVlayout where you can manipulate)

    will look into it. someone at my work wanted a text overlay over the shell with rotation steps and area size compared to max area. this info could be displayed as well. only need to think about very small uv shells.
  • Quack!
    Offline / Send Message
    Quack! polycounter lvl 17
    One usability improvement would be to have the zoom method in the canvas to zoom down to the center of your mouse instead of UV 0,0. My brain throws up when zooming around the canvas.

    Keep this up, my dollars are ready and I'll be passing it around the office.
  • [PB]Snoelk
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    Quack! wrote: »
    One usability improvement would be to have the zoom method in the canvas to zoom down to the center of your mouse instead of UV 0,0. My brain throws up when zoom around the canvas.

    Keep this up, my dollars are ready and I'll be passing it around the office.

    err this is a bug. it should zoom around mouse loc.
    will fix it for next beta release *g*
  • [PB]Snoelk
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    update uploaded
    • fixed zoom to mouse location
    • added max run count to limit the solution process to a specific count (0 value means infinit runs)
    • area filter selector has now more properties via combo box
    • fixed status bar text messages
    • changed polygon fill mode (by default clusters are green, if contain overlaps blue)
  • Stromberg90
    Offline / Send Message
    Stromberg90 polycounter lvl 11
    I let it run for 200 solutions, 10 hours+ or so.
    Best solution just under 5 percent, really impressed with it :)

    However at least on this mesh it does introduce quite a lot of overlap.
    AipVtKM.png
    geT6oYQ.png
    This is with the previous beta version, but it seems like you have not done any changes to the algorithm.

    I set the step pixel and contour merge threshold to 1.
    I can send you the mesh if you want to have a look at it.
  • Quack!
    Offline / Send Message
    Quack! polycounter lvl 17
    You have inspired me Andreas. I will set this up with my Mech's uvs to stress test it and let it run over night.
  • Stromberg90
    Offline / Send Message
    Stromberg90 polycounter lvl 11
    Cool, that mech is going to be a great test case :D
    Post it when it's done will you? ;)
  • Quack!
    Offline / Send Message
    Quack! polycounter lvl 17
  • WarrenM
    Talk to The Foundry and get this implemented in MODO stat. :P
  • Stromberg90
    Offline / Send Message
    Stromberg90 polycounter lvl 11
    Or just about any other software :D
  • kary
    Offline / Send Message
    kary polycounter lvl 18
    Exporting from max 2015 w/ the "Maya" or "Zbrush" presets gives:
    ************** Exception Text **************
    System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index (goes on quite a bit from there).

    None preset seems to work perfectly. Looks like it'd be quite a tight pack, nice.
  • [PB]Snoelk
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    I let it run for 200 solutions, 10 hours+ or so.
    Best solution just under 5 percent, really impressed with it :)

    However at least on this mesh it does introduce quite a lot of overlap.

    mhh, i think i now where the probem is. i will look in to it right now.
    You can send me the mesh if you want ^^ im happy for test stuff.
    I will send you my email via private message.

    ps: they are some chunks in your mech that are very very close to each other. this will result in merged cluster because 1 vertex of a shell is also used in a different chunk.
    kary wrote: »
    Exporting from max 2015 w/ the "Maya" or "Zbrush" presets gives:
    ************** Exception Text **************
    System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index (goes on quite a bit from there).

    None preset seems to work perfectly. Looks like it'd be quite a tight pack, nice.

    those presets got a strange obj asci layout. need to adress it.
    anyways it should not crash. thats need to be adressed as well.


    there is also a bug with stacked polygons. this i fiddled out yesterday. they are handled correctly but the area % will gone mad because they are all taken into account. but they should be taken into account only once.
    Another bug happens when you import a uv set wich is not inside range from 0 to 1.
    if the ranges of the uv set are all positiv (from 0 to 1+ in booth axis) all works out well. but if you got shells that are in the negative ranges (0 to -1) it will result in weird behavior)

    Additional i think i got a solution for real stacked polygons. the first and that one with the largest amount of vertices (if you use ngons not tris) will be stay where it is. all other polygons that are using the same vertices will be offseted to x+1.
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 14
    You know this really is super impressive. I've seen so many 'packing algorithms' that just do a barely acceptable job, but this is better than what one could do themselves almost (barring you working out some bugs). There's so many applicartions and engines that would benefit from this. Would you open-source your code?
  • Bek
    Offline / Send Message
    Bek interpolator
    Any plans to take into account an edge padding value?
  • Stromberg90
    Offline / Send Message
    Stromberg90 polycounter lvl 11
    Bek: I think it does already, correct me if I'm wrong, it takes a value called "margin size" which I think is the same.
  • Quack!
    Offline / Send Message
    Quack! polycounter lvl 17
    Bek wrote: »
    Any plans to take into account an edge padding value?

    Yep, set your margin size to half of what you want to be between the uv islands as this adds the margin value to every uv island. So if you want 8 pixels then set it to 4. You can visualize this with the display options in the upper left.
  • Quack!
    Offline / Send Message
    Quack! polycounter lvl 17
    So it looks like I manually handpacked my 4096 Mech to 85% coverage. So I let it run in IPackThat over night for 10 hours. IPackThat was able to get to 83% coverage. I would love for it to be able to get to 90% in that time. I am running another test now with a fresh restart and all programs closed to see if I can maximize the count number to get a better amount of coverage over 10 hours.

    I have some requests:

    I had my UV's offset by 1 to bake. So when I loaded up my model it placed those as separate uv islands. Is it possible to have an option to move the offset uv's back? I could do this in my 3D package of course so it may be completely unnecessary if it doesn't fit within the scope of this tool.

    I export all of my 3D files as FBX for my workflow. Is it possible to have multiple file types supported? .obj is just fine, but it would be 1 more extra file to export in my already massive sea of files. Again a picky request.

    I used a 70k tri model at 4096 with a fast computer and it was still hanging a bit with no indication it was working. If there was a bit more visual indication it was doing some work that would prevent some slight confusion/frustration.

    All in all this is potentially the best thing ever. So please keep on kicking ass.
  • [PB]Snoelk
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    Xoliul wrote: »
    You know this really is super impressive. I've seen so many 'packing algorithms' that just do a barely acceptable job, but this is better than what one could do themselves almost (barring you working out some bugs). There's so many applicartions and engines that would benefit from this. Would you open-source your code?

    let me finish the basics of the tool first and get it out *g*
    the core itself is already some sort of sdk. but they is no wrapper around it.
    that are plans for the future

    Bek wrote: »
    Any plans to take into account an edge padding value?

    edge padding = margin = padding = nudge or whatever other names they are out there.
    already taken into account ^^
    there is also a border margin for the borders of the area itself.

    Quack! wrote: »
    Yep, set your margin size to half of what you want to be between the uv islands as this adds the margin value to every uv island. So if you want 8 pixels then set it to 4. You can visualize this with the display options in the upper left.

    not quite right. the margin is the total amount in pixeln. if you set it to 8 the min distance between each shape is 8 pixel. so if you want 8 pixels around each shape you would need to set it to 16.

    Quack! wrote: »
    So it looks like I manually handpacked my 4096 Mech to 85% coverage. So I let it run in IPackThat over night for 10 hours. IPackThat was able to get to 83% coverage. I would love for it to be able to get to 90% in that time. I am running another test now with a fresh restart and all programs closed to see if I can maximize the count number to get a better amount of coverage over 10 hours.

    I have some requests:

    I had my UV's offset by 1 to bake. So when I loaded up my model it placed those as separate uv islands. Is it possible to have an option to move the offset uv's back? I could do this in my 3D package of course so it may be completely unnecessary if it doesn't fit within the scope of this tool.

    I export all of my 3D files as FBX for my workflow. Is it possible to have multiple file types supported? .obj is just fine, but it would be 1 more extra file to export in my already massive sea of files. Again a picky request.

    I used a 70k tri model at 4096 with a fast computer and it was still hanging a bit with no indication it was working. If there was a bit more visual indication it was doing some work that would prevent some slight confusion/frustration.

    All in all this is potentially the best thing ever. So please keep on kicking ass.

    im on it already with the layered polygons (only one in 0-1 all others 1-2)
    if you load an obj with uv's over 1 it will ask if you want to resize to 0-1 or remap 1+ to 0-1
    i think i could make it ready this weekend.
    fbx is somewhat new. need to read and understand the fbx sdk.
    Thats not a task you make in one hour *g*
  • Quack!
    Offline / Send Message
    Quack! polycounter lvl 17
    ~10 hours of running. Did it better then I did by handpacking.

    There are still some errors with overlapping islands getting seperated from each other though, check the upper right most part of the layout for example.

    Plus I also think it 'recognized' some shapes as circles and rotated them. The angled shape halfway down the map to the far left. It was straight up and down before with the 'hump' pointing upwards.
    ipackthatupmap.jpg
  • [PB]Snoelk
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    I have fixed the contour detection to prevent most of the overlaps.
    The detection of overlaps is also improved.
    Right now im implementing the offset handling for uv verts over x+1.

    Not sure if i can upload a new version this Weekend. Will keep ya informed ^^


    @quack jesus cries. This is a packing. When i started this tool, its Main purpose was to give a near good solution.
    I never dreamed of such results. sometimes my fuzzy logic algorithm spooks me off.
  • Gheromo
    Offline / Send Message
    Gheromo polycounter lvl 11
    wow! The results are fantastic! Cant wait to throw my money at you!
  • Dethling
    Offline / Send Message
    Dethling polycounter lvl 11
    Really nice tool.
    But did I miss something or is there no "save" option?
  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 11
    [PB]Snoelk wrote: »
    let me finish the basics of the tool first and get it out *g*
    the core itself is already some sort of sdk. but they is no wrapper around it.
    that are plans for the future


    Oooh. Having your packing algorithms integrated in PolyUnwrapper, for instance, would rock for those people that prefer to keep most tasks native to their modeling program.
  • Farfarer
    This is very cool. I agree with Laurens that some kind of API would rock... good to hear it's on the list :)
13456719
Sign In or Register to comment.