mat_rain_windscreen draws the drops, the micro droplets and the rivulets from
an atlas of drops with its normal map (textures/fx/raindrops-atlas and
raindrops_normalmap, the 2x2 drops on the left, the rivulet sprites on the
right): the drops land, grow and run down, the wipers clear them and they
come back, the air at speed drives many small drops with trails (some of
them long), the haze over the wet glass grows with the rain fallen since the
wiper went over it.
The glass asks the post-processing for its haze and for the view bent by its
drops in the velocity target (rain_windscreen_haze.glsl); postfx_taa.frag
does it every frame with the temporal anti-aliasing (the drops blended with
the last frame at the same pixel, so they don't shimmer with its offsets),
postfx_motionblur.frag without it. The picture of this frame with the depth
of the whole frame, so the cab is never pulled into a drop; the bright
lights of the haze kept from smearing (a karis average with the light it
loses given back up to a limit), the lights in the drops from the mipmaps of
the image of the reflections (OpenGL 4.6).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
The spring / summer dirt of the windscreen, ported from the OpenGL 3.3 shader:
insects splat on the glass one by one until it's fully dirty after an hour of
simulation time, the wipers wipe them off where they sweep, a ring of blur
around every splat. The .mat blocks of the seasons name it (szyby.mat of the
cab), and it was missing from both renderers ("cannot read shader").
The syntax of the 4.6 renderers (locations, bindings, #pragma texture /
param, the tuning values as constants), the blur ring through the velocity
target as the haze of rain_windscreen, the colour written straight as
rain_windscreen writes the glass, and no lighting where the glass is clear.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
The motion blur took the movement of the vehicle the camera sits in and nothing else, so in freefly (and the
debug camera) the world got no blur from the camera at all. Low over grass the texture under the camera then
moved tens of pixels a frame and strobed: rings around the camera, at the distances its pattern repeats,
stronger with shift and ctrl, gone above about 20 m, worst on a 165 Hz screen.
* the camera with no vehicle of its own blurs the world with its movement since the frame before, as a vehicle
does with get_future_movement(); a jump of 50 m or more (a camera preset) is no movement
* that movement is held to half a metre a frame: the blur takes the scene where the camera will be, and a
camera faster than that passes the ground at the bottom of the screen within a frame, where its motion turned
over into a bright band. with the shutter of the blur it still smears metres
* the blur shader skips samples off the picture instead of reading its edge row again and again
The sides of the trackbed (and grass, fences, foliage) are cut out of their
textures by the alpha test, which keeps or drops whole pixels, so their edges
stayed jagged at any multisampling level; only geometry edges got smoothed.
With multisampling on, the alpha tested materials of the opaque colour pass
now draw with GL_SAMPLE_ALPHA_TO_COVERAGE. Their shaders do the alpha test
with alpha_test_fail() of glsl_common and write as alpha the coverage of the
test edge: the alpha sharpened around the opacity threshold to go from 0 to 1
over about a pixel, so the edge keeps the place it had and gets the samples
it covers. The renderer turns alpha to coverage on per material, only for
shaders which use the helper and only in the opaque pass with a positive
opacity, so translucent, water, terrain and the other shaders are unchanged.
Without multisampling the shaders work as before.
Matte_Material() gives a copy of a material with its glossiness damped and its weathering on: the faces cut out of a polished surface, as the sides of a worn rail head, darken and lose the shine by the userdata of their vertices. Tinted_Material() gives a copy whose texture is tinted to a colour as far instead. Both are made once per material.
The weathering and the tint colour have a param slot of their own, param[3]: the shaders of the materials use all four components of param[2] among them (detail, parallax, water, the terrain placement), and light_common.glsl is included in all of them. MAX_PARAMS grows from 3 to 4, the model UBO by 16 bytes. Neither copy is made when another param of the shader lies on the components it would set.