Spherical coordinates camera - stutter

PuaKoala's icon

Hello, I have problems with a jit.gl.camera that is designed to move around a lookat point. The rendered scene shows a little stutter from time to time during slow rotations that are driven by jit.gl.handle @autorotate 1.
I wonder if this is a general problem caused by update timing of the different objects that are involved.
Are there better ways to accomplish this?
Details:
gl3, Max 8.1.8 Win10, GeForce RTX2080

The user interface is built from a jit.pworld (which I trigger with textures in order to get 60fps). In this world there is a representation of a camera (blue cone) and its lookat point (small grey cube). One can change the rotation of the camera via a jit.gl.handle just by click and drag in the blue window. One can adjust the distance of the camera to the lookat point with the red float box labeled r. The blue cone position is calculated from the lookat point position and the position of the jit.anim.node that is child of the lookat point. These two points define a direction vector which is used for calculation of spherical coordinates r, phi, theta.

I need this kind of camera control for a more complex 3D scene, with several cameras.

Left: User interface for camera rotation and lookat position via jit.gl.handle, allowing to change the distance r from the lookat point. Right: The 3D scene captured by the camera.

Max Patch
Copy patch and select New From Clipboard in Max.

Rob Ramirez's icon

your patch is missing several elements. I assume you copied in presentation mode, so all the non-presentation mode objects did not get included. Please paste in the full patch and I'll take a look.

PuaKoala's icon

Thank you very much. Here is the patch.

Max Patch
Copy patch and select New From Clipboard in Max.

Rob Ramirez's icon

cool, thanks for the patch. this is an interesting use case that i would be nice to better support. I think things would be smoother if the pworld was synching it's frame driver to the jit.world. this is not currently possible, but there is an existing feature request to allow for disabling the pworld automatic rendering. we could also add a bang message handler so that a jit.world could drive a pworld render, and the two would be in synch.

for now, it may be best to swap the pworld with an old school pwindow / gl.render combination in order to sync to the jit.world.

Max Patch
Copy patch and select New From Clipboard in Max.

PuaKoala's icon

Thank you. This works now as expected.