Dynamic and Object Based Backgrounds

This page describes the principles and implementation of the XML based background system.

■ Dynamic Backgrounds: Basic Principles

openBVE supports several distinct types of backgrounds:

  1. The original ‘texture’ based background. This wraps the specified texture around the viewing frustum a specified number of times.
  2. ‘Dynamic’ backgrounds. These are made up of a series of texture based backgrounds, and which are changed at the appropriate time.
  3. ‘Object’ backgrounds. A static object (.b3d , .csv or .x) may be used instead of the standard viewing frustum.

NOTE: No transition effects are supported for object based backgrounds.

Each individual background which you wish to use must be setup using a background XML file an example of which is shown below:

As you can see, the file is made up of one or more <Background> sections, each of which defines the background to be displayed at the point in time specified by Time.

■ Texture Backgrounds

A texture based background supports the following attributes:

<Texture> FileName </Texture>

FileName must point to the image which you wish to display as the background texture.

<Repetitions> NumberOfRepetitions </Repetitions>

NumberOfRepetitions is the number of times the texture is to be wrapped horizontally around the viewing frustum.

<Mode> TransitionMode </Mode>

TransitionMode controls the transition effect to be used when this background is shown. Valid values are:

<TransitionTime> Time </TransitionTime>

Time is the time in seconds which the transition effect takes to complete.

■ Dynamic Backgrounds

A dynamic background should simply be made up of multiple Background elements, and takes one further attribute:

<Time> GameTime </Time>

GameTime is the 24-hour based time at which the transition to this background will begin.

■ Object Backgrounds

An object based background may also be used. With these, the specified object is rendered with it’s 0,0,0 co-ordinate centered upon the camera center.

Only .b3d , .csv and .x files with no animation are supported. No transition effects or other attributes are supported.

A sample XML is shown below: