Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Apr 2009
Offline Last Active Dec 11 2014 02:57 PM

#4893741 D3DXUVAtlasPack wasted space

Posted by ingramb on 14 December 2011 - 12:37 AM

Upon further investigation, it seems that D3DXUVAtlasPack more or less ignores the requested atlas size, and generates the same uv space packing regardless. So what I've done is this:

1) Call D3DXUVAtlasPack with "default" square size
2) Scan the generated UVs, compute min/max
3) Scale and bias the generated UVs using the min/max, so they all map from 0-1
4) Adjust my atlas texture size, using an aspect ratio derived from the width/height of the UV space bounding rectangle
5) I can then pass this texture size and updated UVs to the texture gutter helper to actually generate my re-sampled texture

This seems to work pretty well, although I don't have a whole lot of control over the final aspect ratio. It seems that D3DXUVAtlasPack will generally create square atlases, unless there is a long thin rectangular chart somewhere. So my problem is mostly solved, although I would love to know if anyone else has any insight or information regarding UVAtlas.