j00ey Posted October 3, 2014 Share Posted October 3, 2014 Hi Can someone tell me where I'm going wrong here...? I'm trying to learn some VEX and I'm struggling a bit. It's probably just as much the maths that's confusing me but I thought I had actually figured out how to do what I want. I'm trying to generate a curly [spiral] line from each point on my input geometry with an attribwrangle. So I've got normal and tangentu attributes going in and for each step I'm adding a certain amount of the normal vector to the position to start with for the main length of the hair. Then I'm taking the cross product of the normal and the tangentu, rotating it around the normal and adding some of that vector to the position too. I expected that that would make it spiral and it sort of does, but it's doing spirals within a bigger spiral. If you look in the top view and increase the steps to 1000 or so you'll see what I mean. I've never really understood matrices so it's probably something I'm missing there. Any pointers gratefully received... curlyHair.hipnc Quote Link to comment Share on other sites More sharing options...
Artem Smirnov Posted October 3, 2014 Share Posted October 3, 2014 Something like this? curlyHairArchi.hipnc Quote Link to comment Share on other sites More sharing options...
gui Posted October 3, 2014 Share Posted October 3, 2014 here´s a starting point... curlyHair.hipnc Quote Link to comment Share on other sites More sharing options...
j00ey Posted October 4, 2014 Author Share Posted October 4, 2014 Thanks very much Artem and Guilherme I find the whole matrix a bit confusing but having read through both of your solutions it's beginning to make more sense. I will try and rebuild it with a bit of frizz added perhaps to see if I can get the hang of it better. Do you know by any chance a good learning resource just for an intro to matrices and how to manipulate vectors with them? Thanks again. Quote Link to comment Share on other sites More sharing options...
j00ey Posted October 4, 2014 Author Share Posted October 4, 2014 Ok so I tried to rebuild this from scratch and it nearly works. I have a couple of questions though in case you have time to explain. First off, I don't get why the spiral gets tighter as it goes up. I'm adding the same amount in Y in the first step : newpos += @N*length*i*chramp("lengthperstep",u); but then somehow the rotation is increasing non linearly in magnitude as the step number increases. Secondly, I would expect the Y position to go up in multiples of the steps parameter on the attribwrangle but it doesn't. If I comment out the line adding in the spiral it does as expected. The angle I'm using as a start point, tangentu, in this case doesn't have any magnitude in y but it seems to introduce some error somehow. I hope that makes sense, I've added a couple of comments in the file to try and be clear, and I've appended a pointwrangle to calculate the y distance. Thanks in advance... curlyHair01.hipnc Quote Link to comment Share on other sites More sharing options...
Artem Smirnov Posted October 4, 2014 Share Posted October 4, 2014 You have to rotate identity matrix(i e matrix3 m = 1). When you pass your matrix to rotate func you are getting back rotated matrix and in the next step you will turn allredy incorect and error will increase each step. So you could define matrix at each step or make matix outside the loop and asign 1 to matrix at each step. As for the learning sources there are couple of video tutors by cmiVfx and this( http://workshops.cgsociety.org/courseinfo.php?id=553) course. Although I have not seen any of them Quote Link to comment Share on other sites More sharing options...
j00ey Posted October 4, 2014 Author Share Posted October 4, 2014 Ah! I see. This has been really useful. I'm not there yet but I'm starting to grasp it better now. Thanks a lot Artem 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.