convert normal attribute to orient?

   11108   3   1
User Avatar
Member
408 posts
Joined: June 2015
Offline
Like the title says,i'm struggling to convert the N attribute to orient attrtibute. Been watchinng an hour of Junichiro Horikawa's video on the topic... and i just feel dumber after it

Cheers,

A.
User Avatar
Member
8539 posts
Joined: July 2007
Online
N doesnt define full orientation, you need up vector also
you can provide it or just assume to be {0,1,0} to get the default houdini behavior as if not proided
vector nN = normalize(v@N);
vector nup = normalize(v@up);
p@orient = quaternion(maketransform(nN, nup));
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
408 posts
Joined: June 2015
Offline
tamte
N doesnt define full orientation, you need up vector also
you can provide it or just assume to be {0,1,0} to get the default houdini behavior as if not proided
vector nN = normalize(v@N);
vector nup = normalize(v@up);
p@orient = quaternion(maketransform(nN, nup));


Thanks Tomas, Posted on facebook as well, and Johnathan de Blok was kind enough to remind me of Matt's docs... where the answer was waiting to be studied for years :$ Seems slightly different than your code, but it does the trick nevertheless. Any benefit using one or ther other?

//@N = {0,1,0};
//float s = sin(@Time);
//float c = cos(@Time);
@up = set(0,1,0);

@orient = quaternion(maketransform(@N, @up));

I had a polyframe above where i did set the up attribute, and normals were set as well already. That bit of code did the rest. SKipped the (0, 1, 0) though.


Cheers again,

A.
Edited by Adriano - Sept. 16, 2021 12:58:18
User Avatar
Member
94 posts
Joined: July 2019
Offline
Tamte's example is preferable because it's always better to normalize any vectors which used as axis.
Another good video to demystify quaternions
  • Quick Links