sebkaine Posted April 27, 2015 Share Posted April 27, 2015 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 Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted April 27, 2015 Share Posted April 27, 2015 (edited) You mean something like this? PS. I'm not the author of the technique. I just modified file to more current standards + rig. I stole it from Werner Ziemerink, one of the Softimage guys that you can find on odForce too. tension_map-mantragora,rigging.hip Edited April 27, 2015 by mantragora 1 Quote Link to comment Share on other sites More sharing options...
sebkaine Posted April 27, 2015 Author Share Posted April 27, 2015 that's great , i'm very close to what i need , i just need to remap correctly positive and negative value ! i'll post a hip when it will be ok ! Thanks a lot for your help Mantragora ! Quote Link to comment Share on other sites More sharing options...
sebkaine Posted April 27, 2015 Author Share Posted April 27, 2015 (edited) i post my test scene. The bad point is that we are using primitive area. maybe using edge length would be even more accurate ? I would still be curious to know how we can get the length of an edge in H if it's possible ! tension_map.hip Edited April 27, 2015 by sebkaine Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted April 27, 2015 Share Posted April 27, 2015 (edited) Maybe this will work => http://petershipkov.com/development/stretchmap/stretchmap.htm Edited April 27, 2015 by mantragora 1 Quote Link to comment Share on other sites More sharing options...
sebkaine Posted April 27, 2015 Author Share Posted April 27, 2015 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 ? Quote Link to comment Share on other sites More sharing options...
iamyog Posted April 27, 2015 Share Posted April 27, 2015 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 1 Quote Link to comment Share on other sites More sharing options...
sebkaine Posted April 27, 2015 Author Share Posted April 27, 2015 (edited) 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 April 27, 2015 by sebkaine Quote Link to comment Share on other sites More sharing options...
sebkaine Posted April 28, 2015 Author Share Posted April 28, 2015 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 Quote Link to comment Share on other sites More sharing options...
eetu Posted April 28, 2015 Share Posted April 28, 2015 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. 1 Quote Link to comment Share on other sites More sharing options...
sebkaine Posted April 28, 2015 Author Share Posted April 28, 2015 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 ? Quote Link to comment Share on other sites More sharing options...
eetu Posted April 28, 2015 Share Posted April 28, 2015 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. Quote Link to comment Share on other sites More sharing options...
sadhu Posted April 29, 2015 Share Posted April 29, 2015 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. 2 Quote Link to comment Share on other sites More sharing options...
sebkaine Posted April 29, 2015 Author Share Posted April 29, 2015 (edited) @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 April 29, 2015 by sebkaine Quote Link to comment Share on other sites More sharing options...
sebkaine Posted May 11, 2015 Author Share Posted May 11, 2015 (edited) 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 May 11, 2015 by sebkaine 6 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.