Home Technical Talk

UV Packing problems

polycounter lvl 7
Offline / Send Message
[PB]Snoelk polycounter lvl 7
got some probs with uv packing within 3dsmax.
if im scaling the uv chunks in v direction, i cant pack the uv anymore.
if im trying to, the chunks starts to rotate around.
i dont use rotate in the packing menues but they keep rotating.

is this a known bug ? are they other plugins for max that handle the uv packing better than the max one ?

Replies

  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    I had once the idea of scripting this:
    tex_tools_compress_uvlayout.gif
    so basically some line intersection collision detection between the outer edges of the shells and trying to pull all shells to the upper left corner. But I don't have time to do it anytime soon and it wouldn't be so fast as something compiled with the max SDK.

    This Guy wrote this tech:
    http://packer.3d-plugin.com/
    for 3d io a smal german game related company, he recycled the code for a zBrush plugin as well:
    http://speedy.rs/prouv/
    but the general design philosophy behind seems to be automatic stuff including flattening and defining UV shells (atleast zBrush and Unwrella the main plugin). So maybe check out just the packer plugin.
  • mLichy
    Options
    Offline / Send Message
    That plugin you linked to is interesting, but isn't good enough for production use I don't think, at least games.

    We do alot of mirroring and overlapping amoung other things that plugin doesn't account for, so then it's just as much work because of having to re-scale/move stuff how you want it.

    I don't think any script will replace a good custom UV layout. It may help, but not replace.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    I have the same opinion- I think custom guide UVlayouts are the key and an important role of uvLayouting because of readability, stack, mirror+stack, mirror tilemap (i.e DS, low poly stuff) and lots of other technical cases.

    from the official website along those many bloated marketing texts:
    UV-Packer is an UV map packing and auto-rescaling plug-in for 3dsmax. ...marketing bla bla bla... provides a fast, simple and optimal packing and auto-rescaling solution.
    auto-rescaling = normalize
    optimal packing = rotate and move uv shells compact

    so that one does just the packing, the con:
    • it does auto rotate which is often shitty if you are doing close up texel stuff like nice lined up tVerts resulting into nice pixel flow without distorted or rotated pixels. I have very often UV-layouts with shells that are not allowed to be rotated at in any non 90° snap angle.
    • costs money- and its not cheap at all for JUST packing (80 € ?, something like that I believe)
  • [PB]Snoelk
    Options
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    thats the problem. i dont want to scale or rotate those things either.
    they mainproblem i want to pack those uv shells is the texture size by texel density generating.
    so i dont know before what kind of texture size the texture is. the edgepadding on the other hand is needed.
    the packing in max itself only woks with quads. but sometimes you want a rectangle, cause the uv layout fits more with these proportions.
    a 256x1024 is a lot better than a 1024x1024.
    if the texture sizes would all be the same, we could do the uv layouts ourself.
    then we know what edgepadding in pixel we need.

    will have a look at this script
    maybe it will do the trick.
  • [PB]Snoelk
    Options
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    think i got an idea.
    when im finished with my texel denstity voodoo im creating a polygon (quad)
    this quad i add to my object with power of 2 texture.
    in uv space im stretching the new quad from u 0 to 1
    the v starts from 0 to 0,5
    then i start to pack without rotating.
    if the resulting boundig box is from 0 to 1 its a valid solution.
    now i go with the quad from 0 to 0,75 and repeat packing
    if the bounding box is now to large i step back and take the last solution

    the script fn_07__rotate_shell_compact() i use before to get sure the single uv shells are rotated correctly
  • Sastrei
    Options
    Offline / Send Message
    Sastrei polycounter lvl 11
    Blender 3D can pack UV's no issues. Obviously though, still not as good as a manual layout.

    -Stefan-
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    Sastrei wrote: »
    Blender 3D can pack UV's no issues. Obviously though, still not as good as a manual layout.

    -Stefan-
    what matters in this case however is packing at non square target layouts- so the packer algorithm has to understand what target proportions it should aim at + not scale down any elements- just movement - retargeting or scaling proportional is done later with upscaling the texture resolution as well. For now just a packer that does NOT scale, rotate and supports target non sqaure target sizes.

    Its an advanced feature Snoelk is after and so far I am not aware of any package including blender that can do that right away.
  • [PB]Snoelk
    Options
    Offline / Send Message
    [PB]Snoelk polycounter lvl 7
    got it working and works like a charme.
    will do an update of the xNormal port for 3dsmax soon

    the new uvsweeptest function will test the target power of 2 texture with different proportions agains themself and the best solution is taken.

    my 2048x2048 is 2048x1024 ^^

    it works as follows.

    i take the uv layout with the guessed texture size.
    now im creating a plane and in uv space im filling half of the uvspace with this uv plane.
    now im attaching this new plane to my object.
    start to pack and check if any vertice has left the valid space between 0 and 1.
    if not im taking this solution and do this again but this time i use the plane with 2/3 of the uv space and check again.
    when im done with this i scale down the object uv space by half and multiply my power of 2 texture by 2.
    then i test the procedure again with the the doubled texturesize.
    this i do because it could be better to get 4096x256 if possible.

    i store all hits in an array and check the 2d volume of the textures.
    i grab the first hit with the fewest volume and take this as new object to bake and delete the rest.
Sign In or Register to comment.