Jump to content

how to get edge length for tension map ?


Recommended Posts

Hi Guys !

 

I would like to know what would be the most straightforward way to compute  the edge length of a mesh in houdini

to compute a tension map beetween a rest mesh and a deform mesh.

 

Thanks for your advise.

 

Cheers

 

E

Link to comment
Share on other sites

this looks cool , but i would like to be able to understand and reproduce the process by myself if it's possible.

 

i don't know if we can access edge info in Vex.  maybe

- evaluating each connecting point to the current point

- getting the distance beetween each connected point

- average this distance

 

could give more accurate result ?

Link to comment
Share on other sites

not tested but something like that ?

int neighbournum;
vector nextp;
float currdist = 0;
int ncount = neighbourcount(0, @ptnum);

for (int i=0; i<ncount; i++) {
    neighbournum = neighbour(0, @ptnum, i);
    nextp = point(0, "P", neighbournum);
    currdist += distance(@P, nextp);
}

@Cd = currdist;

currdist to be fitted properly of course

  • Like 1
Link to comment
Share on other sites

Thanks a lot for your help Anthony i'm gonna test this tommorrow and see how it works compare to the previous solution.

 

What would be cool with tension map base on edge would be to have more options.

for exemple evaluating only tension in U direction or in V direction .

 

Because in certain case some edge are extremely stretch in U but very compress in V and thus it compensate volume.

So at the end by using primitive area you ended with a not very stretch primitive which is not accurate enough.

 

Maybe by using a rest pose i could be able to modify your code to be able to isolate

neighbour that go along U and those that go along V. That could work,especially that i am evaluating cloth sheets with clean topo.

 

But it would be cool if a VEX expert could confirm if it is possible or not to evaluate edge length with a simple vex command.

Edited by sebkaine
Link to comment
Share on other sites

i have test with edge length average value, but the result are very close to the primitive area methods.

so it doen't bring any precision.

 

but i think that with the edge method and some extra work it could be possible to sort U / V edge and get tension

- along U

- along V

- along UV

seperatly.

tension_map_edge.hip

Link to comment
Share on other sites

i have test with edge length average value, but the result are very close to the primitive area methods.

 

You should store the rest edge lengths in an attribute and then determine the tension from the combined absolute differences in edge lengths.

  • Like 1
Link to comment
Share on other sites

thanks a lot for your help eetu !

 

i am not sure i have perfectly understand what you mean :

- i already store the average rest length in the @edge_rest is that ok ?

- "combined absolute difference" is not crystal sharp in my mind ?  :)

Link to comment
Share on other sites

Ok, maybe it was unwarranted, but it sounded like you had problems with edge compressions canceling out edge stretches - and that sounds like you are accumulating the negative differences (compression) with positive differences (stretch) together. In that case you should add the absolute differences, so they don't cancel out. You need to both save the edge lengths and do the comparisons separately for each edge, and not do it after you have averaged the edge lengths together.

 

In iamyogs code it could look something like

 

for (int i=0; i<ncount; i++) {
    neighbournum = neighbour(0, @ptnum, i);
    nextp = point(0, "P", neighbournum);
    currdist += abs(distance(@P, nextp) - @edge_rest);
}

 

You might even want to accumulate the negative and positive differences in separate attributes, so you can handle compression and stretching separately down the line.

Link to comment
Share on other sites

http://www.sidefx.com/docs/houdini14.0/nodes/sop/convertline

 

May be this node will be of some use. 

 

Convert Line surface node

Converts the input geometry into line segments.

Unlike the Convert SOP, this node will not copy the unconverted geometry. Primitive attributes and groups are not preserved.

This replaces the incoming primitives with two-point line segments. Each segment connects any point connected in the source.

Note

Two points will only be connected by a single segment, regardless of the number of connections in the source.

Parameters Compute Length

Computes the length of each resulting line segment and stores it in the given attribute.

 

  • Like 2
Link to comment
Share on other sites

@eetu

Thanks for precision ! :)

 

well i have divided the stretch and the compression as 2 separate things stretch is display as blue , compression as red.

for compression i did use the absolute value. but i could have done mistakes anyway.

 

@Sandeep

Thanks for the links ! i have never use this convert line node , but it's very interesting , i 'm gonna try to see if it open new possibilities.

 

 

I have implement a U / V stretch implementation. it looks to work , but if you find any error in the code i would be glad to see your corrections !

 

cheers

 

E

tension_map_uv.hip

Edited by sebkaine
Link to comment
Share on other sites

  • 2 weeks later...

Well i have the time to put some more love into this .

 

Here is a Hip with tension map node with

- UV, U, V stretch map

- RG / Luminance map

- Smooth map

 

It's pretty complete now, but if you have any idea to enhance it feel free to share ! :)

 

Cheers

 

E

tension_map_uv_ok.hip

Edited by sebkaine
  • Like 6
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...