Fix #103469: Update UV Sphere Projection with Seam support. #104847

Merged
Chris Blackbourn merged 4 commits from Chris_Blackbourn/blender:uv-sphere-seam into main 2023-03-02 00:48:47 +01:00

Also updates UV Cylinder projection in same way.

Also updates UV Cylinder projection in same way.
Campbell Barton was assigned by Chris Blackbourn 2023-02-17 02:00:14 +01:00
Chris Blackbourn added 1 commit 2023-02-17 02:00:22 +01:00
3de45c327e Fix 103469: Update UV Sphere Projection with Seam support.
Also updates UV Cylinder projection in same way.
Chris Blackbourn added 1 commit 2023-02-17 02:01:10 +01:00
Campbell Barton requested changes 2023-02-17 02:33:57 +01:00
@ -1509,1 +1512,4 @@
static const EnumPropertyItem seam_items[] = {
{SEAM_IGNORE, "IGNORE", 0, "Ignore", "Seams are ignored"},
{SEAM_RESPECT, "RESPECT", 0, "Respect", "Existing seams are respected"},

A brief explanation of what it means to use seams should be included.

A brief explanation of what it means to use seams should be included.
Author
Member

Changed to bools, comment is now:

RNA_def_boolean(ot->srna, "seam", 0, "Preserve Seams", "Separate projections by islands isolated by seams");
Changed to bools, comment is now: ``` RNA_def_boolean(ot->srna, "seam", 0, "Preserve Seams", "Separate projections by islands isolated by seams"); ```
Chris_Blackbourn marked this conversation as resolved
@ -1520,6 +1529,7 @@ static void uv_transform_properties(wmOperatorType *ot, int radius)
"Align",
"How to determine rotation around the pole");
RNA_def_enum(ot->srna, "pole", pole_items, PINCH, "Pole", "How to handle faces at the poles");
RNA_def_enum(ot->srna, "seam", seam_items, SEAM_IGNORE, "Seam", "How to handle seams");

Existing operations that support delimiting use booleans, think this could be a boolean too because even if other delimiters are added, those would be booleans too which could be toggled individually.

Existing operations that support delimiting use booleans, think this could be a boolean too because even if other delimiters are added, those would be booleans too which could be toggled individually.
Author
Member

Changed to RNA_def_boolean

