Poly strips to curve/spline

   5293   12   1
User Avatar
Member
17 posts
Joined: 3月 2017
オフライン
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
5042 posts
Joined: 2月 2012
オフライン
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] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
17 posts
Joined: 3月 2017
オフライン
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 - 2022年2月13日 14:07:27

Attachments:
Screenshot_1.png (219.4 KB)

User Avatar
Member
9252 posts
Joined: 7月 2007
オフライン
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
CG Supervisor
Framestore, NY
User Avatar
Member
738 posts
Joined: 12月 2006
オフライン
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: 3月 2017
オフライン
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 - 2022年2月14日 14:39:03

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

User Avatar
Member
9252 posts
Joined: 7月 2007
オフライン
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
CG Supervisor
Framestore, NY
User Avatar
Member
17 posts
Joined: 3月 2017
オフライン
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
9252 posts
Joined: 7月 2007
オフライン
swarmagent
If you're ever in town, drinks on me!
and which town is that?
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
17 posts
Joined: 3月 2017
オフライン
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
12 posts
Joined: 3月 2017
オフライン
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 - 2024年2月9日 09:35:17

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

Ashley Glover
http://agloverwork.portfoliobox.net [agloverwork.portfoliobox.net]
User Avatar
Member
714 posts
Joined: 9月 2013
オンライン
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 - 2024年2月9日 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]
User Avatar
Member
10 posts
Joined: 10月 2018
オフライン
Konstantin Magnus
// 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;


Does it work only with quads?
Edited by nicks_ushkevich - 2025年8月31日 09:37:50
  • Quick Links