Global Object Attributes RFC

Revision History 10/19/09 - Updated With Performance Notes 10/16/09 - Initial Draft

Attributes increase the performance cost of objects significantly, particularly when used in library objects that are heavily repeated in the global scenery.

One of the problems with the current OBJ implementation is that X-Plane doesn't have enough information to factor common custom state from groups of objects. For example, if a set of objects shares a texture and some of their geometry has blending disabled, it may not be obvious whether the entire set of objects would perform faster by defaulting blending to off globally (and turning it on as needed).

Objects are currently assumed to have a fixed "basic" state - that is, at the start of the OBJ blending is on, polygon offset is off, etc.

Global attributes allow an author to specify that a series of objects will have specialized "basic" state. Global state attributes will set the state at the beginning of each LOD. The following attributes will be controllable globally:


 * Blending control (enable/disable and cutoff level)

Note: two-sided geometry is not listed because it may be faster to generate second sides by repeating vertex indices, rather than by state change.

Performance note: when a number of objects that share common texturing properties also share the same global state and those objects are on screen many times and the use of global state reduces ATTRibute count, global state is a performance win.

However, use of a mix of global states for one texture may reduce performance if the global state is not widely shared.

''Example: a set of 300 objects all share one texture. Each one has its own unique blending cutoff level, specified as an attribute. Setting the blend cutoff globally in each object would actually make performance worse, because no two objects "share" the same global state.''

Open Issue: should we allow full blending control globally?

''Ben says: no, only blend disable to 50%. Rationale: first, this reduces global obj groups, which is very important, e.g. it makes the 300 separate global attributes case above impossible. Second, if a texture is globally no blend authors can modulate their entire alpha channel to achieve the desired effects, or even use a 1-bit alpha scheme like DXT1 to save VRAM.''