UV: Add option to Pack UVs using xatlas strategy #105821

Merged
Chris Blackbourn merged 7 commits from Chris_Blackbourn/blender:uv-pack-xatlas into main 2023-03-21 09:15:17 +01:00

Loosely based on the "xatlas" algorithm.
See https://github.com/jpcy/xatlas

Adds shape_method with ED_UVPACK_SHAPE_AABB, ED_UVPACK_SHAPE_CONVEX and ED_UVPACK_SHAPE_CONCAVE

Ref #68889, #105680

Loosely based on the "xatlas" algorithm. See https://github.com/jpcy/xatlas Adds `shape_method` with ED_UVPACK_SHAPE_AABB, ED_UVPACK_SHAPE_CONVEX and ED_UVPACK_SHAPE_CONCAVE Ref #68889, #105680
Chris Blackbourn added 1 commit 2023-03-16 09:21:02 +01:00
7ed2d64533 WIP: UV: Add option to Pack UVs using concave hulls with hole filling
Loosely based on the "xatlas" algorithm.
See https://github.com/jpcy/xatlas

Adds `shape_method` and ED_UVPACK_SHAPE_CONCAVE_HOLE etc.
Chris Blackbourn requested review from Brecht Van Lommel 2023-03-16 09:21:16 +01:00
Chris Blackbourn requested review from Campbell Barton 2023-03-16 09:21:26 +01:00
Author
Member

bad_packing_from_Bystedt_220920:
image

Marble fireplace:
image

suzanne_pieces:
image

NonSquare3:
image

Sweater 3D paint:
image

bad_packing_from_Bystedt_220920: ![image](/attachments/8832e7bc-053b-47a3-a2bb-467a9f4320d9) Marble fireplace: ![image](/attachments/7a4dce8f-ab1c-427e-9b8a-970fbf838dd4) suzanne_pieces: ![image](/attachments/829e9a64-e722-4ea0-baf2-d7c35534dc8c) NonSquare3: ![image](/attachments/6788937d-d8d0-4d43-8896-2fc1b7a4255e) Sweater 3D paint: ![image](/attachments/3dba0f10-584b-46ef-9670-8ea4d537286e)

Very promising.

Be sure to add license and copyright info in the code, like this:

Based on xatlas with MIT license
Copyright 2006 NVIDIA Corporation, Ignacio Castano
Copyright 2013 Thekla, Inc
Copyright 2018-2020 Jonathan Young
Very promising. Be sure to add license and copyright info in the code, like this: ``` Based on xatlas with MIT license Copyright 2006 NVIDIA Corporation, Ignacio Castano Copyright 2013 Thekla, Inc Copyright 2018-2020 Jonathan Young ```
Brecht Van Lommel refused to review 2023-03-17 11:23:15 +01:00
Brecht Van Lommel removed review request for Campbell Barton 2023-03-17 11:23:17 +01:00

Removing myself as reviewer since this is WIP and doesn't need to be in my review queue yet.

The overall approach seems fine. For this to be ready for review it would need an overview of what is still planned to be done as part of this PR, what would be done after, timing comparisons and an example with margins.

Removing myself as reviewer since this is WIP and doesn't need to be in my review queue yet. The overall approach seems fine. For this to be ready for review it would need an overview of what is still planned to be done as part of this PR, what would be done after, timing comparisons and an example with margins.
Chris Blackbourn added 1 commit 2023-03-17 22:12:09 +01:00
7911fd0ba2 Improve performance
Improve efficiency
Author
Member

Updates from second commit (7911fd0ba2)

bad_packing_from_Bystedt_220920 (<1second) :
image

UVFreeze (4 seconds) :
image

Detail from UVFreeze :
image

NonSquare3 (2 seconds) :
image

Still WIP.

Updates from second commit (7911fd0ba2) bad_packing_from_Bystedt_220920 (<1second) : ![image](/attachments/e2a79842-7d2a-429f-a5dc-cefee77455f9) UVFreeze (4 seconds) : ![image](/attachments/bc58d21c-f31e-4ea5-ba6c-5e16e5bb2904) Detail from UVFreeze : ![image](/attachments/ab31b238-990e-4ed0-a9e6-6efd2acc7429) NonSquare3 (2 seconds) : ![image](/attachments/a032f3f4-fb0b-4554-93f3-e542026f5359) Still WIP.
Chris Blackbourn added 1 commit 2023-03-18 05:44:46 +01:00
buildbot/vexp-code-patch-coordinator Build done. Details
180a55a447
Add support for convex hull.
Author
Member

