Commit c80024b
#Bugfix(terrain): stop black terrain cells on maps with more than 32 terrain textures.
The per-material splat bake gave every terrain material its own weight channel across the whole map, and the
terrain pixel shader reads at most 32 (8 weight textures x 4 channels, with every ps_3_0 sampler already in use).
Materials past the 32nd got no channel, their cells summed zero weight and drew pure black. USA mission 1 uses 37.
Slot selection was also keyed on a texture's position in the map's list rather than on the materials in use.
Weight channels are now reused per draw tile:
- The bake scans every 32-cell draw-tile window plus a 4-cell apron, records which materials meet, and colours
that conflict graph: materials that ever share a window never share a channel. USA mission 1: 37 materials
in 13 channels.
- Each cell stores the materials within the apron. Each draw tile ORs its cells and uploads its own
channel-to-material region table and enable mask before drawing; the result is cached until the draw window
slides or the map rebakes.
- On additive atlas-page passes, a tile with nothing on that page is skipped.
- The bake serial the tile cache keys on is global, so a new map allocated at the old map's address cannot
reuse its tables.
- The pixel shader is unchanged; its material loop now runs only over the channels in use.
Added a [TERRAIN] readout (materials, channels, dropped cells, pages, most materials per tile), off by default,
and extends the bake log. Design, limits and the constants the apron is tied to
the dedicated terrain splat map doc file, Appendix E.1 parent 0af69ee commit c80024b
4 files changed
Lines changed: 308 additions & 93 deletions
File tree
- Core/GameEngineDevice
- Include/W3DDevice/GameClient
- Source/W3DDevice/GameClient
- GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
382 | 398 | | |
383 | 399 | | |
384 | 400 | | |
| |||
396 | 412 | | |
397 | 413 | | |
398 | 414 | | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
399 | 427 | | |
400 | 428 | | |
401 | 429 | | |
| |||
Lines changed: 60 additions & 44 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3015 | 3015 | | |
3016 | 3016 | | |
3017 | 3017 | | |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
| 3023 | + | |
| 3024 | + | |
| 3025 | + | |
| 3026 | + | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
| 3036 | + | |
| 3037 | + | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
| 3044 | + | |
| 3045 | + | |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
3018 | 3052 | | |
3019 | 3053 | | |
3020 | 3054 | | |
3021 | 3055 | | |
3022 | 3056 | | |
3023 | 3057 | | |
3024 | | - | |
3025 | | - | |
3026 | | - | |
3027 | | - | |
3028 | | - | |
3029 | | - | |
3030 | | - | |
3031 | | - | |
3032 | | - | |
3033 | | - | |
3034 | | - | |
3035 | | - | |
3036 | | - | |
3037 | | - | |
3038 | | - | |
3039 | | - | |
3040 | | - | |
3041 | | - | |
3042 | | - | |
3043 | | - | |
3044 | | - | |
3045 | | - | |
3046 | | - | |
3047 | | - | |
3048 | | - | |
3049 | 3058 | | |
3050 | 3059 | | |
3051 | 3060 | | |
3052 | 3061 | | |
3053 | | - | |
3054 | | - | |
3055 | | - | |
3056 | | - | |
3057 | | - | |
3058 | | - | |
3059 | | - | |
3060 | | - | |
3061 | | - | |
3062 | | - | |
3063 | 3062 | | |
3064 | 3063 | | |
3065 | 3064 | | |
| |||
3074 | 3073 | | |
3075 | 3074 | | |
3076 | 3075 | | |
3077 | | - | |
3078 | | - | |
3079 | | - | |
3080 | | - | |
3081 | | - | |
| 3076 | + | |
3082 | 3077 | | |
3083 | | - | |
3084 | | - | |
3085 | | - | |
3086 | | - | |
3087 | 3078 | | |
3088 | 3079 | | |
3089 | 3080 | | |
| |||
3285 | 3276 | | |
3286 | 3277 | | |
3287 | 3278 | | |
| 3279 | + | |
| 3280 | + | |
| 3281 | + | |
| 3282 | + | |
3288 | 3283 | | |
3289 | 3284 | | |
3290 | 3285 | | |
3291 | 3286 | | |
3292 | 3287 | | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
3293 | 3309 | | |
3294 | 3310 | | |
3295 | 3311 | | |
| |||
0 commit comments