A single flake was drawn nearly opaque and lit only from the cab, a dark
speck against the lit snow outside at night. A thin flake is 45% opaque now
(full from 2.5 mm of snow) and the picture behind it is blurred, as through
ice crystals. No assets change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
A texel ahead of a blade took the lines of every neighbour pointing at it,
and the lines overlapped, so the snow pushed along grew at every step and
the ends of the sweeps filled with ridges even on a glass with hardly any
snow. A texel in the sweep takes only the line behind itself along the way
of the blade, one off the sweep the line of one neighbour. No assets change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
The snow piled in front of a blade slipped onto its lower neighbours, the
texels the blade had just wiped among them, so it left a stripe of snow on
the wiped glass at every step. Piled snow slips only where no working blade
goes over. No assets change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
A blade going over the texel holding the snow it pushes left 3% of all of it
there, a stripe of snow for every texel of its way; it leaves 3% of the snow
up to 0.03 mm now, and a wet trace of at most 0.015 mm. A thin film of water
dries and runs off in a few seconds, the water spots are fewer, the haze
needs more snow, the packed snow is whiter. No assets change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
A glass of mat_snow_windscreen (the material of the "snow:" block, with a
mask of the wipers) gets a slot of the windscreen water storage, as the
glasses of the water could, and two maps of its snow (a step reads one,
writes the other): the snow, the water, how packed the snow is and the shape
of its flakes for each of 256 x 256 texels of its uv. water_snow.comp runs a
step a frame, both APIs:
- the flakes land as many as come to the glass facing the snow against the
cab (and a few from the eddies), the dry ones bouncing off at speed;
- the blades take the snow they go over (a little stays, a wet trace) and
push it ahead of themselves, leaving it as ridges at the ends of their
sweeps; piled snow slips onto its neighbours into a wedge;
- the glass is warmer than the air (the cab is heated, less so at speed):
above zero the snow melts into water, slush slides down, dry powder is
blown along by the air at speed, the water runs and dries.
mat_snow_windscreen.frag draws the map: flakes from the atlas where the snow
is thin (water spots where it melted), a layer with a torn edge, as opaque as
it is thick, grey when wet, its relief from the slopes of the map; the wet
glass bends the picture behind through the post-processing. Without the
simulation the glass is drawn as before.
The glasses are found again when a material of the cab changes its kind
(the weather switched its shader). The drop passes run only for glasses of
the water. No assets change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
- rain_cells.glsl: wiper_miss 0.05 -> 0.0167, a blade leaves three times fewer drops where they were
- mat_snow_windscreen.frag (the snow glass, made for the game apart from this repository) added, asking
the post-processing for its haze and its bent picture through the velocity target as the rain and
the insects of this version do (rain_windscreen_haze.glsl)
No assets change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
The preamble of the vulkan renderer didn't define it, and with the constants of common.glsl skipped
(MASZYNA_CONSTANTS) the shaders didn't compile: the renderer failed to start and fell back to
opengl. Now defined by the preamble, and common.glsl defines it when the renderer doesn't (an older
exe with these shaders).
No assets change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
The glass took the rain fallen since one of the two moments the blades were at the ends of their
sweep, picked by the way the blade was going. After a pass that gave a place the blade had just
wiped the rain of the sweep before, until the blade reached the other end: the haze and the drops
there jumped back and forth with every sweep (a jump in brightness under the wiper mask, best seen
in a light rain).
Now the renderers keep, for 64 places along the sweep of each blade (the value of the wiper mask),
the rain fallen when the blade last went over them (gl::scene_ubs::wiper_rain_pass, marked for all
the places a blade went over since the last frame), and the glass reads the one of its pixel.
wiper_rain_out / wiper_rain_return are gone; the timers and the insects keep the ends of the sweep.
No assets change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
Some drivers (AMD's) define GL_SPIRV also when they compile the GLSL source, so settings.glsl took the specialization
constants, which a source can't have, and no shader compiled ("constant_id: only allowed when generating SPIR-V"). The game
always puts the values of the settings before a source it compiles, so those decide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
The game now counts the rain the glass meets (more at speed) and how wet the glass is (scene_ubs.rain_state: it fills with the
rain and dries when the rain stops), and the rain fallen when each blade was at the end of its sweep (wiper_rain_out/return).
The glass with rain gets as many drops, droplets, rivulets and as much haze as the heaviest rain gives, scaled by how wet it
is; where a blade went over it they come back with the rain fallen since. A lighter rain only takes longer: 95% full in 10 s of
the heaviest rain standing still, 20 s at cloud cover 1.5, 2.5x as fast at 100 km/h; half dry in 3 minutes standing still.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
A deer is put on the path the player's train goes along (world/deer.cpp), grazing. The horn
within deer.hornrange, or the train closer than deer.fleedistance, frightens it: it raises its
head, looks at the train and bounds away from the tracks, then grazes where it stopped. The deer
go once the train is past them; they aren't parts of the scenery (not saved, not edited).
Off unless eu07.ini turns it on: deer (no), deer.interval (2000 m), deer.distance (2000 m),
deer.chance (1), deer.hornrange (600 m), deer.fleedistance (150 m).
- mat_vat.vert (ogl46, vk14): vat_random -1, the game picks the clip and the moment of an instance
by the fraction of ten times its turn about the vertical, so one animation hands over to the
next in the very same pose. 0 and 1 work as before.
- TAnimModel::draw_alone(): an instance the game moves leaves the groups of its model.
- scene_walk::Queue_Model: the record of an instance drawn on its own is made anew when the
instance moved.
Assets (game data, installed locally in the game folder, not yet in the SVN; without them no deer
is made):
- models/animals/jelen_je.t3d, jelen_zryw.t3d, jelen_skok.t3d (the deer of jelen_lewo.t3d with the
head turned straight, three animations baked by jelen_anim2.py)
- textures/animals/jelen_{je,zryw,skok}.mat and their _vatpos_hi, _vatpos_lo, _vatnormal .tga;
diffuse animals/sarna_d_1, in winter animals/sarna_f_1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
A second pass of rain_cells.comp writes, for every drop cell, which of the drops of the 9 cells around reach each quarter of
it, so a pixel looks at those (usually 1 to 3) instead of all 9. The bias of the drop sizes is applied there too, and the
glass keeps fewer values through its loops (the frame of the glass and the lens are worked out after them, the rivulet of
the pixel is read again where it is needed), so more pixels run at once. The look is the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
The glass with rain worked out, in every pixel, the hashes and the life cycles of the 9 drop cells around it, of the rivulet
cells of its 5 layers and of those the drops are swept by. A compute pass (rain_cells.comp) now does it once a frame for every
cell into a buffer (rain_cells.glsl: RAIN_CELLS_SSBO in the pass set of Vulkan 1.4, binding 18 in OpenGL 4.6); the glass only
reads it, and asks the wipers only for the drops the pixel lies on. The hashes are the same, so the drops and the rivulets
are where they were.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
The shaders of the animation baked into textures, as tested in the game:
mat_vat.vert / mat_vat.frag for OpenGL 4.6 and Vulkan 1.4, and common.glsl
with camera_hi / camera_lo at the end of the scene block, matching gl/ubo.h
of this branch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
- mat_rain_windscreen (v49): longer wind rivulets of different widths, no
beads gathered by the blades
- mat_bugs_windscreen: the scene blurred only under the see-through parts
of a bug, no ring around it
- rain_windscreen_haze: exact codes of the drops (MSAA averaged edges are
neither a drop nor haze), the lights in the drops read in a round
footprint and fading away from the light
- postfx_taa / postfx_motionblur: the mark of the picture the TAA blurred
is negative (below any alpha of the scene; the TAA lock takes 0)
- vk14 postfx_dlss_motion: the codes of the windscreens aren't motion
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
The engine counts the insects the vehicle of the wipers meets (seconds of
driving at 100 km/h: nothing below 20 km/h, then (v - 20) / 80 a second) and
gives the count to the shaders in rain_wind.w, with the count of the moments
the blades were at the ends of their sweep in two new vec4 at the end of the
block of the scene (wiper_bugs_out, wiper_bugs_return, next to the timers).
mat_bugs_windscreen grows the dirt from the insects met since the glass was
clean instead of from the time, so a vehicle standing still gets no bugs and
a fast one gets them sooner (full after an hour at 100 km/h).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
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.