Editor vzdálených LOD světel
Světla, která v noci září nad Los Santos, nejsou světla na propech. Jsou to dva ymap soubory, které fungují jen jako dvojice, a žádný skript na ně za běhu nedosáhne. Tahle stránka otevře tu dvojici na skutečné mapě, vykreslenou v noci v barvách a jasu, které soubor opravdu obsahuje. Přidávej světla, taháš je, nastav barvu, intenzitu, typ, kužel, dosah a hodiny, kdy má každé svítit, přebarvi tisíce najednou a stáhni si oba soubory i hotovou resource. Všechno běží v prohlížeči.
Tento nástroj a jeho poznámky jsou zatím v angličtině.
Tento nástroj je mimo provoz kvůli údržbě
Na chvíli jsme ho vypnuli. Zbytek webu funguje dál a nástroj se sám vrátí.
What a distant LOD light actually is
Stand on Mount Chiliad at night and look at the city. Almost none of what you see is the light on the prop. GTA V keeps its night lighting in layers, and the far away one is a pair of .ymap files:
<name>_distantlights.ymapholds aDistantLODLightsSOAblock: a list ofpositions, a list of colours, anumStreetLightscount and acategory.<name>_lodlights.ymapholds aLODLightsSOAblock: direction, falloff, falloff exponent,timeAndStateFlags, a hash, two cone bytes and a corona byte, one entry per light.
The two only work together. The arrays line up index for index, and the positions and colours live only in the first file. CodeWalker's own renderer says so in a comment where it bails out: it needs the positions from the parent. The second file names the first as its parent, and in a real game install all 525 of the files with contentFlags 128 point at one with contentFlags 256. Ship one without the other and nothing draws.
The bits, as the file stores them
Colour is packed BGRA, not RGBA. One unsigned int per light: blue in the low byte, then green, then red, and the intensity on top. That is not a guess. Unpacking all 106,076 lights of a real install that way gives 5,833 strongly red lights, 344 green and 444 blue, which is what a city at night looks like. The other reading turns every aircraft warning light blue.
Intensity is a byte, and the base game never goes above 170. Mean 67, median 37. The slider on this page goes to 255 because the field does, but everything above 170 is untested and the page says so.
timeAndStateFlags is four things in one int: bits 0 to 23 are an hour mask, one bit per hour of the day; bit 24 marks a street light; bits 26 to 28 are the light type (1 point, 2 spot, 4 capsule); bits 29 to 31 have no known meaning and are carried through untouched rather than zeroed.
The two cone bytes mean different things per type. For a spot they are angles: the byte maps linearly onto 0 to 180 degrees. For a capsule the outer byte is a length instead, in quarter metres, so 182 is a 45.5 m line of light.
category is 0 small, 1 medium, 2 large, and it is per file, not per light. In a real install the stored value agrees with the file name in all 99 base game files. Small is street lighting, split into 62 local files that stream in from about 1.6 km. Large is one file with 90 landmark lights covering the whole map.
numStreetLights is not typed in. It is the count of lights carrying bit 24, so this page recounts it every time you export and you cannot get it out of step.
There is no runtime way to do this
Worth saying plainly, because it is the first thing people ask. No native reads, writes, moves or recolours LOD lights. The GRAPHICS namespace has nothing with "Lod" in the name, and the only "Distant" native is the one for fake distant car lights. FiveM's own PREPARE_LIGHT and DRAW_LIGHTfamily, and DrawLightWithRange, are per frame deferred lights on a completely different rendering path: they will not reach across the map and they will not look like this. There is no native that loads a ymap from a path either. So a modified, streamed ymap pair is the only way, which is what this page writes.
How to use it
- Start from nothing or open a pair. Click the map with Place on to drop lights for your own map area, or press Open and give it the two
.ymap.xmlfiles CodeWalker exported so you can edit lights that already exist. - Look at it at night. The Night slider washes the real map down and the lights are drawn in their own colour at their own intensity, so the preview is the data.
- Scrub the hour. Each light carries its own 24 hour mask. A light that is off at the hour you are looking at is drawn hollow rather than hidden, because it is still in the file.
- Edit one, or thousands. Select a light for the full panel, or use Recolour a lot at once for the whole set, the selection, or only the street lights.
- Download and follow the four steps in the README.
The one manual step, and why
A FiveM resource streams binary .ymap files, and this page writes CodeWalker XML. Turning that XML into the binary RAGE meta container is one menu click in CodeWalker (Import XML), and it is not built into this page yet. So the zip ships the resource with the manifest, the README and both XML files in a _xml folder, and stream/ is deliberately empty until you have converted them. Everything else in the files is already correct: the flags, the content flags, the parent link, the extents and the street light count. The site's YMAP Builder works the same way.
That whole chain is checked rather than assumed: the XML this page writes was put through CodeWalker's own XML importer, saved as a binary .ymap, loaded back, and every position, colour word, flag word and hash came back exactly as written.
What this page will not do
- It does not write the binary ymap. See above. It would rather hand you a file CodeWalker turns into a working one than a file the game rejects.
- It does not read a binary
.ymap. Export the XML from CodeWalker and drop that in. - It does not ship the game's own lights. If you want to recolour the stock city, extract
lodlights.rpfwith CodeWalker and open the pair you want. - It cannot promise what you see in game. Whether these draw at all also depends on
visualsettings.dat, which a mod may have changed. The stock ranges were not read for this page, so no number is quoted for them.
Two numbers that are honest guesses
The streaming pad is how far past the lights the streaming box reaches. CodeWalker's own calculation uses 3000 m for the distant half and 950 m for the lod half. Rockstar's own files are tighter: their small files sit about 445 m out and the large one about 2,670 m, and no simple rule reproduces both. So it is a control here, defaulting to CodeWalker's 3000, and both files of the pair get the same numbers, which is what the stock pairs do.
The hash on each light is only ever used as a unique key. It is injective across the base game (50,877 lights, 50,877 distinct values) and it does not match entity guids. An imported light keeps its own; a new one gets a fresh value that nothing else in the file uses.
Další nástroje v kategorii config a kód
Clothing Designer
Otevři .ydd nebo .ydr oblečení s jeho .ytd soubory, maluj ve 3D nebo na UV layoutu s vrstvami, textem a obrázky, pak vyexportuj nové .ytd textury.
YMAP Builder
Umísti propy podle souřadnic a dostaneš platné .ymap XML se správnými rotacemi, extents a LOD vzdálenostmi.
Tvůrce zón
Nakresli zónu na skutečné mapě GTA V ve 2D nebo 3D a zkopíruj ji jako kód pro ox_lib, PolyZone, ox_target nebo qb-target.
