Skip to content

Terrain layer blending

RAGETerrainApplies toGTA V

The terrain_cb_* effects blend four diffuse and normal layers per pixel. In the inspected shaders, saturated COLOR1 channels (r,g,b) produce the following weights. Observed · shader disassembly

Layer Weight Confidence
0 (1-r)(1-g)(1-b) Observed
1 (1-r)(1-g)b Observed
2 (1-r)g(1-b) Observed
3 (1-r)gb Observed

Diffuse colour is the weighted sum of layer colours. Normal XY is also a weighted sum with bumpiness applied; the weights are not renormalized. Their sum is 1-r, so normalization would remove an authored influence of red. Observed · formula and shader inspection

*_cm* variants take green and blue from lookupTexture sampled at TEXCOORD1. *_2tex_blend* variants interpolate those lookup channels toward COLOR1.g/b using COLOR0.a. Red stays COLOR1.r. *_lod variants use vertex colour alone. Observed · shader inspection

The lookup is filtered in the shader. A texture sample in the interior of a triangle can therefore change weights without a corresponding change at any vertex. Observed

In terrain_cb_w_4lyr, the dry specular intensity is SpecularColor² and the falloff parameter is Specular; there is no independent specular material per layer. materialWetnessMultiplier[4] controls wetness, not four dry specular values. The inspected terrain output fixes Fresnel at 0.98. Observed · shader disassembly

Ambient occlusion in the terrain output (G-buffer target 3) comes from the vertex, not from the layers, and the output has no metalness term. Observed · shader disassembly

For terrain_cb_w_4lyr_pxm_spm, let S be the weighted sum of each layer’s height-map green channel. Intensity uses specularIntensityMultSpecMap * lerp(1, S², specIntensityAdjust); the corresponding falloff expression uses specularFalloffMultSpecMap * lerp(1, S², specFalloffAdjust), divided by 512 at the indicated G-buffer stage. Observed · shader disassembly

The deferred encoding must also be considered when interpreting a stored G-buffer value as an intensity or exponent. Observed