Close

Palette:cameraViewport

Summary

The cameraViewport component is a modified Camera COMP that 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. Its viewer is an interactive Panel containing a rendered image from any Render TOP.

cameraViewport has all the 3D interactions that TouchDesigner's 3D viewers have, as noted below.

It can be connected to a Render TOP of your choice: (1) Set its Render TOP parameter to the path to your Render TOP, and (2) in the Render TOP set the Camera parameter to the cameraViewport.

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.

Home Angle - When you Home (h) the camera points along the Z axis by default. You can set the rotation of the camera-scene when homing using the Home Angle parameters.

The cameraViewport's extension Methods can be used to save and recall camera positions as presets, 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.

Note: Instead of the built-in Panel Component that provides an interactive rendered 3D viewer, you can specify your own Panel COMP, though it's usually un-necessary.

Note: The actual transform is held in the Xform Matrix parameter on the Pre-Transform page, which is ext.CameraExt.CameraTransform.

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.

For the viewer of the Geometry COMP, see Geometry Viewer.

Note: cameraViewport is a replacement of the arcBallCamera COMP.

PythonIcon.pngPalette:camera Ext


Parameters - camera Page

Help Help - Open this help page.

Version Version - The version number of the component.

Camera OBJ Cameraobj - A read-only reference to the internal Camera COMP where all of the camera logic is performed.

Panel COMP 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.

Render TOP 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 Camera 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.

Auto Rotate 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.

Home All 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.

Frame All 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 left - The camera will tumble when holding down the left mouse button and moving the mouse.
  • Right right - The camera will tumble when holding down the right mouse button and moving the mouse.
  • Middle middle - The camera will tumble when holding down the middle mouse button and moving the mouse.
Tumble Modifier 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.
  • None none -
  • Alt alt -
  • Ctrl ctrl -
  • Shift shift -
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.
  • Left left -
  • Right right -
  • Middle middle -
Dolly Modifier 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.
  • None none -
  • Alt alt -
  • Ctrl ctrl -
  • Shift shift -
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.
  • Left left -
  • Right right -
  • Middle middle -
Pan Modifier 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.
  • None none -
  • Alt alt -
  • Ctrl ctrl -
  • Shift shift -
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

Active 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.

Device Mouse3ddevice - - Choose which device will control the camera.
  • default default -
  • Player 1 Controller player1controller -
  • Player 2 Controller player2controller -
  • Player 3 Controller player3controller -
  • Player 4 Controller player4controller -
  • 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.

TouchDesigner Build: