Skip to content

Light records and attenuation

RAGELighting and skyApplies toGTA V

Drawables and fragments carry authored light lists. Records distinguish point (1), spot (2) and capsule (4) lights and store position, colour, intensity, range, time flags, direction, cone angles and additional shadow/volume/corona parameters. Observed

The proven light-record fields below are read for every light list in the accepted version-159 YDR/YDD and version-171 YFT corpus. The whole-resource census rejects unknown light kinds, non-finite values and unexpected reserved words and reports no such failures; fifteen other-version YDR copies are excluded. Runtime placement, hour examples and CPU-to-shader mappings have separate evidence scopes. Proven · all accepted drawable resources

Light positions and directions are in the space of the bone named by bone_id. A fragment can supply its own bone pose; otherwise the skeleton’s composed rest pose places the light in drawable space before the entity transform. Observed

LightAttributes168 bytes32% known
ProvenObservedSourcedInferredUnknownNot described
OffsetSizeTypeFieldConfidenceNotes
0x08bytesunknown zero wordsUnknownzero in inspected records
0x812vec3positionProven
0x144u32unknown zero wordUnknown
0x183RGB8colourProven
0x1B1u8flashinessSourced
0x1C4f32intensityProven
0x204u32flagsSourced
0x242u16bone tagProven
0x261u8kindProven
0x271u8group IDSourced
0x284u32time flagsProven
0x2C4f32falloff rangeProven
0x304f32falloff exponentSourcedCPU mapping to shader attenuation k is unknown
0x3416vec4culling planeSourced
0x441u8shadow blurSourced
0x457bytesunknown zero bytesUnknown
0x4C4f32volume intensitySourced
0x504f32volume size scaleSourced
0x543RGB8volume outer colourSourced
0x571u8light hashSourced
0x584f32volume outer intensitySourced
0x5C4f32corona sizeSourced
0x604f32volume outer exponentSourced
0x644u8[4]light-shadow-specular-volume fade distancesSourced
0x684f32shadow near clipSourced
0x6C4f32corona intensitySourced
0x704f32corona Z biasSourced
0x7412vec3directionProven
0x8012vec3tangentProven
0x8C4f32inner cone angleSourced
0x904f32outer cone angleSourced
0x9412vec3capsule extentSourced
0xA04u32projected texture hashSourced
0xA44u32unknown zero wordUnknown

The low 24 time-flag bits select hours; a zero hour mask means always on in the documented light interpretation. Sampled street lamps carry 0xF0003F, selecting 00–05 and 20–23. Their emissivenight lamp-head materials are also dark by day; Prop_StreetLight_head has EmissiveMultiplier 16. Observed

Night therefore has three hour-keyed parts: light records by their time flags, emissive night materials, and night-only geometry that its vertex shader collapses by day. Observed

Executing the sampled point-light and directional-light pixel programs under Microsoft WARP confirms that their diffuse terms share a global scale G: point lighting uses G * colour * intensity * window * albedo * NdotL, while sunlight uses G * sun * albedo * NdotL. The point-light radial window is s / ((1-k)*s + k), with s = saturate(1 - d²/R²). This is evidence for these compiled programs and tested inputs. Proven · WARP execution

The programs are PS_pointCM_standard_6a549d93 (variant 0) and PS_directional_just_dir_789981ad. Over 112 point and 20 sun cases, the formulas match the executed programs to a relative error of at most 1.5e-7. Neither has a 1/π, a factor of two or an exposure term; the albedo they read is the square root stored in the G-buffer, squared. Proven · WARP execution

Constant Meaning in the point-light program Confidence
lighting_locals (cb9, space 1) row 3 xyz Light colour Proven
lighting_locals row 3 w Intensity I Proven
lighting_locals row 4 z 1/R² Proven
lighting_locals row 7 x Falloff scalar k Proven
misc_globals row 14 z Global scale G, shared with the sun program Proven

The shader window is not inverse-square attenuation. CodeWalker’s renderer uses a different curve, (1-d)/(1+k*d²), which does not establish the game’s compiled shader response. Observed · shader disassembly

How do authored light values become shader constants?

The CPU mapping from falloff_exponent to shader k, the absolute photometric units and any CPU intensity scale are unresolved. Shader execution establishes the constant-to-pixel equation, not those upstream mappings. Unknown

The stored exponents range from 8 to 256 over the 107 lights of the Legion Square area. Observed The mapping matters: at half the radius the window is 0.75 / (0.75 + 0.25k), so with k equal to the exponent, lights of exponent 8, 32 and 64 are 2.75, 8.75 and 16.75 times dimmer there than with k = 1. Inferred