Obj level camera rotation convert to HPB angle?

   1308   8   2
User Avatar
Member
18 posts
Joined: 5月 2023
Offline
How to convert the rotation Angle xyz of an OJB level camera to the Angle of HPB?
Edited by liang444366454 - 2023年11月4日 06:41:41

Attachments:
Snipaste_2023-11-04_18-40-19.jpg (48.9 KB)
Snipaste_2023-11-04_16-47-12.jpg (26.6 KB)

User Avatar
Member
18 posts
Joined: 5月 2023
Offline
Is there any formula that can calculate this Angle?
User Avatar
Member
18 posts
Joined: 5月 2023
Offline
It's actually not as simple as I thought.I want to export the camera's tracking points into AE.But Houdini uses a right-handed coordinate system.It is possible to convert the coordinates of all objects to the values of the left-hand coordinate. The rotation Angle of Houdini's camera was then converted into an Euler Angle? I tried all the axial directions -180 degrees.All the coordinates turned out to be wrong
Edited by liang444366454 - 2023年11月4日 06:37:44

Attachments:
Snipaste_2023-11-04_18-35-14.jpg (39.5 KB)

User Avatar
Member
85 posts
Joined: 4月 2017
Offline
Have you checked this?
https://www.sidefx.com/tutorials/how-to-import-houdini-scenes-into-adobe-aftereffects-using-the-houdini_2_ae-tool/ [www.sidefx.com]
User Avatar
Member
18 posts
Joined: 5月 2023
Offline
This version is too old. Houdini16
User Avatar
Member
143 posts
Joined: 5月 2017
Offline
You can try the extract functions for the matrix rotation. It is similar to cracktrasform [www.sidefx.com] but specific to hpb rotation.

// XYZ to HPB rotation.
vector xyz_to_hpb(matrix M)
{
    vector tmp = 0;
    tmp.x = atan2(M.zx, M.zz);
    tmp.y = atan2(M.zy, sqrt(M.zx * M.zx + M.zz * M.zz));
    tmp.z = atan2(M.xy, M.yy);
    return tmp;
}

// HPB to XYZ rotation (requires an hpb-orientated matrix).
vector hpb_to_xyz(matrix M)
{
    vector tmp = 0;
    tmp.x = atan2(M.yz, M.zz);
    tmp.y = atan2(-M.xz, sqrt(M.xy * M.xy + M.xx * M.xx));
    tmp.z = atan2(M.xy, M.xx);
    return tmp;
}

// xform components.
vector t    = chv("t");
vector r    = chv("r");
vector s    = chv("s");
float scale = chf("scale");

// Create matrix from xfrom components.
matrix M = maketransform(0, 0, t, r, s * scale);

// XYZ to HPB rotation.
v@HPB_rot = degrees(xyz_to_hpb(M));

// Apply matrix to Points.
@P *= M;
Edited by viklc - 2023年11月5日 09:47:09
User Avatar
Member
18 posts
Joined: 5月 2023
Offline
I did it the way you did it. Thank you very, very much !!!!
User Avatar
Member
18 posts
Joined: 5月 2023
Offline
Again, I want to thank viklc!!!!!
He has helped me so much!
User Avatar
Member
143 posts
Joined: 5月 2017
Offline
liang444366454
Again, I want to thank viklc!!!!!
He has helped me so much!

You are welcome.
Edited by viklc - 2023年11月5日 15:46:30
  • Quick Links