Information regarding the scenegraph and different types of node.
Everything that is rendered is controlled via ARNode objects in the scenegraph. The scenegraph is responsible for positioning objects throughout the scene.
ARNodes control the position, orientation and scale of a node within the scene. Child nodes inherit the transformation of their parent, so if the parent moves, all of its children move with it.
ARNodes also control the visibility of themselves and any of their children.
Nodes can have multiple children but only a single parent.
Nodes can move relative to a world, rather than just their direct parent or the camera. This is useful in situations such as wanting to move a node relative to a trackable without moving its parent.
The ARNode class is especially suitable for subclassing. It receives various rendering related events and can completely encapsulate all properties of its children.
Types of Node
There are many different types of node. Each one is specialised to deliver a certain type of content.
An ARMeshNode represents a drawable mesh in the scene that gets rendered. The geometry to be used, as well as its shading, is specified via this node and the material associated with it. There are a few types of node that subclass from mesh node to render specific types of content.
An ARImageNode represents a 2D image. It is used to display image files. This node can display any image file supported by the OS.
An ARVideoNode represents a video. It is used to render video content.
Alpha Video Node
An ARAlphaVideoNode represents videos that have transparency. It renders a supplied alpha video file on a flat mesh in the scene.
An ARPointNode is similar to an ARImageNode, but instead of displaying image files, it displays a point sprite.
ARModelNodes represent an imported 3D model. It is capable of displaying animations if the model format supports them and is the channel for controlling these animations.
An ARBoneNode represents a bone in a model’s mesh. They are structures that describe how certain parts of a mesh deform with the movement of a scene node. An array of these nodes describes the current pose of the skeleton. These are imported automatically by the Model Importer and are used for skeletal animations.
An ARPanoNode represents a cube panorama that can be added to the gyro controller. By moving the device around, it is possible to look around a 360 image. The node is created by taking a set of images and arranging them around a rounded cube.
An ARLight represents a light in the scene. Its light properties, along with its position and orientation, affect the rendering of meshes using a light material. It is the base light from which all light nodes derive. If ARLight is used to create a light node, it will behave similarly to a point light, but it will not have any attenuation, so the light will not fade over distance.
There are different types of light:
An ARDirectionalLight represents a light source of constant intensity emitted from a specific direction. This light behaves as if all rays created are parallel and emitted from a distance infinitely far away. Direction of light source is set by changing the light’s orientation variable. Altering the position of this light does not change the light emitted.
An ARPointLight represents a light in the scene that shines in all directions equally from a specific position. It also accounts for attenuation, with the level of light falling off over distance, following the inverse square law. Altering the orientation of this light does not change the light emitted.
An ARSpotLight represents a light in the scene that shines from a specific position along a specific direction with a cone-shaped area of effect. It can be translated and rotated just like any other node. It can be seen as a combination of an ARPointLight and an ARDirectionLight, as both the position and orientation of an ARSpotLight will affect the overall level of illumination on each object in the scene.
An ARCamera represents the virtual camera in the scene. It is typically controlled by one of the tracking methods, and its position/orientation is set to match that of the actual device in 3D space. Cameras can have different kinds of projection. A perspective projection matching the intrinsics of the device’s camera is used for rendering 3D content, but an orthographic projection can also be used to render 2D overlays.
An ARBillboardNode changes its orientation to ensure it always maintains its given forward vector direction relative to the camera. This is useful for showing content that rotates and follows the device as it moves around the scene and is especially useful for videos or other 2D content, as it will always be visible. Billboard nodes can be used in conjunction with ArbiTrack to make 3D models or videos turn to follow the camera, or with the Image Tracker to have objects face the camera independently of the marker’s orientation.
An ARMultiTrackableNode dynamically changes which world it is a child of. This allows a single node to be displayed across different worlds at different times. It is useful when one piece of content needs to be displayed across numerous trackables, as that content can be reused, and does not need to be created more than once. An ARMultiTrackableNode cannot be used to display content on multiple trackables at the same time, as when a trackable is detected, the node changes its world, meaning that detecting two trackables will simply make it change its world to the one that was detected last.
An ARWorld is a special type of node that represents the concept of a world. Every image trackable has its own world. ARGyroManager and ARGyroPlaceManager also have their own worlds. These represent the coordinate frames of these specific objects. This allows content to be placed relative to the positions of these worlds and move with these worlds, rather than everything being placed relative to the camera, or being entirely dependant on the transformations of their parents.
An ARWorld has special meaning for reflection maps, which are calculated in world space. This means that the environment map is aligned with the nearest descending ARWorld in the scenegraph.