The cameraViewport component can be used to interactively control a camera's position/rotation in a 3D scene. It can be used instead of the default Camera COMP, and its viewer is a rendered image using a Render TOP (versus the built-in 3D camera viewer). It can be connected to a Panel Component to provide an interactive rendered 3D viewer in any UI.
It has all the 3D interactions that TouchDesigner's 3D viewers have, as noted below. Note: cameraViewport is a replacement of the arcBallCamera COMP.
Note: After referencing this camera in a Render TOP, it is important to also update the Render TOP parameter in cameraViewport to reference the same Render TOP. Unlike the regular Camera COMP, this camera component requires knowledge of the scene being rendered in order to calculate framing, pivot on geometry, and to update the viewer.
The cameraViewport's extension Methods can be used to save and recall camera positions, get the current pivot position, align the camera to specific axis, and more. The extension class can also be used to implement additional navigation modes.
By default, camera movements are controlled by dragging the mouse while holding the left, right or middle buttons or by scrolling with the mouse wheel. The component also supports the following keyboard shortcuts:
- 'h'/'n' - Home/Front - Frame the scene and align the camera to face the negative z axis.
- 'f' - Frame - Frame the scene while maintaining the current camera angle.
- 't' - Top - Frame the scene from the top looking down the negative y axis.
- 'r' - Right - Frame the scene from the right looking along the negative x axis.
- 'l' - Left - Frame the scene from the left looking along the positive x axis.
First-person keyboard controls can be enabled using the 'WASD Keys Active' parameter on the Keyboard page. When enabled, these keys provide shortcuts that are equivalent to the 'Camera' navigation mode:
- 'W' - Walk forward on the XZ plane.
- 'A' - Step to the left.
- 'D' - Step to the right.
- 'S' - Walk backwards on the XZ plane.
- 'Q' - Turn to the left.
- 'E' - Turn to the right.
This camera also supports 3D mouse movement by enabling the 'Active' parameter on the 3D Mouse page. The input device can be selected from the drop down menu.
Parameters - camera Page
Help - Open this help page.
Version - The version number of the component.
Cameraobj - A read-only reference to the internal Camera COMP where all of the camera logic is performed.
Panelcomp - The Panel Component receives the mouse and keyboard interactions, and is used to control the interaction. By default, this parameter is set to a basic container inside of the camera that is used as the node's viewer. You can change this reference to an external panel if you wish to control the camera from another view. Note: If you're using your own panel, make sure to enable the Mouse Wheel and Mouse UV Button parameters to enable full functionality.
Rendertop - A reference to the Render TOP that is rendering the 3D scene. This is used to determine the bounds of the geometry for framing and homing, and to determine what geometry can be clicked on for pivoting. Only geometry that is included in the Render TOP's Geometry parameter is included in the camera calculations. By default, the render top is also used for the display in the node viewer.
Reset - Returns the camera to a default position facing towards the negative Z axis. Unlike Homing, resetting the camera goes to the same position regardless of the geometry in the scene.
Navigationmode - - The navigation mode determines how mouse movements inside the Panel Component affect the camera's position and orientation. They are based off the navigation modes available through the 3D viewer's right-click menu.
Autorotate - Turning on this feature will give the camera rotation some inertia so that it continues to rotate after the mouse is released. The speed of the movement is determined by how fast the mouse is moved. The camera will continue to rotate indefinitely, and will not slow down.
Homeall - Pulsing this button will set the camera to face the negative Z axis and to frame all of the geometry defined in the Render TOP parameter. The 'H' key can also be used as a shortcut for homing.
Frameall - Pulsing this button will move the camera to fit all of the geometry in the current scene while maintaining the existing camera direction. The 'F' key can also be used as a shortcut for framing.
Parameters - Buttons Page
Tumble Mouse Button
Tumblemouse - ⊞ - The mouse button to hold to 'tumble/pivot/rotate' the camera. How the camera tumbles depends on the current navigation mode.
left- The camera will tumble when holding down the left mouse button and moving the mouse.
right- The camera will tumble when holding down the right mouse button and moving the mouse.
middle- The camera will tumble when holding down the middle mouse button and moving the mouse.
Tumblemod - ⊞ - Select whether users must hold down an additional key to tumble the camera. This can be useful to enable multiple camera movements with the same mouse button e.g. LMB is pan, Alt+LMB is tumble.
Tumble Speed Multiplier
Tumblemult - Control how quickly the camera tumbles relative to the amount of mouse movement.
Dolly Mouse Button
Dollymouse - ⊞ - The mouse button to hold to 'dolly' the camera (move forward or backward). How the camera dollys depends on the current navigation mode.
Dollymod - ⊞ - Select whether users must hold down an additional key to dolly the camera. This can be useful to enable multiple camera movements with the same mouse button e.g. LMB is pan, Alt+LMB is tumble.
Dolly Speed Multiplier
Dollymult - Control how quickly the camera dollys relative to the amount of mouse movement. The speed of the camera movement is also depending on the distance to the current pivot point.
Pan Mouse Button
Panmouse - ⊞ - The mouse button to hold to 'pan/track' the camera. How the camera pans depends on the current navigation mode.
Panmod - ⊞ - Select whether users must hold down an additional key to pan the camera. This can be useful to enable multiple camera movements with the same mouse button e.g. LMB is pan, Alt+LMB is tumble.
Pan Speed Multiplier
Panmult - Control how quickly the camera pans relative to the amount of mouse movement. The pan speed is also based on the distance to the current pivot point.
Mouse Wheel Multiplier
Wheelmult - Controls how quickly the camera moves when the user turns the mouse wheel. The camera speed is also based on the distance to the current pivot point.
Parameters - 3D Mouse Page
Mouse3dactive - Enable control of the camera using a 3D mouse or joystick. The camera uses an internal Joystick CHOP to obtain up to 6 degrees of movement from an attached device.
Mouse3ddevice - ⊞ - Choose which device will control the camera.
- Player 1 Controller
- Player 2 Controller
- Player 3 Controller
- Player 4 Controller
- 3Dconnexion KMJ Emulator
tdjoy:p:3Dconnexion KMJ Emulator:l:0x5:-
3D Mouse Speed Multiplier
Mouse3dmult - Controls how quickly the camera moves relative to the input values from the attached device. Camera speed is also based on the distance to the current pivot point.
Parameters - Keyboard Page
WASD Keys Active
Keysactive - Allows controlling the camera using the W, S, A, D, Q and E keys on the keyboard similar to a first-person game camera.
Turn Speed Multiplier
Turnmult - Controls how quickly the camera turns when a user holds the Q and E keys.
Walk Speed Multiplier
Walkmult - Controls how quickly the camera moves when a user holds the W, A, S and D keys.