UV packing

Hi
When I push “start pack” happens to exit from edit mode and appears this error.
Blender 2.78 c


@madved: I tested the addon (downloaded just now from Gumroad, packer_beta.zip) on
Blender 2.78c (blender.org compiled binary version) on
Linux 4.8.0-46-generic #49~16.04.1-Ubuntu SMP x86_64 GNU/Linux.
Blender Python version: 3.5.2 (default, Dec 1 2016, 15:44:44) [GCC 6.2.1 20161124]

Installed it from Blender user preferences -> add-ons -> install from file…

I couldn’t replicate the bug. Are you using a different Python version from standard that comes with Blender? What does the console show if you start Blender from terminal and run the addon?

You’re using Blend4Web? I’ll check it out tomorrow (got to sleep at some point) and see if I can replicate the bug with it.

@ambi console - found bundled python: /home/ss/app/blender/2.78/pythonversion 3 imported

system - OS: Ubuntu 17.04 zesty; Kernel: x86_64 Linux 4.10.0-20-generic

Excuse me, what does do the separate packer.py file? After installing the addon I replaced packer.py from addon folder with separate packer.py. Now I think it was mistakenly. I reinstalled addon, now it works.

packer.py is the first version of the addon. packer_beta.zip is the current beta version with much more features and performance.

edit: I changed packer_beta.zip to packer.zip and removed packer.py. It was quite old already.

I’ve been looking for this addon for long time! It will be very helpful in my projects, thank you!

Good to hear you’re finding it useful. Thanks. :slight_smile:

Just heads up if you’re having problems with some UV islands having nothing inside them or around them, where the algorithm chooses to fallback to its bounding box. It can leave a lot of wasted space. You can solve this by breaking such UV islands apart or redoing that particular one. In future I hope to write a better algorithm to detect these cases but for now this seems a decent workaround.

Attachments


Im stuck on 0.00% after hitting pack with default settings.
Windows 10
Ryzen 1800x
1080ti
Blender v2.78

No errors :frowning:

Hello. Can you open the python console and paste (for example http://pasteall.org/ then link it here) what it says, starting from “Starting packing…”? (Menu > Window > Toggle system console) or in Linux you have to start Blender from the terminal to see the output.

Also you can try and UV unwrap basic Suzanne (monkey head) using smart UV project and then set the addon “Island iterations” to 50. If that doesn’t work something really strange is going on.

If you are packing something with a lot of verts, it might take a lot of time to start up and looking at the console might reveal that it’s constantly scaling the UV down. Setting the start percentage to something tiny like 0.1 might reveal if this is the case.

Hi, I was trying your addon and it looks interesting. Still the result is a bit unpredictable. See in attachment.
I tried pack UVs few times and I always get different result.

Interesting is that when I pack for the first time I always get result which is placed on the left side. Then the second packing fix most of it. Still there is a lot of empty space on the right side.

Also I found that some UVs are left out of the texture dimension (1,1)

Would be cool if you can improve performance a bit more

I would like to give you few option ideas which could be helpful:

  • PACK without scaling islands
  • do not pack PINNED islands
  • PACK only selected
  • PACK in to material islands (keep uvs of same material or color together) it is useful for avoiding color bleeding in mipmaps

Still good work, looking forward to improvements :slight_smile:


That was feature request I made. In past if you packed with 50 iterations, and didn’t get good results you would have to:

  • increase number of iterations to 100
  • wait for first 50 iterations to finish, and then wait some more for new 50.
    So you basically wasted your time on waiting for first 50 iterations to finish.
    Now you can get often better result each time you press pack (I’m not sure though , if algorithm is taking into account UV area of starting layout - that may be the reason why third packing result is worse for you)

btw. I noticed Placement Order randomness usually give worse result when bigger than 0 :confused:

@stanley82: Thanks for the input.

The scaling issue outside rounding error should have been solved, unless you mean the overall scale of the island instead of their scale compared to one another. That’s kind of how the algorithm works though, it scales the UV up, then gradually “cools” as it finds places for the UV islands and places them into the set. If it doesn’t find any room, it scales everything back.

Did you try packing with randomness set to 0.0? It’s a feature that is not really necessary, in my experience, outside some very minor edge cases. The best starting point is [percentage: 1.0, heuristic: 0.0, randomness: 0.0]

CTRL+A (average island scale), CTRL+P (blender inbuilt packing) before running the addon also helps.

Also the bug where islands go over the UV area is something I haven’t been able to do since I thought I fixed that particular bug a while ago. You seem to be using the version where that should be working. If it doesn’t, posting .blend to http://pasteall.org/blend/ and linking it here is always helpful.

Packing only selected and not packing pinned islands is on the list. That and grouping same islands (for example from mirrored mesh) is what I’m working on.

Packing same materials into groups is not something that is going to happen in the near future (if at all), but having the option to pack only selected and not pack pinned should help in doing that.

Thanks.

@ambi: Thank you for quick reply

Scaling:
Real life scenario is that I want to pack UVs with customized scale. Some parts have higher, some parts have lower texel density. Then I would like to just pack it while keeping the scale I wanted.

Of course everybody has different pipeline, still I assume that users would appreciate to have JUST packing option in UV Packer :slight_smile:

Randomness:
Thanks for tip, I will try.

Selected packing, pinned, mirror…
Great news, looking forward to this.

Packing same material:

Yes, it is true that pack selected would help to make “color islands” easier.
Pack to empty space should help too :slight_smile:

@stanley82: The script should maintain the relative UV island scale and texel density. If it doesn’t, that’s a bug. Only thing it changes is the total UV scale.

I suggested using CTRL+A. That’s not really such a great idea if you want to keep the relative scale of the UV and relative texel density. :smiley:

I have found two more things.

  1. It seems that island margin doesnt work well. See picture.


  1. Would be nice to have option to set margin for UV border


Excellent work!

@stanley82: That’s probably because of the island bounding box fallback doesn’t have a margin at this point. It should at the next update. Having a border margin is the default setting, actually there is no setting to disable the border margin at UV limits, because the packer packs the dilated islands. Why the UV doesn’t have a border is because it fell back to the bounding box default that doesn’t have a margin at this point.

@MACHIN3: Thanks! :slight_smile:

@ambi: Thank you. Looking forward to update. Good work

@ambi: Greatest addon!

Is there a chance for correct packing overlapping islands?

This is the only thing that is not enough for me at the moment