Camera and Light Puzzles

The puzzles from this category perform operations with cameras or light sources.

Camera and lights visual programming blocks

Contents

Camera Puzzles Reference

look at

Smoothly animates the active camera so that it finally targets a specified object. The numeric parameter specifies the time period over which the animation is performed (in seconds).

Camera look at visual programming block

tween camera

Smoothly animates the active camera so that its position finally changes to the position of a specified object / 3D point, and the camera targets another specified object / 3D point.

The position and the target parameters can be specified either by scene objects or arrays of X, Y and Z coordinates.

The numeric parameter specifies the time period over which the animation is performed (in seconds).

The move parameter specifies the interpolation between the starting and the ending points: linear or spherical.

The optional when finished do slot may be used to detect the moment when the tweening is finished.

Tween camera visual programming block

zoom camera to object

Smoothly zooms the active camera in or out so that the specified object or a group of objects will be properly fit into the camera view. The numeric parameter specifies the time period over which the zooming is performed (in seconds).

The optional when finished do slot may be used to detect the moment when the zooming is finished.

Zoom camera visual logic block

set active camera

Makes a specified camera active. This can be used to change camera control mode ("orbit" vs "flying" vs "no controls"), field of view and other settings on the fly.

Set active camera visual programming block

active camera

Retrieves the active camera.

Get active camera visual programming block

autorotate camera

Smoothly animates the active Orbit camera by rotating it around the target.

Visual logic block to autorotate camera

In the following example, the camera starts to rotate after 3 seconds of user inactivity. When the user clicks a mouse button (or touches the screen), he or she regains the control over the camera until further 3 second period of inactivity.

Autorotate camera with visual scripting

To rotate camera in reverse direction set negative speed value, e.g -2.

get camera direction

Returns a list of X, Y and Z components of the active camera's world direction vector. If from mouse/touch is checked, this puzzle casts a ray from the camera to the cursor's screen position and returns the direction of that ray. If additionaly inverted is checked, then the cursor's screen position coordinates are negated.

Visual programming block to get camera direction

In the following example, an object looks at the mouse cursor. This can be achived by mapping the position of an empty/dummy object to mouse cursor with some simple math.

Visual script to target the camera to mouse cursor

In order to setup such behavior in 3ds Max, make your object follow a dummy object by utilizing the Rotation Controllers / LookAt Constraint. In Blender, this corresponds to the TrackTo constraint.

set camera param

Set parameter for the given camera.

Visual programming block to set camera params
field of view
Set camera frustum vertical field of view, from bottom to top of view, in degrees.
ortho scale
Sets the zoom factor of the camera.
movement speed
Set camera movement speed.
rotation speed
Set camera rotation speed.
allow panning
Enable / disable camera panning.
allow zoom
Enable / disable camera zoom.
zoom on ctrl key
Allow camera zoom only when Ctrl key is pressed.
keyboard controls
Enable / disable use of the keys.
orbit min distance (persp)
How far you can dolly in (perspective camera only).
orbit max distance (persp)
How far you can dolly out (perspective camera only).
orbit min zoom (ortho)
How far you can zoom in (orthographic camera only).
orbit max zoom (ortho)
How far you can zoom out (orthographic camera only).
orbit min vertical angle
How far you can orbit vertically, lower limit. Range is 0 to 180 degrees.
orbit max vertical angle
How far you can orbit vertically, upper limit. Range is 0 to 180 degrees.
orbit min horizontal angle
How far you can orbit horizontally, lower limit. Range is - 180 to 180 degrees (or - Infinity for no limit).
orbit max horizontal angle
How far you can orbit horizontally, upper limit. Range is - 180 to 180 degrees (or Infinity for no limit).
enable collisions
Enable / disable collision detections for first-person cameras.
clip start
Set camera frustum clipping start (near) plane. The valid range is between 0 and the current value of the far plane.
clip end
Set camera frustum clipping end (far) plane. Must be greater than the current value of near plane.

This puzzle also works for a list of cameras, a group (or a list of groups) or with the all objects puzzle.

get camera param

Get camera parameter. See description on set camera param puzzle for the list of parameters.

Visual logic block to get camera params

Light Puzzles Reference

set light param

Set light parameter:

color (vector)
Set light color using vector, where X, Y, Z represent R, G, or B color component accordingly. For example [0, 1, 0] vector represent pure green color.
color (css/rgb)
Set light color using CSS style string such as rgb(255, 0, 0) or magenta.
color (css/hex)
Set light color using CSS hex string such as #FF0000.
intensity
Set light intensity.
use shadow
Enable / disable light's shadow casting.
shadow map size
Set light's shadow map size.
shadow map filtering
Set shadow map filtering algorithm:
basic
Basic unfiltered shadows.
bilinear
Use bilinear interpolation for smoother shadows.
pcf
Percentage-closer filtering algorithm.
esm
Exponential shadow maps.
See more on shadow filtering types — Blender, 3ds Max, Maya.

This puzzle also works for a list of objects, a group (or a list of groups) or with the all objects puzzle.

Visual logic block to set light params

get light param

Get light parameter. See description on set light param puzzle for the list of parameters.

Visual programming block to get light params

Having Troubles with Puzzles?

Seek help on the forums!