anyKode Marilou
Using cameras

Placing a camera into a model.

A camera is attached to a viewpoint. The camera can be used as an image capture device as well as a color sensor device. 


Using the device as a color sensor:

Capturing an image from video memory is a slow operation. If you plan to use the device as a color sensor, consider using the following parameters:

  • Near plane: 0.01
  • Far plane: 1 to 100
  • Aperture: 10
  • Resolution: 16*16
  • Format: X8R8G8B8

By using these parameters, the captured image is very small. Use GetNextImage to get the camera image and GetColor in order to get the average color of this image. 


Creating a camera

  • Create a viewpoint,
  • Show the Modify panel then select the Devices sub-panel.


Viewpoint properties:

Near plane: distance under which 3-D objects are invisible.
Far plane: distance beyond which objects are invisible.
Aperture: opening (in degrees) for capturing images.

Panoramic: check this option to indicate if the camera is panoramic (360 ). Panoramic images are generated by projecting environment map (cube map) on a 3D sphere. This camera type consumes a lot of CPU time because the 7 3D renders (cube + projection). The video card must support RenderToTexture and CubeMapping functions.

Sphere mirror ray : ray of the sphere used as mirror (in front of the viewpoint).
Distance/camera: distance from the viewpoint to the sphere.
Sphere segments: Triangles count used for final sphere rendering.
Cube map resolution: Cube maps size for generate the 6 3D renders. Prefer using the default size (Camera with div 2, closest 2 pow <=) 

  • Select the Devices sub-panel,
  • Click on the Choose Device icon to open the list of plugins that may be attached to this geometry,
  • Choose a Camera.

Resolution: image size in pixels.
Format: determines pixel format. By default, the format is Alpha Red Green Blue (8 bits per pixel). This is the fastest mode as it does not require any processing for transformation. The image is that which is calculated by the video card.
Max zoom factor: sets the maximum zoom that the camera can perform. 

In MODA programming, camera devices are accessed via the DeviceCamera class. The camera's full path, starting at PHX "/" is viewpoint0/cam0


Since the Viewpoint is considered as a rendered entity, you may attach it to a physical entity so that it can follow the movement of that entity (see Attaching to a physical entity).

See also the Samples/Devices/Camera/Camera: it shows how to use cameras and color sensor.

Documentation v4.7 (18/01/2015), Copyright (c) 2015 anyKode. All rights reserved.
What do you think about this topic? Send feedback!