Update 3 with commit 180a55a447

Add support for "Convex Hull" in addition to "Concave + Holes"

Suzanne_Pieces (modified), Convex Hull, no rotate. (1 second)
image

Detail from UVFreeze, Convex Hull, margin:0.001. (4 seconds)
image

Prototyping.blend, margin = 0.004. (2 seconds)
image

Update 3 with commit 180a55a447 Add support for "Convex Hull" in addition to "Concave + Holes" Suzanne_Pieces (modified), Convex Hull, no rotate. (1 second) ![image](/attachments/205fbfbb-bfd2-4584-97e6-59ca8f56caaa) Detail from UVFreeze, Convex Hull, margin:0.001. (4 seconds) ![image](/attachments/f4e1f543-b169-4d2e-a408-bba5185bc9a6) Prototyping.blend, margin = 0.004. (2 seconds) ![image](/attachments/394005b0-8271-4381-b9a9-20e84bd81129)
Author
Member

Is there interest in a "Package Build" at this time?

Is there interest in a "Package Build" at this time?
First-time contributor

Is there interest in a "Package Build" at this time?

Im not sure how buggy or not is it, but sooner or later we will want start the testing, as i said im not sure how functional is it to test, im not a developer so can't determinate how functional would be a build at the moment.
If it can unwrap and pack four times in a row without crash i would like to test it.

>Is there interest in a "Package Build" at this time? Im not sure how buggy or not is it, but sooner or later we will want start the testing, as i said im not sure how functional is it to test, im not a developer so can't determinate how functional would be a build at the moment. If it can unwrap and pack four times in a row without crash i would like to test it.
First-time contributor

just to clarify, are we talking about this builds, right?
image

just to clarify, are we talking about this builds, right? ![image](/attachments/bdbbf65c-557d-4172-95f5-81137b3a6240)
708 KiB
Author
Member

Very keen for crash repros.

Mostly interested in performance issues, if there are particular meshes where it takes > 10 seconds on a fast machine (or > 60 seconds on a slow one)

@blender-bot package

UV Editor > UV > Pack Islands > Shape Method >

  • Concave with hole fill
  • Convex hull

image

Very keen for crash repros. Mostly interested in performance issues, if there are particular meshes where it takes > 10 seconds on a fast machine (or > 60 seconds on a slow one) @blender-bot package UV Editor > UV > Pack Islands > Shape Method > * Concave with hole fill * Convex hull ![image](/attachments/fb542293-6063-40eb-b590-080d678b0267)
120 KiB
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR105821) when ready.
First-time contributor

great ill pick the build up to test once its done, i have a ryzen 9 3900x 12 cores but less than 4ghz per core when working all at the same time.

great ill pick the build up to test once its done, i have a ryzen 9 3900x 12 cores but less than 4ghz per core when working all at the same time.
First-time contributor

This is nuts, default cubes 2500 cubes (its a synthetic test, ill prepare a proper model later) its lagier moving those uvs than packing, its really fast in this scenario.
Is there a particular situation where the packer struggles with? different size islands, two big several small? maybe this test is fast because of alpaca?

I test pinning a few islands i imagine its not supported but it worth trying ^-^

This is nuts, default cubes 2500 cubes (its a synthetic test, ill prepare a proper model later) its lagier moving those uvs than packing, its really fast in this scenario. Is there a particular situation where the packer struggles with? different size islands, two big several small? maybe this test is fast because of alpaca? I test pinning a few islands i imagine its not supported but it worth trying ^-^
First-time contributor

5000 cubes different uv island, size keeps packing as fast as before
image

however some things start to happens (to be fair, considering the huge object count fixing a few islands by hand its not that big of a deal)
image

Ill keep testing

5000 cubes different uv island, size keeps packing as fast as before ![image](/attachments/c6da4c11-a0fa-48a4-b717-e21dd1a96a5b) however some things start to happens (to be fair, considering the huge object count fixing a few islands by hand its not that big of a deal) ![image](/attachments/00edadd6-e20a-407c-af7d-51ea55287217) Ill keep testing
First-time contributor

