Poly strips to curve/spline

   2915   11   0
User Avatar
Member
17 posts
Joined: March 2017
Offline
Hi all!
What is the best way to to turn a strip to a curve/spline? I've tried numerous methods, some worked but failed when the strip has mid points. I just want to turn a polygonal strips into a spline to generate hair new strands.

Attachments:
CurveFromStrip.png (334.3 KB)

User Avatar
Member
4516 posts
Joined: Feb. 2012
Offline
Hi,

It depends on the topology but if you have the base edge known, you could walk the side edges, gather them in an array, create midpoints for these edges and then connect them all in VEX if you wanted:



This might also give you some ideas:

Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
17 posts
Joined: March 2017
Offline
Thank you animatrix_!

Your suggestion and the video was educational. I should expand on my google search keywords.
I've spend several days trying solving my problem and I'm not really sure how to proceed.

In the image you can see one of the worst case scenarios. The hair strand is f'd up to the max! It's triangulated, points are out of order, no uv, and the normals are out of whack. How in the world am I supposed to create a new strand/curve from that?

The goal is to either reconstruct the card to quads, set proper point order, and uv's map it to 0-1. Ideally I'd like to make a curve our of the mesh for good measure and future control.

I really want to just delete those strands, and just be done, but my OCD and hunger for a challenge says otherwise. That hair strand is just one of the instance, it's part of a game dev file I cannot share, but I can isolate it and share it if anyone need's the hip file.

I thank anyone who is up for the challenge and willing to help he out.
Edited by swarmagent - Feb. 13, 2022 14:07:27

Attachments:
Screenshot_1.png (219.4 KB)

User Avatar
Member
8555 posts
Joined: July 2007
Offline
Yes, you should isolate and send the file or geo if you are expecting a solution that works for your case or a tangible solution instead of just steps


But in a nutshell you can just
- keep only border edges
- split it at corner points based on some threshold
- keep 2 longest curvers ( out of 4 that you will get)
- resample both to the same number of points
- create third with average point positions between them or just blend one of them mid way
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
731 posts
Joined: Dec. 2006
Offline
My favorite way of doing this is to convert to nurbs surface, use a carve with extract, and then convert back to polys. Not sure if this would work on your really messed up surface though.
Sean Lewkiw
CG Supervisor
Machine FX - Cinesite MTL
User Avatar
Member
17 posts
Joined: March 2017
Offline
Thank you tamte and mrCatfish.
I've tried your methods and it sparked a few new ideas, but I'm still stuck and dumb.
Also for some reason my for loop really messed up the normals (seen on my initial image). Resetting the cheche fixed it. Here is clean and insolated example of my work in progress. Also pardon all of my typos (freezing fingers) :P
Edited by swarmagent - Feb. 14, 2022 14:39:03

Attachments:
HairStrandWIP.png (823.5 KB)
Strand.bgeo (1.8 KB)
RefactorHairStirp.hipnc (106.8 KB)

User Avatar
Member
8555 posts
Joined: July 2007
Offline
here is the described method, the weak point of it is there have to be 4 corners easily identifiable, all described inside

Attachments:
ts_extract_ribbon_backbone_fix.hipnc (198.3 KB)
ts_extract_ribbon_backbone_fix.png (236.2 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
17 posts
Joined: March 2017
Offline
Thank you very much Thomas, you're godsend! I'm learning so much! If you're ever in town, drinks on me!
User Avatar
Member
8555 posts
Joined: July 2007
Offline
swarmagent
If you're ever in town, drinks on me!
and which town is that?
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
17 posts
Joined: March 2017
Offline
Sorry Thomas, I assumed my location was visible. It's Baltimore. Thank you again for your help. I'm experimenting with the annoying edge cases now.
User Avatar
Member
10 posts
Joined: March 2017
Offline
Sorry to bring this topic out but I have been given a alembic file which has come from Maya using the hair cards method.
I am trying to get splines for each hair card and I am not having any luck with any of the setups provided above.
Any idea on how I can get a spline for each polygon hair strip?
Edited by Vivimagic - Feb. 9, 2024 09:35:17

Attachments:
Screenshot 2024-02-09 142147.jpg (562.7 KB)
VladislavaHairTest.abc (1.9 MB)
VladislavaHairCards001.hip (263.6 KB)

User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
Hi Vivimagic,

you could make use of the hair cards' texture coordinates.

To project curves along the center of polystrips, maximize their UV islands and sample their world space positions to a new set of curves. Optionally, also transfer the path information from the first primitive found within each class.

// vertex wrangle
string geo_uv = geounwrap(0, 'uv');

int class = prim(0, 'class', i@primnum);
string grp = '@class==' + itoa(class); 
vector bb = relbbox(geo_uv, grp, v@uv);

v@uv = bb;

// point wrangle
// PARAMETERIZATION
float u = vertexcurveparam(0, i@vtxnum);
vector uvw = set(0.5, u, 0.0);

// POSITION
string grp = '@class==' + itoa(i@primnum);
vector pos = uvsample(1, grp, 'P', 'uv', uvw);

// PATH
int pr = findattribval(1, 'prim', 'class', i@primnum, 0);
string path = prim(1, 'path', pr);

// ATTRIBUTES
v@P = pos;
s@path = path;
Edited by Konstantin Magnus - Feb. 9, 2024 12:44:48

Attachments:
curves_from_polystrips.jpg (607.1 KB)
curves_from_polystrips.hip (127.3 KB)

https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
  • Quick Links