18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 07:07:05 +01:00
Commit Graph

332 Commits

Author SHA1 Message Date
Hirek c90113f4d3 fix(vulkan): textures filled by the host fall back to staging buffers where the driver can't make their images
On a GeForce GTX 1050 (driver 582.28) every DDS texture loaded in the background came out white: the driver reports
hostImageCopy for the format, but an image with VK_IMAGE_USAGE_HOST_TRANSFER_BIT can't be made (vmaCreateImage fails with
VK_ERROR_FEATURE_NOT_PRESENT), and the texture was left without a gpu image.

- The check of a format (once a format) also asks the allocator for the memory a trial image of the textures' kind would go to,
  and uses hostImageCopy only when there is such memory and it is device local.
- Each texture is checked against the limits of the format for that use (maxExtent, maxMipLevels), which were left unread.
- An image the driver still can't make is made again without the host transfer usage and filled through a staging buffer, and
  the rest of its format goes that way too.
- The log says once a format which way its textures go.

Devices where hostImageCopy works keep it: the check is made once a format.
2026-11-30 23:37:40 +01:00
Hirek 0409591b72 fix(vulkan): the cab drawn early writes all of its depth again
Without rain or snow the colour pass draws the cab first (9b7d02e5). Since
the depth of the prepass is kept for the alpha tested draws (ff2ff308),
the cab drawn first fell under that too: its screens, stickers and desk
lamps wrote no depth of their own, and what came after them, the scene and
the simplified desk (cab1) of the outer model a few centimetres behind,
came through in patches cut along the triangles. The released exe shows it
as well.

The early cab now writes its depth, as in the rain and in the OpenGL
renderer; the rest of the scene keeps the depth of the prepass as before.
2026-11-30 20:51:52 +01:00
Hirek a98005cfaf Merge pull request #570 from MaSzyna-EU07/fix/vulkan-kept-depth-decals
fix(vulkan): stickers on vehicles no longer vanish behind the body seen at an angle
2026-11-30 19:10:33 +00:00
Hirek ae2ce61e9a fix(vulkan): stickers on vehicles no longer vanish behind the body seen at an angle
With the depth prepass of the scene, the colour pass of the alpha tested
materials (default, normalmap, pbr, ...) doesn't write the depth the prepass
drew (keepdepth) and tested it without a bias. The prepass draws everything
a little farther (constant -1, slope -1), so a surface lying up to a pixel's
worth of the slope behind the front one passed as well, and the one drawn
last covered the other. Seen from the side a few metres away that is more
than a millimetre: the warning stickers 1 mm off the buffer beam of the EP07
(303e) vanished under the beam, drawn after them.

Those draws now test their depth with the bias of the prepass, nearer by two
units and 1/16 of the slope (the position is invariant in both programs).
The colour pass sets its bias in apply_draw_state() for the kept draws and
the decals together; the depth drawn inside the colour pass holds its own.

The OpenGL 4.6 renderer writes the depth in its colour pass and isn't
affected. No asset changes.
2026-11-30 20:09:18 +01:00
Hirek 4c30fe4c3b Merge pull request #569 from MaSzyna-EU07/fix/snow-layer-driver-crash
Fix/snow layer driver crash
2026-11-30 19:04:16 +00:00
Hirek 3629f5051d Merge pull request #567 from MaSzyna-EU07/fix/freespot-far-cull
fix(render): the lamps of small scenery models are seen from afar
2026-11-30 19:04:05 +00:00
Hirek 40a39ad390 Merge branch 'staging' of https://github.com/MaSzyna-EU07/maszyna into fix/snow-layer-driver-crash 2026-11-30 19:40:15 +01:00
Hirek 48b7c679a0 Windscreen snow: no crash of the simulator when the driver's compiler faults
A player's simulator (Vulkan, GeForce RTX 4060, NVIDIA 610.88, through Steam) crashed at every start
as the cab loaded: an access violation (read of address 8) inside nvgpucomp64.dll while
vkCreateComputePipelines compiled water_snowlayer.comp. The crash came on $baltyk_skm1.scn and $td.scn
alike, at the same address in the driver.