interesting offset pattern with islands rotated in this 5000 cube file.
image

interesting offset pattern with islands rotated in this 5000 cube file. ![image](/attachments/70ee566c-208f-4f52-83c3-26a888c7d86a)
Author
Member

Nice! Will take a proper look when I'm back on my machine later.

It might crash on geometry bombs? e.g. get a map of the world in vector format, so there's lots of polygons with high vertex count and degenerate geometry etc.

Polygons with internal holes might trip it up too?

Also UVs where the scale is wildly different. E.g. a single cube with uvs 1e8f across, and lots of dust at 1e-5f across...

Nice! Will take a proper look when I'm back on my machine later. It might crash on geometry bombs? e.g. get a map of the world in vector format, so there's lots of polygons with high vertex count and degenerate geometry etc. Polygons with internal holes might trip it up too? Also UVs where the scale is wildly different. E.g. a single cube with uvs 1e8f across, and lots of dust at 1e-5f across...
First-time contributor

I choose to go trough my work folder, personal and professional, this uvs are repacked with this patch all this models where used in commercial productions, this are not extremely heavy meshes because some are for game engines others for sub-d, sorry im not sure if i can show the models but uvs, who would know, besides this are new uvs ^-^
I have other models but have simetrical uvs and probably its far from the scope of this packer.

All these tests and a few more extreme dense and broken meshes, didn't make the build crash. . . so it may be buggie and experimental but it packed production models without crashing once.

image
image
image
image
The grey uvs on the side are mirror modifier offset, packed with no crashes even with that enable.
image
image
image

Next mission, try to make it crash :)

I choose to go trough my work folder, personal and professional, this uvs are repacked with this patch all this models where used in commercial productions, this are not extremely heavy meshes because some are for game engines others for sub-d, sorry im not sure if i can show the models but uvs, who would know, besides this are new uvs ^-^ I have other models but have simetrical uvs and probably its far from the scope of this packer. All these tests and a few more extreme dense and broken meshes, didn't make the build crash. . . so it may be buggie and experimental but it packed production models without crashing once. ![image](/attachments/b536e5e1-8a2d-4e8b-ad1a-0d4a4736f906) ![image](/attachments/1330cbbb-5d91-4745-af73-f2e58df2f382) ![image](/attachments/2c736960-7f61-4fd6-8e5e-cff629adaf0c) ![image](/attachments/2ed7560d-efb7-4b32-9657-cb368098b688) The grey uvs on the side are mirror modifier offset, packed with no crashes even with that enable. ![image](/attachments/a5f02a0a-b463-43d3-8ca5-f8858a12f21f) ![image](/attachments/ad125a3b-8d2a-47be-898d-40871b7b9779) ![image](/attachments/bf0ef7c5-6b79-461c-ab33-0472c38babe7) Next mission, try to make it crash :)
Chris Blackbourn added 1 commit 2023-03-19 04:46:44 +01:00
buildbot/vexp-code-patch-coordinator Build done. Details
e99ce8f43c
Simplify
Faster
More correct
Author
Member

Latest commit (e99ce8f43c) increases accuracy and gives us a bit of headroom for improvement for later when we want different strategies beyond alpaca and xatlas. Also fixes a couple slow cases.

Unfortunately "5000 cube uv pack test.blend" turns my machine into a laggy mess so I can't really test it :(

@blender-bot package

I think there's a still a delay on heavy meshes with a large "margin" parameter. Not sure how serious that one is at this stage.

Also setting Margin Method to "Fraction" will slow things down quite a bit.

I might nerf those cases in next commit. Unless there's any other requests, might move to code review next.

(Just as a heads up, this is only on the "Pack Islands" operator for this particular PR. I'll create additional commits for "Smart UV Project" and Geometry Nodes later...)

Any feedback before then?

Latest commit (e99ce8f43c) increases accuracy and gives us a bit of headroom for improvement for later when we want different strategies beyond alpaca and xatlas. Also fixes a couple slow cases. Unfortunately "5000 cube uv pack test.blend" turns my machine into a laggy mess so I can't really test it :( @blender-bot package I think there's a still a delay on heavy meshes with a large "margin" parameter. Not sure how serious that one is at this stage. Also setting Margin Method to "Fraction" will slow things down quite a bit. I might nerf those cases in next commit. Unless there's any other requests, might move to code review next. (Just as a heads up, this is only on the "Pack Islands" operator for this particular PR. I'll create additional commits for "Smart UV Project" and Geometry Nodes later...) Any feedback before then?
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR105821) when ready.
First-time contributor

