Vai al contenuto
Distant LOD Light Editor

Distant LOD Light Editor

Place, move and recolour GTA V distant LOD lights on the real map at night in your browser, then export the ymap pair and a ready FiveM resource.

Per ora questa documentazione è in inglese.

Open the tool Last updated

The Distant LOD Light Editor is for the lights you see across Los Santos at night. It draws them on the real map, lets you place, move and recolour them, and writes the two ymap files they live in.

Everything runs in your browser. Nothing is uploaded.

Important

No script can change these at runtime. There is no native that reads, writes or recolours LOD lights, so a modified ymap is the only way. If you were looking for something you can toggle from Lua, this is not it.

Quick start

  1. Leave the tool on Place and click the map where you want lights. The Night slider washes the map down so you can see what you are doing.
  2. Switch to Select and move to drag a light, click one to open its panel, or right click one to delete it.
  3. Set the colour, intensity, type, cone, falloff and the hours it is on.
  4. Press Download resource.
  5. Follow the four steps in the README: import each XML in CodeWalker, drop the two .ymap files in stream/, ensure the resource and restart the whole server.

To edit lights that already exist, export the pair from CodeWalker as XML and press Open.

The pair

These lights live in two ymap files that only work together.

File Holds flags contentFlags parent
<name>_distantlights.ymap positions, colours, numStreetLights, category 2 256 none
<name>_lodlights.ymap direction, falloff, hours, type, cone, corona, hash 0 128 the distantlights file

The arrays line up index for index. The positions and colours are only in the first file, so the second one draws nothing without it. Do not rename one without the other, and do not ship one on its own.

The fields

Field What it is
Colour Packed BGRA in one unsigned int, not RGBA
Intensity The top byte of that int. The base game never goes above 170
Hours A 24 bit mask, one bit per hour of the day
Street light Bit 24 of timeAndStateFlags. numStreetLights is the count of these
Light type Bits 26 to 28: 1 point, 2 spot, 4 capsule
Inner and outer cone One byte each. For a spot they are 0 to 180 degrees; for a capsule the outer one is a length in quarter metres
Falloff Metres. Stock values run from about 5 to 120
Category Per file, not per light: 0 small, 1 medium, 2 large

numStreetLights is recounted from the flags every time you export, so it can never get out of step with what is actually in the file.

Warning

Intensity above 170 is untested. The field is a byte so the slider goes to 255, but nothing in the base game uses that range and there is no source for what the game does up there.

The hour preview

Every light carries its own hour mask. The hour slider under the map picks an hour and draws each light the way that mask says: lit, or hollow if it is off then. Hollow does not mean missing. The light is still written to the file.

A stock street light is on from 20:00 to 05:59. The presets in the panel cover that and the other common masks.

Recolouring a lot at once

Pick the target (everything, just the selection, or just the street lights) and one of four modes:

  • One colour puts every light on exactly that colour.
  • Around a colour uses that hue with each light wandering a little.
  • Random gives any hue at all, at that colour’s saturation and brightness.
  • Keep the variation takes that hue but leaves each light’s own brightness and colour strength alone, so a mixed street stays mixed.

The result is deterministic: the same settings give the same colours every time.

Category and the streaming pad

Category is a per file tier that decides which range band the whole file uses. The base game splits street lighting into 62 small files, blocks into 36 medium ones, and puts 90 landmark lights in a single large file covering the whole map.

Streaming pad is how far past the lights the streaming box reaches. CodeWalker’s own calculation uses 3000 m; Rockstar’s small files sit around 445 m and the large one around 2,670 m, and no simple rule reproduces both. The default here is CodeWalker’s 3000 and both files of the pair get the same numbers, which is what the stock pairs do. Turn it down for a small local pack.

The one manual step

A resource streams binary .ymap files. This page writes CodeWalker XML, and turning that into the binary is one menu click in CodeWalker:

  1. Open _xml/<name>_lodlights.ymap.xml in CodeWalker.
  2. Import XML, then save as <name>_lodlights.ymap.
  3. Do the same with the distantlights file.
  4. Put both .ymap files in stream/ and delete _xml.

stream/ is deliberately empty in the download until you have done that, rather than shipping a file the game would reject.

fxmanifest.lua
fx_version 'cerulean'
game 'gta5'

name 'fivemad_lodlights'

this_is_a_map 'yes'

Nothing else is needed: a map data file in stream/ is picked up on its own, with no files {} entry and no data_file line. Streamed assets are read once at startup, so restart the whole server rather than just the resource.

Limits

  • It does not write the binary ymap. See above.
  • It does not read a binary .ymap. Export XML from CodeWalker first.
  • It does not ship the game’s own lights. To recolour the stock city, extract lodlights.rpf with CodeWalker and open the pair you want.
  • It cannot promise what you get in game. Whether these draw also depends on common/data/visualsettings.dat, which a mod may have changed.
  • Very large imports (tens of thousands of lights) draw the first 30,000 on screen so the map keeps panning. All of them are still edited and exported.