3D Model

The 3d model render extension renders a 3d model into the control. Currently models in Wavefront Object (.obj) format are supported. This extension is only available when using OpenGL or OpenGL ES 2.0 based render managers, and requires the model3d plugin to be loaded.

The coordinate system in the render extension is the default OpenGL default coordinate system, with positive x to the right, positive y up, and positive z towards the viewer. The camera position defaults to (0, 0, 0), with the view direction along the negative z axis.

A Phong reflection model is implemented. A directional light source is present with white light coming from the (0, 1, 1) direction. The Phong model makes use of three terms:

For more details on the Phong reflection model refer to Phong Reflection Model or to any book on computer graphics.

Rotations for the model are defined using Euler angles, with rotations applied around the z (psi), y (theta) and then x (phi) axes.

An OBJ file defines vertices and faces, and optionally normals and texture coordinates. If normals are not present, they will be calculated according to the convention that vertices in a face are specified in counter-clockwise order. If texture coordinates are not present, the model will not be rendered using a texture. Faces may be grouped together, and each group may be rendered with a different material.

Each OBJ file may also specify a Material (.mtl) file which allows for the material properties of the model to be specified. The following properties in a material file are currently supported:

If a material file is not present, the object will be rendered with a white color.

3D Model Render Extension Options

  • filename - The name of the model to load.

  • camera_position_x - The x position of the camera.

  • camera_position_y - The y position of the camera.

  • camera_position_z - The z position of the model.

  • azimuth - The rotation of the camera around the y axis in degrees.

  • elevation - The rotation of the camera around the x axis in degrees.

  • camera_field_of_view - The field of view the camera in degrees. The field of view specifies how much of visual sphere is mapped to the control. A larger field of view is equivalent to using a wide-angle lens on a camera, and a smaller field of view is equivalent to using a zoom lens.

  • model_position_x - The x position of the model.

  • model_position_y - The y position of the model.

  • model_position_z - The z position of the model.

  • model_orientation_phi - The rotation of the model around the x axis in degrees.

  • model_orientation_theta - The rotation of the model around the y axis in degrees.

  • model_orientation_psi - The rotation of the model around the z axis in degrees.