18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-15 21:04:13 +01:00
Commit Graph

13 Commits

Author SHA1 Message Date
jerrrrycho
04b55c866a fix(render): alpha to coverage only where it is on, full coverage on flat alpha
Review of the alpha to coverage change for alpha tested surfaces:

- An alpha which is flat over the pixel (fwidth 0) and equal to the opacity
  threshold got a coverage of 0.5, so e.g. opacity 1 on an opaque or DXT1
  texture turned half see-through with multisampling. Without an alpha edge
  in the pixel the plain test decides now: step(opacity, alpha).
- The shaders took the coverage path whenever they were built with
  multisampling, also where alpha to coverage is off (the reflections pass)
  or does nothing (the single-sampled model previews), and grew the cut-outs
  there by about half a pixel. model_ubo gets an alpha_to_coverage flag, set
  together with the GL state, and the shaders keep the plain alpha test
  without it. The previews no longer turn alpha to coverage on. The flag
  takes 4 of the 12 padding bytes after shadow_tone, so the std140 layout and
  the size of the block stay the same.
- The shader validator never set iMultisampling, so it never compiled the
  alpha to coverage branches. Its "features on" configuration uses the
  default of 2 now, on desktop GL and GLES.
2026-11-08 20:03:32 +01:00
jerrrrycho
aecc73e893 fix(render): antialias alpha tested edges with multisampling (eu07/maszyna#449)
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.
2026-11-08 01:34:35 +01:00
3419666070 scale/endscale/localscale per node model 2026-05-10 13:12:49 +02:00
587077629f Enable instancing 2026-05-09 23:29:20 +02:00
Wls50
b4737712de support cabview rain effect 2025-11-21 22:43:24 +01:00
milek7
56eba08a6f CI shader validation 2021-01-21 15:51:03 +01:00
milek7
1c40578d26 ubo padding fixes 2020-10-21 17:59:27 +02:00
tmj-fstate
2ce3091e8f line breaker cab control enhancement, minor bug fixes 2020-02-02 22:30:36 +01:00
tmj-fstate
14699a96de build 200101. opengl 3.3 renderer projected headlights 2020-01-01 20:41:05 +01:00
tmj-fstate
63619d13a6 opengl 3.3 renderer cascaded shadow maps, minor gfx renderer optimizations 2019-12-05 17:19:49 +01:00
tmj-fstate
194400e1af inversed view transform uniform 2019-11-29 16:20:21 +01:00
tmj-fstate
a74402804d gfx renderers standardization, bug fixes 2019-11-07 00:28:59 +01:00
tmj-fstate
0fd23a53d9 milek7/sim branch opengl 3.3 renderer import 2019-10-26 15:17:09 +02:00