This new build is more precise indeed (5000 cube uv pack test.blend same pack parameters margin 0.0001) also seems to be 1 second faster but i don't have a profiler and manually stooping a chronometer in the phone its not the most precise measure, four seconds top around three normally in this 5000 cube test.

Fraction margin was as you mention much slower, it was easier to time around 8 to 9 seconds, still faster than yesterdays build, the old version with Fraction as margin method was around 15 seconds.

Cpu Ryzen 9 3900x - ubuntu 22.04 lts
image
image

This new build is more precise indeed (5000 cube uv pack test.blend same pack parameters margin 0.0001) also seems to be 1 second faster but i don't have a profiler and manually stooping a chronometer in the phone its not the most precise measure, four seconds top around three normally in this 5000 cube test. Fraction margin was as you mention much slower, it was easier to time around 8 to 9 seconds, still faster than yesterdays build, the old version with Fraction as margin method was around 15 seconds. Cpu Ryzen 9 3900x - ubuntu 22.04 lts ![image](/attachments/3b9d422e-49df-4910-bfe1-95e51a884f7e) ![image](/attachments/2d4761f2-53af-46ee-9b29-1d3a8acc5585)
150 KiB
455 KiB
First-time contributor

Question:
¿why don't the little bits go to the holes like other islands?
(this question its just because curiosity, this extreme example would rarely be used in real work or at all)
image

by the way new test 5000 cubes with holes, still no crash


I was able to make it crash with an absurd scale factor as you mentioned before but the max scale factor that blender allowed me to use was 1e36
"v pack crash.blend"attached
image

Question: ¿why don't the little bits go to the holes like other islands? (this question its just because curiosity, this extreme example would rarely be used in real work or at all) ![image](/attachments/6d6c4c2c-2feb-4439-845c-1287fe58b427) by the way new test 5000 cubes with holes, still no crash --- I was able to make it crash with an absurd scale factor as you mentioned before but the max scale factor that blender allowed me to use was 1e36 "v pack crash.blend"attached ![image](/attachments/06fd8bdf-38b1-400f-a40f-b45b54d914c1)
Chris Blackbourn added this to the Modeling project 2023-03-20 00:08:32 +01:00
Author
Member

Awesome!

¿why don't the little bits go to the holes like other islands?

It's basically to move the core algorithm into a different "time Vs pack efficiency" regime, by splitting the problem into an "easy" section and a "hard section".

In a bit more detail, the core algorithm in this PR runs in time-complexity O(N^4) where N is the number of islands. By forcing N<1024, I can cut some corners and turn it into O(N^3) (*). That still leaves all the other tiny islands, so I just run the Alpaca (O(NlogN)) on them and squish them around the sides.

More long terms, there's things we can do to put all the "dust" into the interiors ("Fast!"), and other things that will improve the tiny islands ("Fast enough"). For right now though, I want to try and keep the PR simple.

(*) This is worst case performance, think something like 100,000 irregular annulus shapes, covering only a narrow band of sizes in UV space.

Awesome! > ¿why don't the little bits go to the holes like other islands? It's basically to move the core algorithm into a different "time Vs pack efficiency" regime, by splitting the problem into an "easy" section and a "hard section". In a bit more detail, the core algorithm in this PR runs in time-complexity `O(N^4)` where `N` is the number of islands. By forcing `N<1024`, I can cut some corners and turn it into `O(N^3)` (*). That still leaves all the other tiny islands, so I just run the Alpaca (O(NlogN)) on them and squish them around the sides. More long terms, there's things we can do to put all the "dust" into the interiors ("Fast!"), and other things that will improve the tiny islands ("Fast enough"). For right now though, I want to try and keep the PR simple. (*) This is worst case performance, think something like 100,000 irregular annulus shapes, covering only a narrow band of sizes in UV space.
First-time contributor

