Jump to content

UV's similar to Max's Unfold Strip from Loop

Recommended Posts

I've laid out UV's procedurally in Houdini with the sweep or skin sop and using arclen on the input curves, but I'm wondering if there is a solution to straighten/unwrap geometry that is generated in ways other that using a sweep or skin SOP. 

If anyone is familiar with the Unfold Strip from Loop button in 3dsMax's Unwrap UV modifier it basically takes any edge or loop input and straightens out the geometry into a strip. It's super useful for cylinders and chamfered/extruded edges. I'm wondering if there is a workflow to do something similar in Houdini. I tried messing with the new FlattenUV node and I can get something kind of close with the enable loop straightening, but the UV's are still wobbly and not perfectly straight.



Share this post

Link to post
Share on other sites

i dont think there is a straightforward way to do that right now, unfortunately. 

Share this post

Link to post
Share on other sites

Me too was looking yesterday something like this and came with my own solution that fit my needs.
Rules to work:
A. Object should be Closed Shape (Rings Like).
B. Object should have no Open Edges (be Closed like should be Thicken/Shell I mean).
C. Object should be on or around a ground space.
This rules can be improved by your needs just do some research ;) 

Need to feed with Two Seams, one edge loop horizontal seam_U second vertical edge loop seam_V.
Works on UV Flatten 3.0 (Houdini 17+ I Guess).

1. Group Create (Edges) with group name seam_U - Here, in Base Group you will later put your horizontal edge loop
2. Group Create (Edges) with group name seam_V - Here in Base Group you will later put your vertical edge loop
3. Attribute Wrange (Detail) with code:

int comparisonAxis = 0; // 0 for V seams | 1 for U seams
string _prefix = comparisonAxis ? 'U' : 'V';
string edgeGroup = 'seam_'+_prefix;
string _vertsAGroup = 'vertsA_'+_prefix;
string _vertsBGroup = 'vertsB_'+_prefix;
string _primAGroup = 'primsA_'+_prefix;
string _primBGroup = 'primsB_'+_prefix;

int edgePointPairsFlatArray[] = expandedgegroup(0, edgeGroup, 'ordered');
int edgePointPairsSize = len(edgePointPairsFlatArray);

for (int i = 0; i < edgePointPairsSize; i++){   
    int pointIndex = edgePointPairsFlatArray[i];
    int point_verts[] = pointvertices(0, pointIndex);
    int pointNextIndex = edgePointPairsFlatArray[i+1];
    vector pointPosition = point(0, 'P', pointIndex);
    vector pointPositionNext = point(0, 'P', pointNextIndex);
    vector pointCenter = (pointPosition+pointPositionNext)/(vector)2;
    int foundPrim = 0, primID_A = -1, primID_B = -1, done = 0;
    foreach (int i2; int primID; pointprims(0, pointIndex)){
        foreach (int i3; int primPointID; primpoints(0, primID)){
            if(primPointID == pointNextIndex){
                    primID_A = primID;
                } else {
                    primID_B = primID;
                    done = 1;
        if(done) {
           vector primsCenter = (prim(0,'P', primID_A)+prim(0,'P', primID_B))/(vector)2;
           vector primAPos = prim(0,'P', primID_A);
           int isLess = primAPos[comparisonAxis] < primsCenter[comparisonAxis];
           int correctPrim_A = isLess ? primID_A : primID_B;
           int correctPrim_B = isLess ? primID_B : primID_A;
            int upper_verts[] = primvertices(0, correctPrim_A);
            int lower_verts[] = primvertices(0, correctPrim_B);
            foreach (int i4; int pointVertID; point_verts){
                foreach (int i5; int pointVertID_Upper; upper_verts){
                    if(pointVertID_Upper == pointVertID){
                        setvertexgroup(0, _vertsAGroup, pointVertID, -1, 1, 'set');
                foreach (int i5; int pointVertID_Lower; lower_verts){
                    if(pointVertID_Lower == pointVertID){
                        setvertexgroup(0, _vertsBGroup, pointVertID, -1, 1, 'set');


4. Attribute Wrange (Detail) with code same as previous Step 3 but change in first line comparisonAxis from 0 to 1
5. UV Flatten:
There inside Flattening Constraints:
Add our two groups (seam_U seam_V) to Seams group
Create/Add with + button 4 Aligned Groups in section Axis-Aligned Vertex Groups
Group 0 (U Axis) select our vertsA_U
Group 1 (U Axis) select our vertsB_U
Group 2 (V Axis) select our vertsA_V
Group 3 (V Axis) select our vertsA_V
6. UV Smooth (Optional): Strength 100; Filter Quality 1
7. UV Layout
8. Group Delete (Optional): seam_U seam_V vertsA_U vertsA_V vertsB_U vertsB_V

Edited by kodbitz

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now