Skip to content
rust edited this page Mar 28, 2024 · 9 revisions
  1. Camera
  2. 3D Scenes
  3. 2D Scenes
  4. Lights

Scenes organize 3D application objects for rendering by grouping Models with a camera.

    scene3D := eng.AddScene(vu.Scene3D) // Perspective projection.
    scene2D := eng.AddScene(vu.Scene2D) // Orthographic projection.

Camera

A Camera represents the location of the viewer. There is one camera for each scene. 2D and 3D scenes are created using different camera settings.

3D Scenes

A 3D scene groups 3D models with a 3D perspective camera. Cameras for 3D scenes are positioned and rotated independently from models. Achieving smooth and intuitive camera movement, often in response to user input, is the responsibility of the application.

3D cameras need a position and an orientation, ie: cameras are in a specific location facing a specific direction. By default a camera is at the origin (0,0,0) looking down the -Z axis.

By conventation a camera is always at the origin (0,0,0) in virtual space. Moving a camera one way is accomplished by the vu engine moving the scene in the opposite direction of the camera move. This way the camera stays at the same spot, but appears to move. Camera rotations are handled in a similar manner.

2D Scenes

A 2D scene groups 2D or 3D models with an orthographic camera. A 2D scene does not have depth. A common use for a 2D scene is to overlay information on top of a 3D scene.

Note that 2D cameras are not positioned. The X and Y values used to position objects correspond to screen positions in pixels and are relative to the top left corner of the screen.

Lights

Lights are added to a scene and work with shaders that support lighting. Lights are positioned and oriented in 3D space. Lights and combined with other properties like color and intensity. Light information is passed to Shaders where it is combined with a Models color information to create the final output color for a pixel.

Clone this wiki locally