Further testing with the "5000 cubes with holes" i try subdividing the cubes four times, this raise the packing time from 3-4 seconds to 8 seconds
5000 objects - 2760000 verts - 2750000 faces - 5500000 triangles.
image

Just because i have the addon i try UVPackmaster 3.0.6 default and does a lovely tighter job but it took around 45 seconds from pressing the button to -packing done- status.
image

So 4 to 8 seconds for this patch looks really promising :)

Further testing with the "5000 cubes with holes" i try subdividing the cubes four times, this raise the packing time from 3-4 seconds to 8 seconds 5000 objects - 2760000 verts - 2750000 faces - 5500000 triangles. ![image](/attachments/a6573e0c-858e-4773-8216-666a6d69cc2e) Just because i have the addon i try UVPackmaster 3.0.6 default and does a lovely tighter job but it took around 45 seconds from pressing the button to -packing done- status. ![image](/attachments/77256ecc-5049-4e1d-9bfe-f3258e1c7a90) So 4 to 8 seconds for this patch looks really promising :)
133 KiB
699 KiB
First-time contributor

more test(its becoming a kind of hobbie) only five cubes but highly subdivided, 1638000 triangles it took around 15 seconds.

image

I was about to upload the .blend but its 40mb compressed and its five cubes with subdivision

more test(its becoming a kind of hobbie) only five cubes but highly subdivided, 1638000 triangles it took around 15 seconds. ![image](/attachments/5abdeb8c-c4b3-46a5-b761-e4ec64d74f7c) I was about to upload the .blend but its 40mb compressed and its five cubes with subdivision
230 KiB
Chris Blackbourn added 1 commit 2023-03-20 22:50:17 +01:00
Campbell Barton requested changes 2023-03-21 05:32:28 +01:00
Campbell Barton left a comment
Owner

Requesting changes although these are mostly details, overall this seems to work well - further improvements can be iterated on in the main branch.

Requesting changes although these are mostly details, overall this seems to work well - further improvements can be iterated on in the main branch.
@ -1390,6 +1390,8 @@ static void uvedit_pack_islands_multi(const Scene *scene,
selection_center[1] = (selection_min_co[1] + selection_max_co[1]) / 2.0f;
}
MemArena *arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __FILE__);

This function should also create a Heap for BLI_polyfill_beautify in addPolygon to use to avoid re-creating the Heap for every faces with >3 vertices.