Changed to `RNA_def_boolean`
@ -2797,3 +2807,3 @@
}
static void uv_sphere_project(BMFace *efa,
static void uv_sphere_project(const Scene *scene,

This implements it's own face-group detection, unless there is some reason not to - BM_mesh_calc_face_groups avoids inlining this logic.

This implements it's own face-group detection, unless there is some reason not to - `BM_mesh_calc_face_groups` avoids inlining this logic.
Author
Member

BM_mesh_calc_face_groups does not record the connectivity of the faces which are visited.

For example, a single rectangular ribbon made of many faces can wrap around a cylinder multiple times, but only produce one island. We need to know how the faces are locally connected to extend out the UVs in a consistent manner.

`BM_mesh_calc_face_groups` does not record the connectivity of the faces which are visited. For example, a single rectangular ribbon made of many faces can wrap around a cylinder multiple times, but only produce one island. We need to know how the faces are locally connected to extend out the UVs in a consistent manner.
Chris_Blackbourn marked this conversation as resolved

Functionality seems useful, but commit log and tooltips should mention what it means to use seams in the context of projections.

Functionality seems useful, but commit log and tooltips should mention what it means to use seams in the context of projections.
Chris Blackbourn added 1 commit 2023-02-17 05:20:10 +01:00
2f9dcb1378 Fix 103469: Update UV Sphere Projection with Seam support.
Fix islands

Update seam from enum to boolean.

Restore missing deselection logic with Cylinder project.
Author
Member

Fix #103469: Update UV Sphere Projection to Preserve Seams

Note: Applies to both UV Sphere Projection and UV Cylinder Projection.

Adds a new boolean option "Preserve Seams" to UV Sphere Projection.

With "Preserve Seams" active, the Sphere projection will do a greedy flood fill over the 3D topology, stopping at 3D boundaries and also stopping at edges where "Mark Seam" has been used in the 3D Viewport.

During the flood fill, each face is mapped using the spherical projection and then adjusted along the U axis so the UV map is continuous across the shared edge.

With careful seam placement, this allows for the creation of a spiral-cut-orange-peel unwrap, where a sphere can be unwrapped into a single long continuous strip, wrapping multiple times around the object.

Finally, if the flood fill process creates multiple UV Islands, they are spaced along the U axis, to prevent overlaps.

Fix #103469: Update UV Sphere Projection to Preserve Seams Note: Applies to both UV Sphere Projection and UV Cylinder Projection. Adds a new boolean option "Preserve Seams" to UV Sphere Projection. With "Preserve Seams" active, the Sphere projection will do a greedy flood fill over the 3D topology, stopping at 3D boundaries and also stopping at edges where "Mark Seam" has been used in the 3D Viewport. During the flood fill, each face is mapped using the spherical projection and then adjusted along the `U` axis so the UV map is continuous across the shared edge. With careful seam placement, this allows for the creation of a spiral-cut-orange-peel unwrap, where a sphere can be unwrapped into a single long continuous strip, wrapping multiple times around the object. Finally, if the flood fill process creates multiple UV Islands, they are spaced along the `U` axis, to prevent overlaps.
Campbell Barton was unassigned by Brecht Van Lommel 2023-02-19 14:35:59 +01:00
Brecht Van Lommel added this to the Modeling project 2023-02-20 10:40:17 +01:00
Chris Blackbourn reviewed 2023-03-01 05:30:33 +01:00
@ -1311,2 +1311,4 @@
#define FAN 1
#define SEAM_IGNORE 0
#define SEAM_RESPECT 1
Author
Member

I'll remove these two #defines, they're no longer needed.

I'll remove these two #defines, they're no longer needed.
Campbell Barton approved these changes 2023-03-01 05:45:06 +01:00
Campbell Barton left a comment
Owner

The patch should include a user-level description on how this works, some comments inline, otherwise I don't see a need for extra review iterations.

The patch should include a user-level description on how this works, some comments inline, otherwise I don't see a need for extra review iterations.
@ -2804,0 +2811,4 @@
const BMUVOffsets offsets,
const bool only_selected_uvs,
const bool use_seams,
float branch)

The way this is used as an argument and re-assigned I find a bit confusing, could call const float branch_init, then use branch for values inline.

The way this is used as an argument and re-assigned I find a bit confusing, could call `const float branch_init`, then use `branch` for values inline.
Chris_Blackbourn marked this conversation as resolved
@ -2815,0 +2818,4 @@
return max_u;
}
blender::Vector<BMFace *> consider_stack;

Is there any reason not to use a single vector (storing a Face pointer and branch value for each item)? Avoids having to keep the arrays in sync and I'd expect would read better.

Is there any reason not to use a single vector (storing a Face pointer and branch value for each item)? Avoids having to keep the arrays in sync and I'd expect would read better.
Chris_Blackbourn marked this conversation as resolved
@ -2966,0 +3103,4 @@
const bool use_seams = RNA_boolean_get(op->ptr, "seam");
if (use_seams) {
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {

BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, false); can be used here.

`BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, false);` can be used here.
Chris_Blackbourn marked this conversation as resolved
Campbell Barton changed title from Fix 103469: Update UV Sphere Projection with Seam support. to Fix #103469: Update UV Sphere Projection with Seam support. 2023-03-01 06:44:01 +01:00
Chris Blackbourn added 1 commit 2023-03-02 00:40:14 +01:00
a5338baf1e Fix #103469: Update UV Sphere Projection to Preserve Seams.
Note: Applies to both UV Sphere Projection and UV Cylinder Projection.

Adds a new boolean option "Preserve Seams" to UV Sphere Projection.

With "Preserve Seams" active, the Sphere projection will do a
greedy flood fill over the 3D topology, stopping at 3D boundaries
and also stopping at edges where "Mark Seam" has been used in the
3D Viewport.

During the flood fill, each face is mapped using the spherical
projection and then adjusted along the U axis so the UV map is
continuous across the shared edge.

With careful seam placement, this allows for the creation of a
spiral-cut-orange-peel unwrap, where a sphere can be unwrapped
into a single long continuous strip, wrapping multiple times around
the object.

Finally, if the flood fill process creates multiple UV Islands,
they are spaced along the `U` axis to prevent overlaps.
Chris Blackbourn merged commit 6b8cdd5979 into main 2023-03-02 00:48:47 +01:00
Chris Blackbourn deleted branch uv-sphere-seam 2023-03-02 00:48:47 +01:00
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
Interest: X11
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
2 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#104847
No description provided.