Scenegraph

From Kudan AR Engine
Jump to: navigation, search

Introduction

Everything that is rendered is controlled via the scenegraph. The scenegraph is responsible for positioning objects throughout the scene.

Nodes

The scenegraph is made up of ARNode objects.

Transformation

ARNode controls the position, orientation and scale of a node within the scene. Child nodes inherit the transformation of the parent.

Visibility

ARNode also controls the visibility of itself and any of its children.

Relationships

An ARNode controls the position, orientation and scale within the scene, as well as the visibility of the node and any of its children. Nodes can have multiple child nodes but only a single parent. Nodes inherit the transform of their parent, meaning that if you move the parent, all of its children move with it accordingly.

Node types

There are many different types of node.

Mesh nodes

ARMeshNode represents a node in the scene that has a mesh associated with it, meaning that it actually gets rendered. A mesh node also has material associated with it, which controls the shading of the node's mesh.

Camera nodes

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.

Light nodes

ARLight represents a light in the scene. Its light properties, along with its position and orientation, affect the rendering of meshes using ARLightMaterial.

Billboard nodes

ARBillboardNode is a type of node that adjusts its orientation automatically to point at the camera. This is useful of you have 2D content, such as buttons, that you want to remain visible from various angles.

Image nodes

ARImageNode is a convenience node that represents a 2D image.

Video nodes

ARVideoNode is a convenience node that represents a video. ARAlphaVideoNode represents videos that have transparency.

Subclassing nodes

ARNode is especially suitable for subclassing. It receives various rendering related events and can completely encapsulate all properties of its children.