Light Properties - powerof3/LightPlacer GitHub Wiki

Light Properties

"data":{
   "light":"",
   "color":[0,0,0],
   "radius":1.0,
   "fade":1.0,
   "fov":1.0,
   "shadowDepthBias":1.0,
   "offset":[0,0,0],
   "rotation":[0,0,0]
   "externalEmittance":"",
   "conditions":[""],
   "conditionalNodes":[""],
   "flags":"",
   "colorController":{},
   "radiusController":{},
   "fadeController":{},
   "positionController":{},
   "rotationController":{}
}
Field Description Required
light EditorID of the lightbulb to be attached. Multiple editorIDs can be chained using "|" eg. ("DefaultGreen01NS|WRCandleFlickerNS"). The first valid form will be picked. Required
color Override lightbulb color. Can be RGB (e.g., 255,0,0) or normalized RGB (e.g., 1.0,0.0,0.0). Optional
fade Override lightbulb fade. Optional
radius Override lightbulb radius. Optional
fov Override lightbulb FOV (shadowcasting lights only). Optional
shadowDepthBias Controls shadow depth bias Required (for shadow casting lights)
offset Offset light position from the current point/node it is attached to. Optional
rotation Control lightbulb rotation (for spotlights). Unit is in degrees. Optional
externalEmittance External emittance ID. Does not work on lights attached to actors. Optional

Conditions

You can add conditions to lights so they can be toggled on/off when needed. Conditions update every second.

eg. Self IsSneaking NONE NONE == 1 AND, PlayerRef IsDead NONE NONE == 0 AND

  {
    "models": [
      "weapons\\steel\\steelsword.nif",
      "weapons\\steel\\1stpersonsteelsword.nif"
    ],
    "lights": [
      {
        "points": [ [ 0.0, 0.0, 0.0 ] ],
        "data": {
          "light": "TestLightingViolet",
          "radius": 128.0,
          "fade": 2.0,
          "conditions": [ "Self IsActor NONE NONE == 0 OR", "Self IsWeaponOut NONE NONE == 2 AND" ]
        }
      }
    ]
  }

The sword will light up when dropped or drawn when equipped.

Conditional Nodes

Nodes or shapes to be toggled based on conditions (hidden when light is off and vice versa)

"conditionalNodes": [ "Node1", "Shape2" ]

Flags

Set of flags used to mark lights for rendering purposes. Flags should be written exactly as shown.

Flag Description
PortalStrict Light is flagged as "portal strict", ie. culled by room bounds
Simple Simple light, no contact shadows
Shadow Shadow casting light. This flag is required for light to cast shadows
UpdateOnWaiting Only update conditions after waiting
UpdateOnCellTransition Only update conditions during cell transitions (interior ↔ exterior)
SyncAddonNodes Toggles addon nodes based on light state. Works with models and addonNodes
IgnoreScale Prevents light fade and radius from being affected by object scaling
RandomAnimStart Random start time for animation controllers
NoExternalEmittance Light will ignore any external emittance sources on the object it is attached to
"flags": "Simple|PortalStrict"

Controllers

Lights can be animated similar to how nif animation controllers work. Animation will cycle between each keyframe and loop back when the final key is reached.

Interpolation Description
Step No interpolation, value will be be immediately set once target time is reached
Linear Linear interpolation
Cubic Smooth transitions between values (similar to Quadratic key type used by nifs). Forward/backward values are used
    "radiusController": {
      "interpolation": "Linear",
      "keys": [
        {
          "time": 0.0,
          "value": 1.0,
          "forward": 0.0,
          "backward": 0.0
        },
        {
          "time": 1.0,
          "value": 2.0,
          "forward": 0.0,
          "backward": 0.0
        },
        {
          "time": 3.0,
          "value": 1.0,
          "forward": 0.0,
          "backward": 0.0
        }
      ]
    }

colorController/positionController/rotationController have their own field names for value.

{
  "time": 3.0,
  "color": [255,0,0]
}
{
  "time": 3.0,
  "translation": [0,0,100]
}
{
  "time": 3.0,
  "rotation": [0,90.0,0]
}