Skip to content

2.49 How It Works Lights

tngreene edited this page Apr 16, 2019 · 1 revision

Light support in 2.49 is on par with our OBJ spec.

Relevant Files

XPlaneExport8_util.py Line 255 - 274, class definitions for VLIGHT, NLIGHT, and CLIGHT Line 1032, def sortLamp

XPlaneExport8.py, line 501 - 507 definition of isLight, used for testing custom lights

XPlane2Blender.html, Documentation on Lamps

How Lights Are Made and Defined

  • Only "Lamp" type Lamps Objects are allow (what we call "Point" lights in 2.7x)
  • Certain keywords in the lamp object's name(gets striped of trailing .001's etc) indicate a type:
x in lname.lower().strip() Properties/Buttons Blender 2.7x location
"lamp" Color is white, [0, 0, 0] X-Plane Lamp Type
"flash" RGB slider determines color X-Plane Lamp Type, RGB Color Wheel
"pulse" None X-Plane Lamp Type
"strobe" None X-Plane Lamp Type
"traffic" None X-Plane Lamp Type
"smoke_black" - Not implemented (or planned) in XPlane2Blender
"smoke_white" - Not implemented (or planned) in XPlane2Blender
Anything else properties["name"].strip(), properties["params"].strip() X-Plane Lamp Type, Name, Parameter (if found)

CLIGHT, NLIGHT, VLIGHT

CLight

CLIGHTs are custom lights. To make a custom light: Lamps are collected in two ways, if their object type is "Lamp" or if it passes isLight: Does an object's first material slot's mode have Material.Modes.HALO set This button is under Links and Pipeline > Render Pipeline > Halo. In 2.7x, this is `material.type, underneath the material preview.

Game Prop Name 2.49 Buttons/Properties 2.78 Location 2.78 Destination
R, G, B 1st Material's RGB color, or a game property* 1st Material's diffuse color Light Colorpicker
A 1st Material's Alpha, or a game property* 1st Material's alpha color Light Energy
Size 1st Material's HaloSize (under Shaders Tab) 1st Material.halo.size Light.xplane.size
S1, T1 1st material's 1st texture's MinX, MinY (Buttons > Material > Texture > Map Image) Material > Texture > Image Mapping > Crop Minimum X/Y Light.xplane.uv[0:1]**
S2, T2 1st material's 1st texture's MaxX, MaxY (Buttons > Material > Texture > Map Image) Material > Texture > Image Mapping > Crop Maximum X/Y Light.xplane.uv[2:3]**
name Prop on Light, case sensitive, String Type SName or Tailname Same Light.xplane.dataref (disambiguated and fully resolved)***

There is one custom light per vertex of this object. You can have 0+ Vertices in a Mesh.

  • *Game Properties are case sensitive, must an FLOAT or INT be looked up only on the Light.
  • **If no texture, S1, T1, S2, T2 = (0, 0, 1, 1)
  • ***In case of no name, no dataref, a dataref that couldn't be successfully resolved, or "NULL", we give "none" as the dataref.

NLight

If a light does not contain the the above, it is an NLight, which is either a named light or paramlight if "param" is found. "name" and "param" are case insensitive are come from the Light's properties. Named and param lights must have some a mesh in the OBJ or it won't be exported.

In 2.7x, every light is exported unless other options are made to hide it, so, we'll convert it anyway and warn the user.

VLight

Basic white lights. Make the name "lamp" and it is placed. These are deprecated in 2.7x, but we'll still import them.

MAGNET

If a named light is named "magnet" (case insensitive), it gets turned into a MAGNET directive. Any "/" in "params" is turned into |.

Auto Convert to Spotlights

2.49 only used Point lamps (or "Lamp" in 2.49 speak), but we can use Spotlights. If we encounter the following information about a light we automatically upgrade it.

  • The name ends in "_sp"
  • The light type starts with SPILL_ (and all the ones ending with "sp" are SPILL)