Neuer Baum Generator für Trauerweiden

This commit is contained in:
2026-08-23 10:48:25 +02:00
parent fdd8eb60be
commit d65ebbfeb6
14 changed files with 1329 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 948 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -25,9 +25,9 @@ void main() {
vec2 windN = (dot(m_WindDir, m_WindDir) > 0.001) ? normalize(m_WindDir) : vec2(0.0, 1.0);
vec2 perpN = vec2(-windN.y, windN.x);
float wavePhase = dot(worldXZ, windN);
// 1m-Raster für den Phase-Hash: benachbarte Vertices (Ast + Blatt-Basis) landen im
// gleichen Rasterfeld → identische randPhase → Blatt-Basis schwebt nicht mehr
vec2 hashPos = floor(worldXZ);
// Objekt-Ursprung als Hash-Basis: alle Vertices desselben Baums bekommen identische
// randPhase → kein Phasensprung innerhalb eines Blattstreifens → kein Zickzack
vec2 hashPos = floor(vec2(g_WorldMatrix[3][0], g_WorldMatrix[3][2]));
float randPhase = fract(sin(dot(hashPos, vec2(127.1, 311.7))) * 43758.5453) * 6.2832;
float mainSway = sin(t + wavePhase * 0.08 + randPhase) * windW * m_WindStrength;