The snow shaders (shaders/vk14 and shaders/ogl46, the same in both) no longer use what the
compute shader alone had: a vector component written at an index known only while running through an
inout parameter (snRef), constant arrays of structs and of ints indexed at run time (sn_grids,
sn_lump_tiles, the neighbours of snSpan) and a local vec4 indexed by the blade. They are worked out by
small functions and explicit components instead (snRefPut, snRefWord, snGrid, snLumpTile, snNear),
and the blade is read from the storage as water_snow.comp, which the same driver compiled, does.
The results are the same. glslc compiles both variants and spirv-val passes; whether 610.88 compiles
them now can't be checked without that driver.

So that a driver crashing on a program the renderer can go without doesn't take the simulator down,
the programs of the windscreen water are made under gfx::DriverCrashGuard
(rendering/common/drivercrashguard.*):
- with msvc the fault of the driver is caught (SEH) and the session goes on without the program: the
  glasses without the snow, or without the simulation of the water;
- the program is written down in the cache of the renderer (driver_crash_attempt.txt) before the driver
  gets it and crossed out after. a program a session ended on is suspect (driver_crash_suspects.txt);
  when a second session ends on it, or when a fault was caught, it is recorded (driver_crashes.txt) and
  not made again with that driver. a new driver or a changed program is tried again;
- Vulkan makes these pipelines without the VkPipelineCache, whose lock a faulting driver might leave
  taken (the drivers keep their own cache on the disk).

Tested: unit tests (1211/1211, with a caught access violation), Vulkan and OpenGL 4.6 in the cab of
303E on $td.scn (RTX 4070, 621.14), and on Vulkan with a real access violation injected into the
pipeline of water_snowlayer.comp: the session went on without the snow, the next one skipped it.

No change of the game data.
2026-11-30 19:39:29 +01:00
Hirek 269591fc35 fix(render): the lamps of small scenery models are seen from afar 2026-11-30 18:48:43 +01:00
Hirek 7d3ccd6dc4 Textures: read KTX2 files (BC1-BC7, RGBA8, zstd) in both renderers
The game now reads .ktx2 texture files, for the OpenGL 4.6 and the Vulkan
renderer alike (texture_source::load_KTX2(), parser in model/ktx2.*):

- formats: BC1 (RGB and RGBA), BC2, BC3, BC4, BC5 (unsigned and signed),
  BC6H (unsigned and signed float), BC7, and plain R8G8B8A8 / B8G8R8A8;
- the levels stored as they are or packed with zstd (the bundled zstd);
  with gfx.textures.streaming the worker threads read and unpack them;
- the KTXorientation key is honoured: "rd" files are flipped to the bottom
  row first, BC1-BC5 block by block, plain texels row by row. BC6H and BC7
  can't be flipped without decoding: an "rd" file of these is loaded as
  stored, with a warning in the log, as the BC7 dds files are. A file
  without the key is taken the way the dds files are (ddsupperorigin);
- srgb or linear colour is chosen by the material, as for the dds files;
- the alpha of BC7 is checked on a small level, as for the dds files.

Not supported, refused with the reason in the log: Basis Universal
(ETC1S / UASTC, BasisLZ), zlib supercompression, arrays, cube maps and
3d images.

BC1 without alpha, BC4, BC5 and BC6H are new formats for the renderers:
opengl_texture::mapping and the Vulkan texture_format_of() map them (no
srgb variants for BC4/BC5/BC6H; their alpha reads 1).

.ktx2 is looked for right after .dds (textures, materials, the editor's
texture browsers). Existing data holds no .ktx2 files, so nothing changes
for existing sceneries and vehicles, and no asset change in the SVN is
needed.

