Poom Poom Shop Pass · 29.99€/mo

Mapping

Occlusion in GTA V maps: what it is and why mappers care

NXBy Team NolX
· 4 min read

Grapeseed General Store

If you've ever looked at an MLO's stream folder and wondered why it ships a modified vanilla .ymap with a weird name, there's a decent chance it's occlusion. It's one of the least understood parts of GTA V mapping, and one of the most important for performance.

The idea in one paragraph

The fastest geometry to draw is geometry you don't draw at all. Occlusion is how the engine decides that something is hidden behind something else, a building, a hill, a wall, and skips rendering it. Without it, the game would draw every object in front of the camera within its draw distance, including the hundred props sitting behind the warehouse you're staring at.

How GTA V does it

GTA V uses precomputed occluders. Rockstar baked simple, invisible boxes and meshes into the map data: big blocks representing solid buildings, terrain, walls. At runtime, the engine rasterises these cheap shapes into a low-resolution depth buffer and tests other objects against it. If an object's bounding box is fully behind an occluder, it's culled.

The occluders live inside .ymap files, alongside entity placements. There are two main types:

  • Box occluders: axis-aligned boxes, cheap and common for buildings.
  • Occlude models: arbitrary low-poly meshes for shapes that boxes can't describe.

Interiors (MLOs) have their own culling on top of this, using rooms and portals. That's a separate system, which we cover in our article on portals and flickering.

Why custom maps break occlusion

Here's the problem. Suppose a vanilla building in Grapeseed has an occluder baked around it. A mapper removes that building and puts a new MLO with large windows in its place. The old occluder is still there, invisible, sitting exactly where the walls used to be.

From the engine's point of view, that space is solid. Anything behind it gets culled. The result, in game:

  • Parts of the new building vanish when you look at them from certain angles.
  • The road or terrain behind the building disappears, and you see the sky through the ground.
  • Props flicker in and out as you walk around.

So a proper map has to edit the vanilla occlusion: remove the occluders that no longer match reality, and ideally add new ones that match the new building. That's why good MLOs include modified vanilla ymaps, and why we leave those files unencrypted. If two maps both touch the same area's occlusion, you need to be able to open them and merge the changes.

The opposite mistake

Some mappers deal with occlusion by deleting all of it in a region. Visually, everything looks fine. Performance-wise, it's bad: the engine now draws everything behind every building in that area. You won't notice in an empty test server, but on a full server with a dense city block it adds up quickly.

Spotting occlusion issues

A few clear signs that occlusion is wrong near a map:

  • Geometry disappears only from specific camera angles, not at a given distance. Distance-based popping is usually LODs; angle-based is usually occlusion.
  • Looking through a window, the outside world is missing.
  • FPS near a map is noticeably worse than in similar vanilla areas, with no oversized texture warnings in F8.

CodeWalker can display occlusion boxes and meshes if you enable them in the view options, which makes the first two cases easy to confirm.

Conflicts between maps

This is where server owners usually get bitten. Two map resources each ship a modified copy of the same vanilla ymap. Whichever loads last wins, and the other map's changes are lost. If the losing map relied on removed occluders, you get the vanishing walls described above.

How to handle it:

  1. Search your resources for duplicate file names in stream folders.
find resources -name "*.ymap" -path "*stream*" | xargs -n1 basename | sort | uniq -d
  1. For each duplicate, open both versions in CodeWalker and compare what was changed.
  2. Merge the edits into one file and remove the other copy.

It's tedious, but it's the only clean fix. This is also why I'd avoid maps that encrypt their vanilla edits; you can't merge what you can't read.

Should server owners care?

You don't need to author occluders yourself. But you should understand enough to recognise the symptoms, to know why maps ship vanilla files, and to check for duplicates when you add a new map to an area that already has one.

When we build something like the Grapeseed General Store, the occlusion edit is part of the job, not an afterthought. Expect the same from anyone you buy from.

Keep reading

More from the Journal