Search - User list
Full Version: transform matrix VEX question
Root » Houdini Lounge » transform matrix VEX question
shajiwandtc
Hi,

I'm studying transform matrices these days.
wanna achieve a bend effect on some randomly transformed curve.
Instead of using the bend sop , I want to use matrix to do the trick just for VEX exercise.
(just like a curve version of poly folding effect which entagma did. Here is the link: https://vimeo.com/317927360).

Unlike the entagma way : building a matrix system and putting a bunch of matrices attribute in some parents array(I mean it's pretty brilliant and straightforward).I tried to write some VEX code in my own way. But it didn't work very well. And I can't figure out why.

I will attach the hip file down here.

Even I set the angle to 0, there is apparently some differences between the original curve and newly ‘bended’ curve.
Did I think wrong in the fist place?

Somebody please help me with may VEX.
wanna write some cool VEX to achieve some cool Houdini effects just like the other Houdini users.
any advise would help!
Tanks!
BabaJ
If you look at your normals that are being used for direction you can see the final result is as should be - meaning your code is good.

However, your ‘input’ information, in this case the Normals need to be changed.

In your ‘reverse_N’ wrangle if you remove what you have and put in the following you will get the desired output:

@N = point(geoself(), "P", @ptnum + 1) - @P;

if(@ptnum == (npoints(geoself()) - 1)) @N = @P - point(geoself(), "P", @ptnum - 1);

@N = normalize(@N);
Aizatulin
Hi,

you can define rotation matrices for each point of the curve.

You can rotate the normal around the tangent and rotate the tangent around the new normal for example.

The amount of these rotation angles can be set independently for each point.

Using a ramp is an option.

Here is a modification of your example.
shajiwandtc
BabaJ
If you look at your normals that are being used for direction you can see the final result is as should be - meaning your code is good.

However, your ‘input’ information, in this case the Normals need to be changed.

In your ‘reverse_N’ wrangle if you remove what you have and put in the following you will get the desired output:

@N = point(geoself(), "P", @ptnum + 1) - @P;

if(@ptnum == (npoints(geoself()) - 1)) @N = @P - point(geoself(), "P", @ptnum - 1);

@N = normalize(@N);


That works!Thank you so much!!

but I have another problem here.
The curve is just rotating which is respect to the root point rotation. It's not actually unfolding.
I did reset the pivot point at the end of the for loop, but I can not find any rotation of other points.
Did I miss something?
shajiwandtc
Aizatulin
Hi,

you can define rotation matrices for each point of the curve.

You can rotate the normal around the tangent and rotate the tangent around the new normal for example.

The amount of these rotation angles can be set independently for each point.

Using a ramp is an option.

Here is a modification of your example.

Thanks!
the ramp idea is brilliant!
but I don't want to get the tangent rotated, just the normals.
I mean it worked well when the input is a straight line with no tangent space.
like this:
Aizatulin
Yes in your second example you are accumulating over the dir.

To avoid confusion, imho it is better to use “tangent” for the tangents of the curve and N for the normals. Sometimes the polyframe gives strange results for straight lines, but you will find some examples with ptf (parallel transport frames), which gives you stable frames for curves.

According to my first file, here is another modification, where you can perform a bend just using the first ramp (or second aswell for torsion). After this you can apply the node again to use just the second ramp to rotate the normals.
shajiwandtc
Aizatulin
Yes in your second example you are accumulating over the dir.

To avoid confusion, imho it is better to use “tangent” for the tangents of the curve and N for the normals. Sometimes the polyframe gives strange results for straight lines, but you will find some examples with ptf (parallel transport frames), which gives you stable frames for curves.

According to my first file, here is another modification, where you can perform a bend just using the first ramp (or second aswell for torsion). After this you can apply the node again to use just the second ramp to rotate the normals.


That's exactly what I want to do!!!
Tanks for help!!
cheers!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB