Bugfixes, weitere Vegetationsgeneratoren hinzugefügt

This commit is contained in:
2026-07-25 20:16:13 +02:00
parent 574bad3d67
commit d7aeb890c9
66 changed files with 2379 additions and 173 deletions

View File

@@ -1,5 +1,12 @@
uniform sampler2D m_TexFlat;
uniform sampler2D m_TexSteep;
#ifdef HAS_SPLAT
uniform sampler2D m_SplatMap;
uniform sampler2D m_TexFlat2;
uniform sampler2D m_TexFlat3;
uniform sampler2D m_TexFlat4;
#endif
uniform float m_TexScale;
#ifdef HAS_NM_FLAT
@@ -57,7 +64,22 @@ void main() {
// Flat: reines XZ-UV wie das Terrain (uvY = worldPos.xz / texScale), kein Triplanar.
// Steep: Triplanar für alle nicht-flachen Flächen inkl. Decken und Tunnelwände.
vec4 col = texture(m_TexFlat, uvY) * flatBlend
#ifdef HAS_SPLAT
// Splatmap-UV: worldPos.xz linear auf [0,1] (kein Flip nötig Konvention im Editor: pz=0 → worldZ=-2048)
vec2 splatUV = (vWorldPos.xz + 2048.0) / 4096.0;
vec4 splat = texture(m_SplatMap, splatUV);
float w2 = splat.g;
float w3 = splat.b;
float w4 = splat.a;
float w1 = max(0.0, 1.0 - w2 - w3 - w4);
vec4 flatCol = texture(m_TexFlat, uvY) * w1
+ texture(m_TexFlat2, uvY) * w2
+ texture(m_TexFlat3, uvY) * w3
+ texture(m_TexFlat4, uvY) * w4;
#else
vec4 flatCol = texture(m_TexFlat, uvY);
#endif
vec4 col = flatCol * flatBlend
+ triplanar(m_TexSteep, uvX, uvY, uvZ, bw) * steepBlend;
// Geometrie-Normale für Beleuchtung, ggf. durch Normal-Map ersetzt.