Hi everyone this is my first topic in this community!
I am a maya TD and I have been developing and rigging a lot in that software , then one day a collegue showed me houdini and I had a big “woah” moment , it s amazing how you can move and manipulate data in houdini , that s why i decided to learn it.
I wanted to start with something I thought basic . Basically i would like to make a node (digital asset) that calculates normal along a curve by using the parallel frame transportation.
The best would be to have as input the curve then and as output the computed normals.
The algorithm is pretty simple and this is the c++ procedure i used in my maya nodes :
MVector currentNormal = firstUpVecV;
for ( int i = 0 ; i < numberOfSamplesV ; i++ )
{
double param = curveFn.findParamFromLength(i*subvidsSample);
MVector tan = curveFn.tangent(param , MSpace::kObject);
MPoint outPos;
curveFn.getPointAtParam(param , outPos , MSpace::kObject);
tan.normalize();
MVector cross1 = currentNormal^tan;
cross1.normalize() ;
MVector cross2 = tan^cross1;
cross2.normalize();
currentNormal = cross2 ;
normals = cross2;
}
Basically you start from a given normal and you use it to compute the next normal , then you keep in memory the normal computed and you use it for computing the next normal.
I think that might be easier with python but I really want to get it done with nodes.
What i have done so far (check the attached file please )
I start with a curve and i resample it (the number of samples is the number of normals I want to compute)
then I use a polyFrame to compute the tangents and then i go inside a vopSop :
[postimg.org]
then inside the vopsop i plug the firstUpVector (the starting normal) and the tangents in a for loop
[postimg.org]
in the end inside an if loop i start with the cross products , my problem is that if the index is 0 i use the firstUpVector as a normal then when i have recomputed the normal with a double cross product i want to keep that normal somwhere and use it for next computation . something like nromals ^ tangents
[postimg.org]
[postimg.org]
anyone have idea about to get throught that if statement? I am stuck
thanks a lot guys!
Curve normals : implement this algorithm
8481 6 4- giordiTD
- Member
- 5 posts
- Joined: 4月 2013
- Offline
- wolfwood
- Member
- 4271 posts
- Joined: 7月 2005
- Offline
- giordiTD
- Member
- 5 posts
- Joined: 4月 2013
- Offline
Wolfwood
As a side note, you can try out the PolyFrame SOP to compute tangent vectors on a curve.
Hi man thanks for your answer! well I actually used the polyFrame to compute the tangent , the thing is the tangent is way more stable normal is something different.
THis excercise is focussed on translating my knowledg from maya to houdini , and also I wanna be sure to comepute the normal manually in order to avoid flippings.
The main problem that I have here with a node based network is that I need to keep sotred somwhere the previous result of the computation I tried with connection but I ended up in a “cycle”.
- edward
- Member
- 7899 posts
- Joined: 7月 2005
- Offline
As a side note, this is similar to what the InverseKin CHOP uses for Solver Type=Follow Curve, Curve Normals = Best Guess on an object-level path. Takes the normal from the first path cv and propagates that through so that you can do full revolution twists.
BTW, I like the suggestions on the cross posted thread on odforce.
BTW, I like the suggestions on the cross posted thread on odforce.
- giordiTD
- Member
- 5 posts
- Joined: 4月 2013
- Offline
edward
As a side note, this is similar to what the InverseKin CHOP uses for Solver Type=Follow Curve, Curve Normals = Best Guess on an object-level path. Takes the normal from the first path cv and propagates that through so that you can do full revolution twists.
BTW, I like the suggestions on the cross posted thread on odforce.
thank you sir , yes that s exactly my final goal I am trying to replicate my quaternion spine (which means i need to twist along the curve) in houdini and then give it to the community as I did with a lot of custom maya nodes.
I was also thinking then to try to write a python sop that should be fairly easy 8) 8)
- giordiTD
- Member
- 5 posts
- Joined: 4月 2013
- Offline
alright I got it done ! Actually with a custom python operator!
It s free download so have fun with it!
[postimg.org]
for more information you can check here!
http://www.marcogiordanotd.com/blog/cg-general/houdini-otl-normals-on-curve [marcogiordanotd.com]
C&C appreciated
It s free download so have fun with it!
[postimg.org]
for more information you can check here!
http://www.marcogiordanotd.com/blog/cg-general/houdini-otl-normals-on-curve [marcogiordanotd.com]
C&C appreciated
- tjeeds
- Member
- 339 posts
- Joined: 8月 2007
- Offline
Nice work! The only thing I'd say is that you should promote the Attribute names to the interface, so that N and tan are not required names. As it is you have to look at the code to see what your attributes should be named. I would even lean toward making the default names ‘normal’ and tangentu' because that's what the PolyFrame spits out.
Well done though
Well done though
Jesse Erickson
Fx Animator
WDAS
Fx Animator
WDAS
-
- Quick Links