Fehler beim backen von Voxel behoben
This commit is contained in:
@@ -2478,6 +2478,41 @@ public class VoxelEditorState extends BaseAppState {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Schritt 2c: Höhenfeld-Glättung ──────────────────────────────────
|
||||
// Schritt 2 (Waypoint-Interpolation) erzeugt an Stufen-Übergängen periodische
|
||||
// Höhenoszillationen: für eine Treppe 2,2,3,3,4,4 entstehen statt der idealen
|
||||
// 3, 3.5, 4, 4.5 die Werte 3.33, 3.67, 4.33, 4.67 — ein kleiner "Hügel" pro
|
||||
// Treppenstufe. Ursache: die Formel (h0·dUp + hUp·dDown)/(dUp+dDown) verwendet
|
||||
// h0 (aktuelle Rohhöhe) statt die ideale lineare Interpolation zwischen den
|
||||
// Ankerhöhen, was bei Zellen INNERHALB einer Stufe (mehrere Zellen gleicher
|
||||
// Höhe) unterschiedliche Ergebnisse je nach Position produziert.
|
||||
// Fix: 4 Passes eines XZ-Nachbarschafts-Mittelwerts glätten die Oszillationen
|
||||
// auf <0.05 m heraus (jeder Pass halbiert die Amplitude, bei 4 Passes fast
|
||||
// unsichtbar). Cliff-Schutz: keine Mittelung über Höhenunterschiede > 1.5 m.
|
||||
{
|
||||
final int HF_PASSES = 4;
|
||||
final float HF_CLIFF_THR = 1.5f;
|
||||
final long DX = 60001L; // X-Nachbar-Offset im hk-Schema
|
||||
for (int pass = 0; pass < HF_PASSES; pass++) {
|
||||
Map<Long, Float> next = new HashMap<>(smoothMap.size());
|
||||
for (Map.Entry<Long, Float> e : smoothMap.entrySet()) {
|
||||
long hk = e.getKey();
|
||||
float sh = e.getValue();
|
||||
float sum = sh;
|
||||
int cnt = 1;
|
||||
for (long delta : new long[]{ DX, -DX, 1L, -1L }) {
|
||||
Float nb = smoothMap.get(hk + delta);
|
||||
if (nb != null && Math.abs(nb - sh) <= HF_CLIFF_THR) {
|
||||
sum += nb;
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
next.put(hk, sum / cnt);
|
||||
}
|
||||
smoothMap = next;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Schritt 3: Dichte anpassen ────────────────────────────────────
|
||||
// ALLE Spalten aus hfMap bekommen den Dichte-Gradienten geschrieben, auch
|
||||
// Plateau-Spalten (smoothH==h0), nicht nur echte Rampen. Grund (gefunden
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user