Allocentric viewer to position an egocentric camera

Martin Beck's icon

Hello, can somebody give me some hints how to improve this patch or if there are more convenient solutions?
I tried to build an allocentric viewer as most 3D animation programs like Unity, Maya, Blender etc. offer.
The viewer allows to position 3D objects in space and allows to rotate the entire space. The actual rendering of interest is performed by another egocentric camera that is also member of the 3D space and that can be positioned with a handle like any other object.
There are several problems in Max that make this challenging. Some of this is discussed here https://cycling74.com/forums/coordinate-systems-of-jit-gl-handle-jit-world-and-jit-gl-camera/replies/1#reply-5c791d2426a6f42213eecd36

Currently the main problem I have is update behaviour of jit.gl.picker, that is reacting strange or with lag (see checkCLICK) causing the feedback loop that it should interrupt to be open at the wrong time resulting in stuttering movement of the egocentric camera and its handle.
The use of jit.gl.picker is just a consequence of the entire architecture that uses a lot of objects to make the jit.gl.handles react to world transformations.
Preferably I would like to get rid of all parts of the patcher coloured in orange.

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

Egocentric camera view (left) and allocentric view (right). Everything in the patch coloured in orange is used to make the handles behave in a convenient way. The turquoise cone in 3D space represents the position of the egocentric camera. The blue cube represents the position where this camera looks at.

In my opinion jit.gl.handles should have an attribute that make them transform together with the world.
Furthermore they should report mouse state (hover, click, release) so one does not need the jit.gl.picker.

Second order problem: Retrieving the worldpos and worldquat from the jit.anim.node and feeding it back to the jit.gl.handles by itself also causes some little jitter in the egocentric view when rotating the world. (This issue is of minor importance to me because the whole viewer is only intended to provide camera positions/rotations for keyframe recording in Ableton Live).

Rob Ramirez's icon

hi Martin.
please send me a message off list to robr at cycling74.com

Rob Ramirez's icon

hey Martin, I can recommend a few things to try.

  • if you use jit.gl.handle in auto_handle mode (enabled when the handle is not connected to anything), then it will properly update it's transform as expected.

  • you can then use the @filters and @filterclass ob3d attributes to tell the handle to only affect specific objects

  • use the new multi-drawto feature of jit.gl.node to draw your scene objects in both the allo and ego views.

  • use a vizzie viewr for efficient shared preview context

Hopefully this gives you some more to work with.

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

Martin Beck's icon

Perfect! Nice you even added the lookat to the cone.

John J.A. Jannone's icon

Nice patch, Rob!