feat(client): terrain hillshade — shade the ground so relief reads (#239) #242

Merged
panda merged 1 commit from feat/terrain-hillshade into main 2026-08-01 17:29:36 +02:00
Collaborator

Summary

Il terreno viene sollevato in Z (heightfield) ma senza ombreggiatura l'altezza era invisibile su terreno uniforme (una tile grigia alzata su grigio). Questo aggiunge un hillshade per-vertice: GroundBlendRenderer calcola una shade dal gradiente di Z locale (differenze finite su GroundZAt → normale · luce obliqua da NW), la impacchetta nel Color del vertice, e il ground shader la moltiplica (col *= input.Color.rgb). Costo trascurabile (nessun sample GPU extra) → rilievo e coste finalmente si vedono, 60fps.

  • content/ground_blend.fx (+ .xnb ricompilato via MGCB): MainPS moltiplica per la shade del vertice.
  • GroundBlendRenderer: Hillshade() per-vertice + luce/ambient tunabili (LightDir NW, AmbientShade 0.55, SlopeScale 0.18).

Screenshots / recording

Hillshade attivo sul massiccio vulcanico: i pendii ora si vedono come rilievo (ombreggiati), non più piatti. Terreno OK, 60fps.

shot

Costa d'erba piatta: l'interno resta uniforme (giusto — nessun gradiente), il rilievo si legge solo dove il terreno cambia quota.

shot

Catturati pilotando il client (harness, DB fresco): vulcano (7563,5034) e costa spawn.

How it was tested

  • Screenshot piloti (sopra): sul rilievo l'ombreggiatura mostra i pendii; sul piatto resta uniforme (corretto).
  • Perf verificata (strumentazione temporanea, poi rimossa): 60fps, nessuna regressione — l'hillshade non aggiunge lavoro GPU.
  • Build intera 0 warning, dotnet test verde, CSharpier pulito.

Checklist

  • just lint passes (CSharpier + analyzers, zero warnings)
  • just test is green
  • The whole solution builds (client and tools included)
  • Multi-platform preserved (server on Win/macOS/Linux, client on Win/macOS)
  • Tests added/updated for this change — N/A (resa GPU; nessun test unitario applicabile)
  • Linked the related issue (if any) and its Definition of Done is met

Chiude #239. Nota: l'overdraw #240 (blend costoso sui frammenti occlusi nelle zone di rilievo) resta aperto — i fix depth-based non funzionano su DesktopGL/SM3 (documentato su #240); micro-stutter tollerabile intanto.

## Summary Il terreno viene *sollevato* in Z (heightfield) ma senza ombreggiatura l'altezza era **invisibile** su terreno uniforme (una tile grigia alzata su grigio). Questo aggiunge un **hillshade per-vertice**: `GroundBlendRenderer` calcola una shade dal gradiente di Z locale (differenze finite su `GroundZAt` → normale · luce obliqua da NW), la impacchetta nel **Color del vertice**, e il ground shader la moltiplica (`col *= input.Color.rgb`). Costo trascurabile (nessun sample GPU extra) → **rilievo e coste finalmente si vedono**, 60fps. - `content/ground_blend.fx` (+ `.xnb` ricompilato via MGCB): `MainPS` moltiplica per la shade del vertice. - `GroundBlendRenderer`: `Hillshade()` per-vertice + luce/ambient tunabili (`LightDir` NW, `AmbientShade` 0.55, `SlopeScale` 0.18). ## Screenshots / recording Hillshade attivo sul massiccio vulcanico: i pendii ora si vedono come rilievo (ombreggiati), non più piatti. Terreno OK, 60fps. ![shot](https://git.homelab.devncode.it/attachments/fc41cb32-b87e-4e2e-ae33-d98a19eec656) Costa d'erba piatta: l'interno resta uniforme (giusto — nessun gradiente), il rilievo si legge solo dove il terreno cambia quota. ![shot](https://git.homelab.devncode.it/attachments/9c6b5a1b-f86d-4443-b550-96fbb300e903) Catturati pilotando il client (harness, DB fresco): vulcano `(7563,5034)` e costa spawn. ## How it was tested - Screenshot piloti (sopra): sul rilievo l'ombreggiatura mostra i pendii; sul piatto resta uniforme (corretto). - Perf verificata (strumentazione temporanea, poi rimossa): 60fps, nessuna regressione — l'hillshade non aggiunge lavoro GPU. - Build intera **0 warning**, `dotnet test` verde, CSharpier pulito. ## Checklist - [x] `just lint` passes (CSharpier + analyzers, zero warnings) - [x] `just test` is green - [x] The whole solution builds (client and tools included) - [x] Multi-platform preserved (server on Win/macOS/Linux, client on Win/macOS) - [x] Tests added/updated for this change — N/A (resa GPU; nessun test unitario applicabile) - [x] Linked the related issue (if any) and its Definition of Done is met Chiude **#239**. Nota: l'**overdraw #240** (blend costoso sui frammenti occlusi nelle zone di rilievo) resta aperto — i fix depth-based non funzionano su DesktopGL/SM3 (documentato su #240); micro-stutter tollerabile intanto.
feat(client): terrain hillshade — shade the ground by slope so relief reads (#239)
All checks were successful
ci / Lua content lint (pull_request) Successful in 11s
ci / Lint & Test (pull_request) Successful in 5m4s
6e85191c13
panda merged commit d250ff877d into main 2026-08-01 17:29:36 +02:00
panda deleted branch feat/terrain-hillshade 2026-08-01 17:29:36 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marco/IsoMmo!242
No description provided.