Custom Prop Discs

X-Plane 940 allows you to customize the look of the prop disc using a series of datarefs. The idea is to allow a plugin installed in an airplane to provide the rules for prop disc rendering, while letting X-Plane deal with the details of z-buffer thrash and other prop-disc-related artifacts.

Authors who want detailed 3-d props (when not spinning) should continue to build these with a 3-d modeler and turn off the “draw plane part”.

A sample plugin that controls the prop disc datarefs can be found here: http://www.xsquawkbox.net/xpsdk/mediawiki/Custom_Prop_Disc

You can download a sample airplane with a custom prop disc driven by a plugin here: File:Example prop disc.zip.

Concepts

A prop is either a disc or not. In disc mode the physical prop is not drawn – instead one or two proxy textures are drawn to simulate the effect of the prop spinning rapidly.

When the prop is not a disc, X-Plane will draw an airfoil for each blade, unless the plane part is disabled for drawing in Plane-Maker.

The prop disc is made up of two parts: the front disc and the side billboard. (The side billboard is not used unless a plugin activates it.) The front disc is a quad normal to the longitudinal axis; the side billboard is a quad normal to the lateral axis. Both spin around the longitudinal axis.

The prop disc texture is used by dividing it into equally sized cells horizontally and vertically and then selecting a cell. Up to two horizontally adjacent cells can be blended; vertical cells cannot. (Vertical cells are intended to provide multiple textures for a main and tail rotor, for example.)

AP_VTOL_prop

The cell grid does not have to be the same for the prop front and side billboard. For example, a typical layout might divide the texture into 4 cells for prop front discs (using the first 3) and then 16 cells for the prop side billboards, using the last 4.

Each engine has a prop override – when this is 0, X-Plane fills in all other values, managing cell selection, angles and the choice of whether the prop is a disc to match prior behavior. When a plugin sets this override (per engine) all datarefs (including prop angle, which is what makes the prop spin) are under plugin control.

All datarefs are per-engine arrays, for individual control of each engine.

Datarefs

sim/flightmodel2/engines/prop_disc/override

Set this to control the rest of these datarefs.

sim/flightmodel2/engines/prop_is_disc

This dataref can be set to 1 to use billboards and discs or 0 for a physical prop. You can read this dataref even if you are not overriding the prop.

sim/flightmodel2/engines/prop_rotation_angle_deg
sim/flightmodel2/engines/prop_disc/side_angle

These are the rotation angles of the front disc and side billboard – set by X-Plane unless you override.

Important: you should limit the prop angles to the range of 0-360 degrees while you compute them. While the sim will function with the values out of range, the result of letting the values get very huge is a loss of numeric precision that will cause artifacts during long flights.

Datarefs For Cell Selection

These datarefs control “cell selection” for teh textures:

Front disc:

sim/flightmodel2/engines/prop_disc/disc_s
sim/flightmodel2/engines/prop_disc/disc_t
sim/flightmodel2/engines/prop_disc/disc_s_dim
sim/flightmodel2/engines/prop_disc/disc_t_dim

Side billboard:

sim/flightmodel2/engines/prop_disc/side_s
sim/flightmodel2/engines/prop_disc/side_t
sim/flightmodel2/engines/prop_disc/side_s_dim
sim/flightmodel2/engines/prop_disc/side_t_dim

The s_tim and _t_dim define the number of horizontal axis (s) and vertical axis (t) cells for the prop disc and the side billboard. Make sure they are not zero! The _s and _t datarefs pick which cell; the lower left cell is numbered 0,0.

For the disc_s and side_s datarefs you can pass in fractional numbers to create a blend between two cells…for example, the value 2.25 is a blend of 75% cell number 2 and 25% cell number 3.

Translucency Control

You can control the translucency of each prop disc. For the front disc:

sim/flightmodel2/engines/prop_disc/disc_alpha_front
sim/flightmodel2/engines/prop_disc/disc_alpha_side
sim/flightmodel2/engines/prop_disc/disc_alpha_inside

X-Plane will interpolate between the front translucency and side translucency based on the view angle of the camera. So for example if disc_alpha_front is 1.0 and disc_alpha_side is 0.0, the disc will fade out as the camera rotates from front to side.

disc_alpha_inside is a scaler. For example if it was 0.75 then the disc would be 75% as opaque inside the cockpit as it is outside.

These datarefs provide the same service for the side billboard.

sim/flightmodel2/engines/prop_disc/side_alpha_front
sim/flightmodel2/engines/prop_disc/side_alpha_side
sim/flightmodel2/engines/prop_disc/side_alpha_inside

Controlling the Side Billboard

sim/flightmodel2/engines/prop_disc/side_width

This defines the width of the side billboard in meters.

sim/flightmodel2/engines/prop_disc/side_is_billboard

If you set this dataref to 1, the side billboard will be aligned to the camera (billboarded) automatically by X-Plane. If you set it to 0 it will be rotated around the longitudinal axis of the engine based on the side_angle dataref.

sim/flightmodel2/engines/prop_disc/side_number_of_blades

This defines the number of billboards to draw for the side billboard.

  • Facebook
  • Reddit
  • StumbleUpon
  • Twitter
  • Google Buzz
  • LinkedIn