can someone explain why twisting happens over only z-axis?

   2148   6   0
User Avatar
Member
40 posts
Joined: Oct. 2018
Offline
Hi guys.

back with another questions, people here are really helpfull with explaining stuff so here i go.

i'm following a tutorial, the guy said its done for unity at the end, explaining that unity uses the z-axis as forward (something like that)figured out unreal uses the x-axis for this (hope i'm still right until this point)

so instead of building in the z-axis direction, i'm building in x-axis direction.

at this point everything worked fine.
i made 2 points, 1 in the center and one in the positive x direction.
copied and centered 2 lines on the points. at this point my lines are twisting around their own axis.

it took me a few hours to figure out why it was doing it for my project, and not in the tutorial project file.

so this only happens when pulling the point over the x axis, it keeps twisting more the higher i go.

……

so i had this sort of genius moment while writing this and fixed it myself

but still gona make a post about it because i have some question left and its not clear for me why this happens.

i had this same problem when copying a object on a line, at every point it started twisting more, so someone gave me this nice code to fix it with attrib wrangle node:

int nn = neighbour(0,@ptnum,1);
vector xx = normalize(point(0,“P”,nn)-@P);
vector yy = normalize(cross(@N,xx));
xx = normalize(cross(@N,yy));
v@xx = xx;
v@up = yy;

now i did this again and it looked better already, pointing the line i copy to points in the Y-axis fixed it and now it works fine.

so cheers for me to fix it myself lol.

but can someone please explain me WHY this happens?

- why does this not happen of the Z-axis (and maybe Y-axis?)
- why does it happen over the X-axis?
- what does the code do to fix this?
- why can i use a line object placed on the y-axis as a horizontal object all of the sudden with this code and why when i change the axis to X or Z they don't keep their horizontal place.

sorry for allot of questions but i'm trying to figure out for a while now why this twisting is happening sometimes so i can understand and know where to look.

sorry if things are not really clear in my way of writing. and if u have a link with info about this, its fine to. dont mind reading.

thanks in advance for reading and answering.
User Avatar
Member
34 posts
Joined: Sept. 2013
Offline
pande
Hi guys.

back with another questions, people here are really helpfull with explaining stuff so here i go.

i'm following a tutorial, the guy said its done for unity at the end, explaining that unity uses the z-axis as forward (something like that)figured out unreal uses the x-axis for this (hope i'm still right until this point)

so instead of building in the z-axis direction, i'm building in x-axis direction.

at this point everything worked fine.
i made 2 points, 1 in the center and one in the positive x direction.
copied and centered 2 lines on the points. at this point my lines are twisting around their own axis.

it took me a few hours to figure out why it was doing it for my project, and not in the tutorial project file.

so this only happens when pulling the point over the x axis, it keeps twisting more the higher i go.

……

so i had this sort of genius moment while writing this and fixed it myself

but still gona make a post about it because i have some question left and its not clear for me why this happens.

i had this same problem when copying a object on a line, at every point it started twisting more, so someone gave me this nice code to fix it with attrib wrangle node:

int nn = neighbour(0,@ptnum,1);
vector xx = normalize(point(0,“P”,nn)-@P);
vector yy = normalize(cross(@N,xx));
xx = normalize(cross(@N,yy));
v@xx = xx;
v@up = yy;

now i did this again and it looked better already, pointing the line i copy to points in the Y-axis fixed it and now it works fine.

so cheers for me to fix it myself lol.

but can someone please explain me WHY this happens?

- why does this not happen of the Z-axis (and maybe Y-axis?)
- why does it happen over the X-axis?
- what does the code do to fix this?
- why can i use a line object placed on the y-axis as a horizontal object all of the sudden with this code and why when i change the axis to X or Z they don't keep their horizontal place.

sorry for allot of questions but i'm trying to figure out for a while now why this twisting is happening sometimes so i can understand and know where to look.

sorry if things are not really clear in my way of writing. and if u have a link with info about this, its fine to. dont mind reading.

thanks in advance for reading and answering.
your question is not clear to me.How about posting a scene file?
User Avatar
Member
40 posts
Joined: Oct. 2018
Offline
so did my best lol..

here is the example file.

so the left tree the lines are twisting, the right tree everything looks fine. output nodes are blue.

now if you check the transform node (both colored red), the left tree one is transforming the point over the X-axis, the lines get twisted.

on the right tree, its exactly the same setup but the point is transformed over the z-axis. the lines wont twist.

first i tought i made a mistake somewhere. then figuring out when i transform them both in the same way, it happens with both tree's. so then i figured out it only happened on the x-axis and not on z-axis.

i really want to know why this is. is it a setting in the nodes i missed somewhere? or is this standard “natural” thing or something that is working as intended? well.. all questions above hehe.
Edited by pande - Nov. 3, 2018 09:12:02

Attachments:
whythishappens.hipnc (447.1 KB)

User Avatar
Member
40 posts
Joined: Oct. 2018
Offline
anyone ?
User Avatar
Member
37 posts
Joined: Aug. 2015
Offline
Its difficult to understand what you are trying to do with the limited info, but i'm guessing you mean the copied lines aren't “straight”.

Both these setups are causing axis flipping if you move the point over a specific axis. This is because the copy node only has a normal direction to use to orient the copies. The side and up vectors dont have a reference. If you're just randomly scattering geo this usually isnt a problem, but when you need to align things perfectly you need to either supply reference directions or build your own transform or orient attributes so the copy node knows exactly how to align the copies.

See here:
http://www.sidefx.com/docs/houdini/copy/instanceattrs.html [www.sidefx.com]

You could try setting an up vector in the point wrangle before your copy sop.
ie v@up = {0,1,0};
The side vector would then be the cross product of N and up. So you will get axis flipping if N and up are aligned.
User Avatar
Member
40 posts
Joined: Oct. 2018
Offline
exactly what i mean i'm just wondering why its twisting when u move the point over a specific axis. i guess this is build into te software? or a natural cause of something? why will it not just face the same direction al the time. whats the internal cause of it twisting?
User Avatar
Member
34 posts
Joined: Sept. 2013
Offline
Nicolas Longchamps
Its difficult to understand what you are trying to do with the limited info, but i'm guessing you mean the copied lines aren't “straight”.

Both these setups are causing axis flipping if you move the point over a specific axis. This is because the copy node only has a normal direction to use to orient the copies. The side and up vectors dont have a reference. If you're just randomly scattering geo this usually isnt a problem, but when you need to align things perfectly you need to either supply reference directions or build your own transform or orient attributes so the copy node knows exactly how to align the copies.

See here:
http://www.sidefx.com/docs/houdini/copy/instanceattrs.html [www.sidefx.com]

You could try setting an up vector in the point wrangle before your copy sop.
ie v@up = {0,1,0};
The side vector would then be the cross product of N and up. So you will get axis flipping if N and up are aligned.


pande
anyone ?


exactly as Nicolas described,to add few more things,if you looks at the provided image marked parameter“Transform Using Template Point Attribute” is what is transferring the orientation from points to copy SOP, in this case its rotating just using normals,so the rotation of your lines(twisting in your words)is based on the normals defined,if you switch off this parameter your orientation issue will be sorted(wont work in every case),but again your copy sop wont recieve any of the attributes from the points.For example the scale attribute you created won`t be transferred.So,instead of doing that, you can add an upvector before you copy as Nicolas mentioned.That should fix your problem.
Edited by MarXindia - Nov. 5, 2018 15:07:35

Attachments:
WhatIsIssue_Orientation.JPG (150.0 KB)

  • Quick Links