Skip to content

Decals, vertex opacity and overlay order

Frostbite (skate.)Effects and decalsApplies toskate.

San Van uses several systems that can all look like decals: terrain layer-graph decals, environment decal volumes, mesh decal materials and terrain layer blending. A measured scene contains 5,492 terrain decals, 9,381 environment volumes from 92 templates and 378 mesh-decal keys. Studio map materials reach mesh decals, not all these systems. Observed

The inspected settings disable projected Frostbite decals (Decal.Enable 0) while enabling the surface-decal grid. VisualTerrain.DecalOffsetY is 0.04 m; DecalZPassDrawDistance is 30. Surface-decal grid sizes are 1 m and 0.25 m with LargeDecalThreshold 2. Observed

Decal-class programs test depth GreaterEqual without writing it, use a hardware depth bias of 200 with slope-scaled bias 0.1, and draw only where stencil bit 0x08 is set; opaque programs and the depth prepass write stencil 0xfe. A decal therefore draws pulled toward the camera, and only over an opaque surface that has marked the stencil. Observed A blended, decal-class material with nothing opaque behind it does not appear, which matches the observed disappearance of alpha-blend world geometry. Inferred The state decode is under render-state bytes.

San Van uses two arrangements. Observed

  • Overlay sections. Blended overlays, stickers and grime are extra sections in the same MeshSet as their base, on decal-class programs: for example tuples (1088, 2077) prop trim decals, (1727, 2718) the HVAC decal row, (230, 1934) stickers and (235, 616) default_decalmesh_atlas. They are coincident with the base: of 852,043 overlay triangles, 215,236 lie exactly on it and the median offset is +0.48 mm. They have no depth or shadow twin section; the overlay sections are absent from the twins in 2,618 of 3,001 LODs. Observed
  • Decal meshes. Plot *_decal_* meshes are mostly ordinary depth-writing programs, for example (438, 1466, 3220, 3347): 1466 tests GreaterEqual and writes, 3220 tests Equal after the prepass. They float above the surface: matched against the opaque surface of the same cell StaticModelGroup over 80,033 of 99,670 triangles, the offset is p25 2.3, median 4.1 and p75 7.7 mm (p5 0.94, p95 16.5 mm), never exactly zero. Stacked decal sections in one MeshSet differ by about 6 mm. Observed

No measured stock layer relies on a coplanar depth-writing surface. Observed

Exactly coplanar opaque surfaces still occur. Over 4,225,065 opaque triangles of six cells, 11,003 of 652,283 same-facing opaque overlaps are exactly zero apart. 4,528 directed pairs (2,264 unordered) are bit-identical copies, all cmn_veg_needlepalm_a section 0 against section 1 under different keys. 6,475 directed pairs (6,191 unordered) are coplanar with different triangulation, 6,280 of them buildinggeneratorv2pg pieces (different keys in 6,434 pairs, the same key in 41); both sides of every such pair write depth. Observed

In game, two bit-identical opaque copies of the same triangles do not flicker, but which material shows differs between builds: at equal depth the later draw wins. A re-triangulated coplanar copy fights in bands. Observed

Not every blended stock surface is a decal. Reading the LOD 0 sections of every stock MeshSet in every superbundle TOC (126,599 sections; 35,433 distinct sections among those with a program row, 2,335 with none) and the render states of each section’s program row: Observed

  • Effects. 50 sections of 48 meshes have only programs that blend, write no depth and test no stencil. 47 are under effects/ (smoke columns, light shafts, contrails, objective tubes, UI effects); the others are two vista glow sections of world/terrain/ftue_bamvista_02 and one community-park wall. Observed Testing no stencil, they draw over whatever is behind them, opaque or not. Inferred Of nine such blend-only rows whose programs were decoded, seven test depth GreaterEqual with no bias and blend with the same factors as the decal programs (the premultiplied pair); [2142, 2589] blends with the glass rows’ factors below, and [49, 651] has a second program with depth bias −10 and other factors. Observed
  • An opaque base with a blended pass. 257 sections have a row that holds both an opaque, depth-writing, stencil-marking program and a blending program with no stencil test: emissive lamps (CMN_LGT_Emissive_M and kin on world/lighting fixtures), vehicle brake, signal and head lights, screens, signage, stained and dirty glass, and water. Observed The blending program of the glass, lamp and screen rows writes no depth and uses a different blend record from the decals’, the same factor for source and destination. Observed That record is additive (One, One), so the pass adds light on top of the opaque surface: stock glass is an opaque surface with a glow on top, not a pane that shows the scene through it. Inferred

