Page 1 of 1

Create viewports systematically for animation

Posted: Tue Feb 09, 2021 3:06 am
by vik748
Hi,
I have looked through the existing posts and didn't see an obvious solution for what I am after. I'd like to create an animation and to make sure it is smooth I'd like to use numerically exact Viewports instead of manually moving the model.
My object is centered at the Origin 0,0,0 and i think I'd like the camera to go around a circle in a plane say z=100, at a radius of 200 and looking down at the object at 30 deg.
When I go to camera settings I am unable to correlate the X1,Y2,Z3 angles to the positions I am trying view from.

What would be the best way to systematically create these view ports. I'd be happy to write and share a script that can generate these positions if it would be helpful to others.

Thanks in advance.

Re: Create viewports systematically for animation

Posted: Tue Feb 09, 2021 4:38 pm
by vik748
One way I have been to do this in a different software (Metashape) is by using their keyboard shortcuts for view manipulation. They have hotkeys on the number pad, 4 and 6 to rotate current view right or left by 15deg and 2 and 8 to rotate current view up or down by 15deg. Give that rotation is not commutative, it is not obvious how to manipulate to desired angles, but after some trial and error, it is possible to achieve what I was after. To understand what I am describing, please take a look at the video at https://drive.google.com/file/d/1y_iP3L ... sp=sharing

Is it currently possible to perform similar delta rotations from a given view? Is this something that can be added easily?
Cheers...

Re: Create viewports systematically for animation

Posted: Wed Feb 10, 2021 10:49 pm
by daniel
Nope, there are no such keyboard shortcut. I don't think it would be too hard to add (for a C++ developer with some basic Qt knowledge)

Re: Create viewports systematically for animation

Posted: Fri Feb 12, 2021 1:39 am
by vik748
@daniel, how about adding the view ports systematically? Is there a way to create a list externally in a python script and bring it in? Also, could you possibly point to where I can find details of the coordinate system used when specifying the view port. For what I need, I know the tx, ty and tz of where the camera needs to be. I am still not clear how what the 3 angles are and how they would need to be changed as the camera goes in a circle.

Re: Create viewports systematically for animation

Posted: Sat Feb 13, 2021 12:26 pm
by daniel
So no such file exists, but it's technically possible to create an I/o filter for that without too much efforts.

And in the Camera Parameters dialog, we use Euler angles if I remember well (see https://github.com/CloudCompare/CloudCo ... Tpl.h#L468)

However, it may be easier to directly set the camera 4x4 transformation (as it's what you will need to create a viewport object: https://github.com/CloudCompare/CloudCo ... rtObject.h).

And the viewport parameters are here: https://github.com/CloudCompare/CloudCo ... rameters.h

Re: Create viewports systematically for animation

Posted: Sat Feb 13, 2021 2:42 pm
by vik748
@daniel thanks for the info. At some point I hope that I will be able to contribute by helping develop this. For now, I was able to work around it by:
1. Creating a test point cloud with points on a circle in a plane every 10 degs. Also added a point at the origin
2. I then make the target model visible and get the view to the approximate angle I wanted.
3. Clicked on camera settings and set Y2 and Z3 angles to 0, and made sure the center of rotation was set to origin.
4. Turn off the model, so I just see the circle.
5. Lock rotation about z axis
6. Manually rotated the object till the next point of the circle was aligned with the vertical axis. Add a view point using ctrl + v
7. Rinse and repeat

Hopefully this will be useful to someone else down the line.

Cheers,
Vik