jpcy / xatlas

Mesh parameterization / UV unwrapping library
MIT License
2.09k stars 220 forks source link

enhancement packing charts #100

Closed PerspectivesLab closed 2 years ago

PerspectivesLab commented 2 years ago

Hi there, i can see charts are arranged based on their surface: bigger charts would mean more surface in the map: https://github.com/jpcy/xatlas/blob/ec707faeac3b95e6b416076a9509718cce105b6a/source/xatlas/xatlas.cpp#L8321

while adding multiple UV meshes and packing them, i figured out that small surfaces can have bigger charts, than bigger surfaces (see picture with representation as real surface ) how could i prevent this behaviour, and that all chart can respect their proportional surfaces ? nb: i am using default parameters in the packing options. thank you

jpcy commented 2 years ago

For UV meshes, surface area and parametric area are the same, so there's no scaling by surface area done there.

If all your UV meshes are normalized (0 to 1 range), they will all be given the same proportional area in the atlas. You would need to scale each mesh UV channel by whatever the mesh scale is supposed to be.

PerspectivesLab commented 2 years ago

ok i understand UvMeshes can't make the corelation: chart->surfaceArea VS chart->parametricArea, simply because UV meshes dont have access to mesh vertices and thus can't/won't calculate the surface area.

https://github.com/jpcy/xatlas/blob/ec707faeac3b95e6b416076a9509718cce105b6a/source/xatlas/xatlas.cpp#L8258

since i have access to triangle vertices positions before adding them to the UvMesh, i will calculate the surface area and scale before adding them to the uv mesh, thx