This function should also create a `Heap` for `BLI_polyfill_beautify` in `addPolygon` to use to avoid re-creating the Heap for every faces with >3 vertices.
Chris_Blackbourn marked this conversation as resolved
@ -1560,2 +1585,4 @@
};
static const EnumPropertyItem pack_shape_method_items[] = {
{ED_UVPACK_SHAPE_FASTEST, "FASTEST", 0, "Fastest", "Pack as fast as possible"},

Names are a bit esoteric.

  • AABB -> "Bounding Box"
  • FASTEST ... is this needed? It seems strange to include a fastest method. Would prefer a description which notes in the description that it's fast "Bounding Box (Simple)" description can be "Use a simple method of packing for maximum performance". This could use the alpaca method always (and not bother with a lower cut-off).

CONVEX/CONCAVE - while correct I wonder if users will be able to quickly visualize the difference here. I can't think of good alternatives though. e.g. "High Quality", "High Quality (Fill Holes)"... descriptions could note about concave/convex.

Names are a bit esoteric. - AABB -> "Bounding Box" - FASTEST ... is this needed? It seems strange to include a fastest method. Would prefer a description which notes in the description that it's fast `"Bounding Box (Simple)"` description can be "Use a simple method of packing for maximum performance". This could use the `alpaca` method always (and not bother with a lower cut-off). CONVEX/CONCAVE - while correct I wonder if users will be able to quickly visualize the difference here. I can't think of good alternatives though. e.g. "High Quality", "High Quality (Fill Holes)"... descriptions could note about concave/convex.
Chris_Blackbourn marked this conversation as resolved
@ -1596,0 +1633,4 @@
RNA_def_enum(ot->srna,
"shape_method",
pack_shape_method_items,
ED_UVPACK_SHAPE_CONVEX,

Shouldn't CONCAVE_HOLE be the default? (as far as I was aware this is what users want practically all the time).

Shouldn't CONCAVE_HOLE be the default? (as far as I was aware this is what users want practically all the time).
Chris_Blackbourn marked this conversation as resolved
@ -24,1 +27,4 @@
/* Compute signed distance to a line passing through `uva` and `uvb`.
*/
static float signed_distance_to_edge(float2 probe, float2 uva, float2 uvb)

*picky* could have signed_distance_to_edge_squared(..) (both squared non-squared if both are needed) as it seems callers don't require the sqrt in some cases.

\*picky\* could have `signed_distance_to_edge_squared(..)` (both squared non-squared if both are needed) as it seems callers don't require the `sqrt` in some cases.
Chris_Blackbourn marked this conversation as resolved
@ -25,0 +83,4 @@
/* Beautify improves performance of packer. (Optional) */
Heap *heap = BLI_heap_new();
BLI_polyfill_beautify(source, vert_count, tris, arena, heap);

Does this help? I would have thought in the case of packing/rasterizing - there wouldn't be much/any advantage.

If it's needed, a brief comment explaining why would be good.

Does this help? I would have thought in the case of packing/rasterizing - there wouldn't be much/any advantage. If it's needed, a brief comment explaining why would be good.
Chris_Blackbourn marked this conversation as resolved
@ -113,0 +228,4 @@
public:
Occupancy(const float initial_scale);
void increaseScale(); /* Resize the scale of the bitmap and clear it. */

Prefer snake-case over camel case for methods.

Prefer snake-case over camel case for methods.
Chris_Blackbourn marked this conversation as resolved
@ -113,0 +330,4 @@
}
/* Iterate in opposite direction to outer search to improve witness effectiveness. */
for (int y = iy1 - 1; y >= iy0; --y) {

*picky* by convention, -- is used after values in most of Blender's code, unless the result of the addition/subtraction requires the prefix version to be used.

\*picky\* by convention, `--` is used after values in most of Blender's code, unless the result of the addition/subtraction requires the prefix version to be used.
Chris_Blackbourn marked this conversation as resolved
@ -113,0 +356,4 @@
float Occupancy::traceIsland(PackIsland *island,
const float scale,
const float margin,
const float2 uv,

pass a reference?

pass a reference?
Chris_Blackbourn marked this conversation as resolved
@ -113,0 +399,4 @@
if (extentH < 0.0f) {
return horiz;
}
float2 vert(t / occupancy.bitmap_scale_reciprocal -

const ?

`const` ?
Chris_Blackbourn marked this conversation as resolved
@ -113,0 +400,4 @@
return horiz;
}
float2 vert(t / occupancy.bitmap_scale_reciprocal -
BLI_rctf_size_x(&island->bounds_rect) * scale,

*picky* prefer brackets when mixing add/subtract with multiply/divide. Bugs caused by edits that don't take order of operations into account happen from time to time, so better avoid them entirely.

\*picky\* prefer brackets when mixing add/subtract with multiply/divide. Bugs caused by edits that don't take order of operations into account happen from time to time, so better avoid them entirely.
Chris_Blackbourn marked this conversation as resolved
@ -113,0 +467,4 @@
while (i < island_indices.size()) {
PackIsland *island = islands[island_indices[i]->index];
float2 best = find_best_fit_for_island(island, scan_line, occupancy, scale, margin);

const ?

`const` ?
Chris_Blackbourn marked this conversation as resolved
@ -113,0 +476,4 @@
scan_line++;
}
else {
scan_line += 2; /* !! (Don't change this line.) !! */

Unhelpful comment, assume it's from up-stream? If so, note that the upstream code considers this important but it's not known why it's needed. (or better, note why it's needed).

Unhelpful comment, assume it's from up-stream? If so, note that the upstream code considers this important but it's not known why it's needed. (or better, note why it's needed).
Chris_Blackbourn marked this conversation as resolved
@ -149,3 +556,3 @@
});
/* Partition island_vector, largest will go to box_pack, the rest alpaca_turbo.
/* Partition island_vector, largest will go to slow_packer, the rest alpaca_turbo.

As slow_packer isn't a named packer. Suggest default (slower) packer.

As `slow_packer` isn't a named packer. Suggest `default (slower) packer`.
Chris_Blackbourn marked this conversation as resolved
@ -155,0 +560,4 @@
int64_t alpaca_cutoff = int64_t(1024);
if (params.margin_method == ED_UVPACK_MARGIN_FRACTION) {
if (margin > 0.0f) {
alpaca_cutoff = int64_t(80);

Assign 80 to a variable and name it, explain the reasoning for using a different cutoff.

Assign 80 to a variable and name it, explain the reasoning for using a different cutoff.
Chris_Blackbourn marked this conversation as resolved
Campbell Barton requested changes 2023-03-21 05:45:12 +01:00
@ -1390,6 +1390,8 @@ static void uvedit_pack_islands_multi(const Scene *scene,
selection_center[1] = (selection_min_co[1] + selection_max_co[1]) / 2.0f;
}
MemArena *arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __FILE__);

Also use __func__ instead of __FILE__, generally more useful in allocation messages.

Also use `__func__` instead of `__FILE__`, generally more useful in allocation messages.
Chris_Blackbourn marked this conversation as resolved
Campbell Barton approved these changes 2023-03-21 05:54:11 +01:00
Campbell Barton left a comment
Owner

From discussion outside this PR, none of my requests require and extra iteration, accepting.

From discussion outside this PR, none of my requests require and extra iteration, accepting.
Chris Blackbourn added 1 commit 2023-03-21 08:53:58 +01:00
Chris Blackbourn changed title from WIP: UV: Add option to Pack UVs using concave hulls with hole filling to UV: Add option to Pack UVs using concave hulls with hole filling 2023-03-21 09:08:07 +01:00
Chris Blackbourn added 1 commit 2023-03-21 09:08:14 +01:00
Chris Blackbourn changed title from UV: Add option to Pack UVs using concave hulls with hole filling to UV: Add option to Pack UVs using xatlas strategy 2023-03-21 09:10:30 +01:00
Chris Blackbourn merged commit e0d05da826 into main 2023-03-21 09:15:17 +01:00
Chris Blackbourn deleted branch uv-pack-xatlas 2023-03-21 09:15:18 +01:00
Member

Noice!

Noice!
First-time contributor

Hello, i made few tests and suddenly i have corner case here. When rotation is turned on, algorithm rotates similar pieces to one orientation and it decreases efficiency of packing.

Tested with this free scene and the tree is an issue
2023-04-05_10-38-05.mp4

https://sketchfab.com/3d-models/camp-scene-free-download-700e1953be114f82977506a7c4664477

Hello, i made few tests and suddenly i have corner case here. When rotation is turned on, algorithm rotates similar pieces to one orientation and it decreases efficiency of packing. Tested with this free scene and the tree is an issue [2023-04-05_10-38-05.mp4](/attachments/03d647f1-bd79-4dc5-9b3b-70c188a6854e) https://sketchfab.com/3d-models/camp-scene-free-download-700e1953be114f82977506a7c4664477
Author
Member

Hello, i made few tests and suddenly i have corner case here. When rotation is turned on, algorithm rotates similar pieces to one orientation and it decreases efficiency of packing.

Heyas! The xatlas strategy is still a work-in-progress and doesn't yet fully support rotation.

I'll be commiting more improvements shortly, hopefully that will help.

> Hello, i made few tests and suddenly i have corner case here. When rotation is turned on, algorithm rotates similar pieces to one orientation and it decreases efficiency of packing. Heyas! The `xatlas` strategy is still a work-in-progress and doesn't yet fully support rotation. I'll be commiting more improvements shortly, hopefully that will help.
Author
Member

Better rotation support is in 43476e2d71

image
Suzanne_Pieces, compare with earlier version above ^^^.

... Still more improvements to come ...

Better rotation support is in 43476e2d71ce ![image](/attachments/fa1e1078-3fe7-4cec-bdeb-9a52d22339c6) Suzanne_Pieces, compare with earlier version above ^^^. ... Still more improvements to come ...
1.1 MiB
First-time contributor

Suzanne_Pieces, compare with earlier version above ^^^.
yes, better!

... Still more improvements to come ...
Excellent!

> Suzanne_Pieces, compare with earlier version above ^^^. yes, better! > ... Still more improvements to come ... Excellent!
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#105821
No description provided.