Effect rows such as [1384, 1655] read the same vertex elements as the stock decal row 1444 (position, UV0 and tangent space), but the position as Half4 where row 1444 reads Float3. Observed

Programs Property Confidence
1444 (row 1444/3612) Stock decal state; Float3 positions; no shadow section Observed
825, 1891, 3096 (alpha-tested cutout row) Half4 positions relative to the object origin: 3.9 mm steps at 4–8 m, 31 mm at 32–64 m Observed
819 Equal depth test after the prepass Observed
3560 Depth prepass; writes stencil 0xfe, the mark decals test Observed
1262 Shadow pass, depth bias −10 and slope −4 Observed

The cutout row’s Half4 positions mean that a cutout layer a few millimetres over its base can round onto or below it. Inferred

Stock decal rows 1727 and 2718 read per-vertex opacity from Color0.r. Measured constant red values 0.25, 0.5 and 0.75 progressively increase visibility, independently of the other colour channels. Exact (0,0,0,0) is a sentinel that draws fully opaque, so it differs from (0,0,0,1). Observed

These rows use Half4 positions relative to an object origin. Around 100 m from that origin, half-float spacing is 62.5 mm; distant local coordinates can therefore introduce visible steps in overlay geometry. Observed

The following controlled arrangements are measured in game on ReSkate 2.1.0-pre. They establish the stated outcomes, rather than a general sorting algorithm. Observed

Arrangement Result Confidence
Layers are sections of one MeshSet Order varies between launches, stays the same across views within a launch Observed
Separate coplanar objects with identical bounds Order varies between launches Observed
Separate objects with identical world bounds (exact ties, or origins 1 mm apart) Order changes with camera position and between level loads; stable over time from a fixed viewpoint Observed
Separate objects, identical horizontal bounds, lifts 4/8/12 mm Lowest layer draws last, deterministically in the measured runs Observed
Bounds offset horizontally by 1 m Back-to-front order by bounds distance; the small lifts do not decide it Observed
Bounds padded 1 m apart behind the surface along its normal Nearest-bounds layer on top in 20 of 20 panels (two levels, ten viewpoints at 7–80 m), and one order across three launches and two builds Observed
Bounds 2 m apart along the normal with one common origin Nearest-bounds layer on top in 9 of 9 views; identical bounds with origins 1 m apart do not follow the origins Observed
FrontToBackSortEnable or SortBySystemOrderUserSlotEnable changed No measured effect on these arrangements Observed

Separate decal-class objects are ordered by their bounds, not their origins. Observed Sorting transparent objects by coarse bounds depth explains these outcomes, but the actual sort-key construction is not decoded. Inferred

Do millimetre lifts give overlays a stable order?

One measurement finds layers with identical horizontal bounds lifted 4, 8 and 12 mm drawing in a deterministic order. A later fixture series finds identical or near-identical bounds changing order as the camera moves, and treats millimetre lifts as giving no order. Observed Whether the lifted layers’ bounds differed enough to sort in the first measurement is not established. Unknown

With Mesh.ForceLod, a decal over a base whose LOD1 deviates by ±20 mm shows the base through 0.17 of its area at LOD1 and 0.42 at LOD2, against 0.04 (grid lines only) at LOD0: overlays coincident with LOD0 separate from coarser LODs of their base. Observed

Studio’s cell cuts can split sibling overlay ranks into different bounds, causing whole-layer changes with view angle even when the unsplit input objects share bounds. Observed

San Van also contains 489 placed EffectReferenceObjectData instances in the measured scene. This count does not decode the effect graphs behind those references. Observed