Unit tests: tests/unit/test_ktx2.cpp (header, levels, zstd, orientation,
refused files, flipping of BC1-BC5 and plain texels).
2026-11-30 15:08:45 +01:00
Hirek cabd53a01c Merge pull request #382 from pwarszawski/fix/gl46-text-displays
fix(gl46): station name boards show their text
2026-11-29 17:40:25 +00:00
Hirek fe45bb5811 Merge pull request #374 from pwarszawski/fix/glare-occlusion
fix(gl46): no more glares of light points through walls
2026-11-29 17:39:59 +00:00
Hirek 969864f204 Merge staging into cleanup/mover
The windscreen weather (#367) and the compiler cache of the CI (#434). The
wipers' code of both renderers takes staging's side, reading the active cab and
the speed through TDynamicObject (ActiveCab(), Speed()) as the renderer does on
this branch; the windscreen water reads the speed the same way, and the deer
(world/deer.cpp) read the vehicle through its queries (V(), WarningSignal(),
CabOccupied()).

The golden traces recorded on dfb43c4f still match bit for bit: staging didn't
touch the physics.
2026-11-29 16:55:25 +01:00
Claude 7cea551157 Wipers and insects: the views from outside the cab follow the train driven
The new views of the consist put the camera at any vehicle of the train, one with an active cab of
its own too: taken for another vehicle, it wiped the insects met and the memory of the blades, so
the insects were gone from the glass after a change of the view. Outside the cab (FreeFlyModeFlag)
the glasses now follow the train driven, in both renderers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 12:53:29 +01:00
Claude 5d6f443450 Review 28.11: rain cells always bound, the velocity target and the blur pass only when needed
- the cells of the rain: the opengl renderer makes their storage (cleared) with the first bind and keeps it
  bound, the glasses read the cells only when they were worked out in the frame (scene_ubs.rain_state.w,
  both renderers): never the storage before the first rain, nor the stand-in of the vulkan renderer
- the pass of the motion blur and (opengl) the velocities drawn only in the frames which need them: the
  motion blur with something moving, the taa, or a glass of the rain, the insects or the snow in the view
  (windscreen_water::wants_glass_requests(): the cab seen from inside has one, or the view is not from the
  cab). the glasses keep their drops and haze with the motion blur off, the motion is blurred by 0 then

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 12:53:29 +01:00
Claude d8dc11aab2 Rebase onto staging (after #531)
The vehicle's physics is TDynamicObject::physics now (physics::Vehicle): the wipers, the insects and the
rain of the glasses, the snow of the windscreen water and the deer take it from there. The includes of
staging kept in opengl46renderer.cpp; the texture check of staging first in
Render_Instances_Indirect_Shadow(), then the materials with a vertex shader of their own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:53 +01:00
Claude 5ce5a531b8 Windscreen water: a glass with drops is one with an atlas of drops, not of the snow (wants_rain_cells())
mat_rain_windscreen has no param water_slot (only the glasses of the snow have a slot of their own), so wants_rain_cells() never found the glass of the rain and the cells weren't worked out: the glass showed only its fine droplets. A material of the cab with raindropsatlas and without snow_slot now (the insects too, which don't come with rain).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:15 +01:00
Claude 160e8b8a46 Windscreen water: the review of 27.11 (the snow list stops when full, the cells of the rain only for a cab with a glass of the rain)
- snList() stops listing when its SN_REFS are taken: no lumps worked out for nothing, and the cover of the texel counts only the
  sprites the glass lays (no gaps where it took the dropped ones for covering); OpenGL 4.6 and Vulkan
- update_rain_cells() gets no rain for a cab without a material of the shader of the rain in this weather
  (windscreen_water::wants_rain_cells(); as before when the simulation isn't used)
- Vulkan: a rain-cell buffer which can't be made leaves the glasses with rain dry (a small stand-in the pass sets hold) instead of
  failing the whole windscreen water; it is still made at the start, since the pass sets and those of the cullings hold it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:15 +01:00
Claude a9579a9841 Rebase onto staging (after #468): the water programs made ahead with the snow passes and the rain cells
- opengl46water: the two passes of the snow join PROGRAM_NAMES and prepare_next() (#476), optional as before: one which doesn't
  compile leaves the snow out (both passes) and the rain working; rain_cells.comp is made ahead too (its storage still waits for
  the first rain), so the first rain doesn't compile it in the middle of a frame; program_count() counts it
- vulkan14indirect: the path of the materials with their own shadow program passes the pending flag of multidraw_program()
- opengl46renderer.h: staging's shader_prewarm kept with m_ownvertexprograms / m_materialshadowprograms

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:15 +01:00
Claude 29dcfd3769 Drop what the rebase fix-up c0ebdd5 brought back that the base no longer has
The second "null" renderer branch of select_gfx_backend(), the opaque text displays (Render_text) and the catch of
std::exception in scenarioloader_mode::update(): the base's own code again (std::runtime_error, its own null branch).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:15 +01:00
Claude 05be4bff29 Windscreen water: the passes of the snow are optional
A snow kernel that doesn't compile (as water_snow.comp did on NVIDIA) leaves the glasses of the snow clear and the rain working, instead of disabling the whole simulation (OpenGL 4.6 and Vulkan).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:15 +01:00
Claude ab3b0e1565 Moths: a swarm doesn't flip its visibility at the range of the lamp lights
A swarm shown before stays shown while its lamp is out of the lights of the frame by its distance (the range of its node hides it there), so node_state_version changes only when a lamp goes out, not each time the camera passes the range.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:15 +01:00
Claude d896c7d81d Windscreens: the insects and the rain the glass meets advance once a frame, not once a view
The step is taken in the first view of a frame (the views of a frame share its time); OpenGL 4.6 and Vulkan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:15 +01:00
Claude 5fe115657f Windscreen snow: a glass takes its slot on the material the cab has now, no fallback to the first glass in the shader
The renderer may give a glass a fresh copy of its material after the weather changed; the glass keeps its first submodel and re-resolves its material in assign(true). The fallback of mat_snow_windscreen (any material without a slot took the snow of the first simulated glass) is gone (OpenGL 4.6 and Vulkan).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:14 +01:00
Claude da8f06dde1 Rebase onto feat/gl46-migration: the code of the base the replayed hunks covered, back
The rebase replayed the hunks of this branch over the ones of feat/gl46-migration where both touched the same lines; this brings
back what of the base they covered: the null renderer, the black box of the camera, the opaque text displays, the motion blur of
the free camera (OpenGL 4.6 and Vulkan), the scenario loader catching std::exception. The log keeps off the console in test mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:14 +01:00
Claude 48e4ef517f Windscreen water (OpenGL): the mask of the wipers read for the kernels [skip ci]
The OpenGL renderer reads a texture when a draw binds it. The glasses never
draw the mask of their wipers, only the kernels read it, so under OpenGL the
mask stayed unread, the glass was never baked and had no map: no snow (the
log said "glass 1 not baked yet" for good). The kernels now have a texture
they read loaded from its file when nothing read it yet. Vulkan reads its
textures without a draw, so it had this right.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:14 +01:00
Claude 04e877ffa6 Windscreen snow: compiles with the NVIDIA OpenGL driver, the state of the glasses in the log [skip ci]
- water_snow.comp named a variable "packed", a reserved word of GLSL: the
  NVIDIA OpenGL compiler refused the program, so the whole simulation of the
  windscreens was off under OpenGL. Now "packing".
- mat_snow_windscreen.frag: a material without its slot takes the first
  glass whose snow the simulation keeps.
- The log says, once it changes, whether each glass is baked, what it was
  built as and what its material is now, whether its snow is simulated,
  and whether the layer of the snow is laid: to find why the snow stays off
  under OpenGL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:14 +01:00
Claude c4d32ef85f Windscreen bugs: counted from none once the rain or the snow stops, none in winter [skip ci]
The insects were counted all the time the vehicle drove, so a glass turning
to mat_bugs_windscreen after snow or rain (or after winter) showed at once
all it had met meanwhile. Now the count stays at none in winter and while it
rains or snows (the rain or the snow washes them off), and what the blades
left of them before is forgotten.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:14 +01:00
Claude cc5bf11373 Windscreen: no drying or melting after the precipitation; the glass clears at once [skip ci]
Reverts e8a0e78 (kept on the branch stan/szyby-schniecie-2026-11-14).
The glass fills with rain only while it rains ("rain:" with precipitation)
and is clear at once when it doesn't: the rain stopped, or the glass holds
snow, so a glass switched from snow to rain starts dry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:13 +01:00
Claude 4d993908f5 Windscreen: rain keeps its last state and dries, snow stays and melts after snowfall [skip ci]
- Rain drops, rivulets and micro droplets run on a rain clock (rain_state.w)
  that only advances while it rains, so they freeze when the rain stops and
  fade as the glass dries.
- Glass wetness fills only during "rain:" weather.
- Snow glasses keep their snow material after snowfall ends (until rain),
  so the snow stays, melts above 0 C into a wet film and drops, and dries.
- The baked snow layer uses a larger drop share while melting.

No new assets; no change to file formats.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:13 +01:00
lcddisplay 3de73b0e85 Windscreen snow: the layer over the rectangle of the glass, one for the cab
The layer of 1024 x 1024 texels over the whole uv gave a glass taking a part
of its texture too few of them (the EP09 104ec: ~470 across the glass, 1.8
pixels of the screen a texel at 1080p), so the lumps came out soft. Now the
layer lies over the rectangle of the uv the glass takes, its 2M texels across
and down as the glass is wide and high (~1 mm a texel); the renderer works
it out from the map of the glass when it sets the glass up and puts it in
the storage (water.glsl, water_layer_rect).

One layer, for the first glass of the snow of the cab (a cab has one as a
rule); a second one lays its snow at every pixel as before the layer, the
same look, slower. The storage of the water: 58 MiB before the layers,
82 MiB now (106 MiB with the four layers of 1024 x 1024).

No assets change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:13 +01:00
lcddisplay 02a0de85c2 Windscreen snow: lay the sprites into a layer of the glass, the glass only reads it
The glass of the snow laid its nine grids of lumps (81 cells) and its flakes
at every pixel in every frame, ~6-9 ms of the GPU at 1080p. Now a compute
pass (water_snowlayer.comp, the sprites in snow_sprites.glsl) lays the snow
of a glass into a layer of 1024 x 1024 texels over its uv after the step of
the snow: a band of every 8th row in a step (the snow under a lump changes
slowly) and at once wherever a blade went over the glass. The glass reads
the layer filtered (mat_snow_windscreen.frag), as the glass of the rain
reads its cells. Laid front to back: a texel stops once the snow over it
covers it, and a cell reads the map only when its sprite reaches the texel.

The storage of the water grows by the layers, 12 MiB for each of the four
glasses. The look stays as it was.

No assets change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:13 +01:00
lcddisplay ba3129275c Snow windscreen: the snow of the glass simulated on a map that keeps it
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
2026-11-29 11:39:10 +01:00
Claude 87ef243169 Vulkan: define WIPER_PASS_BUCKETS for the shaders
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
2026-11-29 11:39:10 +01:00
Claude 2fe11d39a1 Rain windscreen: the rain fallen since a blade went over each place of its sweep
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
2026-11-29 11:39:10 +01:00
Claude dbad19b92a Rain windscreen: the glass fills up to full in any rain, more slowly in a lighter one
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
2026-11-29 11:39:10 +01:00
lcddisplay 8050ea8eb6 Deer at the tracks: graze ahead of the train, take fright at the horn and bound away
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
2026-11-29 11:39:10 +01:00
lcddisplay d8f0c46c7f Sun shadows of the gpu culling: the replayed walks keep the parameters of the materials
A walk kept from an earlier frame (gfx.gpucull.walkcache) gave the draws of the
shadows the parameters the pass had at the moment, not those of their
materials. mat_vat.vert reads vat_speed from them in the shadow too, so the
shadows of the animals and people animated by textures stood still on
Vulkan with gfx.gpucull.shadows. The common shadow programs read none of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:10 +01:00
Claude 77e4abadae Rain: the cab in the depth prepass also in the rain
In the rain the cab is drawn after the precipitation (so the rain inside it is hidden), and it was left out of the depth
prepass too, so the opaque pass shaded everything behind it. Its depth now goes into the prepass in any weather (Vulkan 1.4,
and OpenGL 4.6 without gfx.depthprepass.replay); the colour of the cab is still drawn after the rain, so nothing changes in
the picture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:10 +01:00
Claude 91d5851ea4 Rain windscreen: a glass looks only at the drops which reach the quarter of its cell
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
2026-11-29 11:39:09 +01:00
Claude 394e252daf Rain windscreen: the cells of the drops and rivulets worked out once a frame
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
2026-11-29 11:39:09 +01:00
lcddisplay 339d70a6e6 Moths fly about the lit lamps of the scenery
A part of the lamps of the scenery models which shine downwards (moths.share,
picked by the places of the lamps) gets a swarm of moths: an instance of
animals/cmy.t3d (animated by textures, shader vat) put at the light point when
the lamp first comes within moths.range of the camera. The swarm is shown while
its lamp shines (the light points gathered by the local lights in the frame),
not in the winter and not below moths.temperature. The swarms are made by the
game (basic_node::m_generated): not saved with the scenery, not edited.

Settings (eu07.ini): moths yes/no, moths.share 0-1 (0.4), moths.range metres
(80), moths.temperature degrees (8). Also in the debug window of the lights.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:09 +01:00
lcddisplay 0df374a5e9 Vulkan 1.4: a material can have its own vertex shader, mat_<name>.vert, also in the sun shadows
As in the OpenGL 4.6 renderer: Fetch_Shader() takes shaders/vk14/mat_<name>.vert when the file is there (the animals and
people animated by textures, mat_vat.vert), vertex.vert otherwise; the multi draw variant is made of the same one. Such a
material gets the programs of its sun shadows with it: its vertex shader with MATERIAL_SHADOW and (alpha)shadowmap.frag,
drawn with all its textures and its params, also from the gpu culling (the draws of one such material go together). The
cube maps of the lamps keep their programs, the depth prepass leaves these materials out (prepass class 0).

The scene block carries the rotation and the place of the camera of each sun cascade and headlight map (inv_view,
camera_hi, camera_lo, gl::set_camera_place()), and those of the view in the colour pass, so the shaders see a model in the
world the same way in every pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:09 +01:00
lcddisplay 2b415fdb16 Textures with the trait r are kept as they are; the scene block carries the place of the camera of the pass
A texture named with :r (the frames of the animations baked into textures, mat_vat) is never scaled down to maxtexturesize
nor compressed by the driver with compresstex: its texels are data, not a picture.

gl::scene_ubs::camera_hi, camera_lo: the place of the camera of the pass in the world, which the models are drawn relative
to, split so both parts are exact in floats. Set with inv_view in every pass that has it (the color pass, the faces of the
environment map, the sun cascades, the headlight shadows, the previews). mat_vat.vert takes the place of a model in the world
from them, so models standing turned the same way still get a moment of the animation of their own, the same in every pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:09 +01:00
lcddisplay f3b70c3886 OpenGL 4.6: the scene block carries the rotation of the shadow pass's own camera
The sun cascades and the headlight shadows draw with the camera of the light, but inv_view stayed the one of the color pass.
mat_vat.vert takes the turn of a model in the world from inv_view and the modelview, so in the shadow passes it saw another
turn, gave the animation another moment, and the shadows of the animated people and animals lagged behind them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:08 +01:00
lcddisplay fd3d081191 OpenGL 4.6: a material can have its own vertex shader, mat_<name>.vert
Fetch_Shader() links mat_<name>.vert with the fragment shader of the material
when the file is there (people animated by textures, mat_vat.vert), the common
vertex.vert otherwise. The multi draw variant takes the same shader with
MODEL_DRAWS. The sun shadows of such materials go through the same vertex
shader with MATERIAL_SHADOW and (alpha)shadowmap.frag, with the textures and
params of the material bound; in the indirect shadow pass they are drawn one by
one. The depth prepass leaves them out (Prepass_Class() 0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:08 +01:00
Claude 03766899af Windscreen post pass in every frame: drops and haze also standing still, with any anti-aliasing
The velocity target is always drawn and the motion blur pass always runs;
the motion itself is blurred only when the motion blur is on and something
moves (by 0 otherwise). The rain and bugs windscreens send their drops and
haze through it, so they look the same with MSAA, TAA or none, moving or not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:08 +01:00
Claude 12d7fbb00e Windscreen bugs from the insects met: none below 20 km/h, more the faster
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
2026-11-29 11:39:08 +01:00
Claude a9d9c74a70 Keep the wiper timers of the windscreen when the camera leaves the cab
The moments the blades were at the ends of their sweep (wiper_timer_out /
wiper_timer_return, the drops on the glass come back from then) were set to
-1000 whenever the camera wasn't in an active cab, so the glass came back
fully wet on the return to the cab, and stayed so until the blades reached
the end of their sweep again.

They now follow the train driven while the camera is outside it (or the
vehicle of the camera, as before, when it's in an active cab) and are kept;
they're forgotten only when another vehicle is followed. Both renderers
(OpenGL 4.6 and Vulkan).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:08 +01:00
Hirek d28b908ca4 refactor(render): the renderer reads a vehicle through TDynamicObject, not its physics
No file of rendering/ includes physics/vehicle.h any more. What the renderers
read of a vehicle comes through a few queries of TDynamicObject
(vehicle/dynamic/lights.cpp): its dimensions, its speed, its active cab, the
light of its compartments, the adapters of its couplers, the lights switched
on at an end, the low voltage for them, and the multiplier and the colour of
its headlights. The shares of the speed and the opacity of the exhaust smoke
(ExhaustScales()) move out of the particles into the vehicle, as they are.

The headlights pick their multiplier once, by the dimming and the high beam
switches, where the light array repeated the same four branches twice; the
light of a switched off end still goes to zero as before.
2026-11-29 10:43:31 +01:00