Weitere Bugfixes und kleine Feature Erweiterungen
This commit is contained in:
@@ -13,10 +13,11 @@ uniform sampler2D m_AlphaMap_2;
|
||||
uniform int m_SteepIndex;
|
||||
#endif
|
||||
|
||||
uniform vec3 m_LightDir;
|
||||
uniform vec3 m_SunColor;
|
||||
uniform vec3 m_AmbientColor;
|
||||
uniform vec3 g_CameraPosition;
|
||||
uniform vec3 m_LightDir;
|
||||
uniform vec3 m_SunColor;
|
||||
uniform vec3 m_AmbientColor;
|
||||
uniform vec3 g_CameraPosition;
|
||||
uniform float m_Wetness;
|
||||
|
||||
in vec3 vWorldPos;
|
||||
in vec3 vNormal;
|
||||
@@ -77,15 +78,22 @@ void main() {
|
||||
col = col * flatBlend + steepCol * steepBlend;
|
||||
#endif
|
||||
|
||||
vec3 N = normalize(vNormal);
|
||||
vec3 N = normalize(vNormal);
|
||||
vec3 lightDir = normalize(m_LightDir);
|
||||
float diff = max(dot(N, lightDir), 0.0);
|
||||
vec3 light = m_AmbientColor + m_SunColor * diff;
|
||||
|
||||
// Nass-Effekt: Oberfläche abdunkeln + Blinn-Phong Specular Schimmer
|
||||
float wet = clamp(m_Wetness, 0.0, 1.0);
|
||||
col.rgb *= (1.0 - 0.20 * wet);
|
||||
vec3 viewDir = normalize(g_CameraPosition - vWorldPos);
|
||||
vec3 H = normalize(lightDir + viewDir);
|
||||
float spec = pow(max(dot(N, H), 0.0), 80.0) * wet;
|
||||
|
||||
const float BRIGHTNESS = 0.80;
|
||||
#ifdef DEBUG_NO_LIGHT
|
||||
outColor = vec4(col.rgb * BRIGHTNESS, col.a);
|
||||
#else
|
||||
outColor = vec4(col.rgb * light * BRIGHTNESS, col.a);
|
||||
outColor = vec4(col.rgb * light * BRIGHTNESS + vec3(spec * 0.35), col.a);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -29,13 +29,15 @@ void main() {
|
||||
|
||||
vec2 windN = (dot(m_WindDir, m_WindDir) > 0.001) ? normalize(m_WindDir) : vec2(0.0, 1.0);
|
||||
float wavePhase = dot(worldXZ, windN);
|
||||
// Pro-Halm-Zufallsphase: floor() macht sie für alle Vertices desselben Halms gleich
|
||||
float randPhase = fract(sin(dot(floor(worldXZ), vec2(127.1, 311.7))) * 43758.5453) * 6.2832;
|
||||
|
||||
// Zwei überlagerte Sinuswellen für organische Bewegung
|
||||
float sway = sin(t * 2.1 + wavePhase * 0.08) * 0.6
|
||||
+ sin(t * 1.4 + wavePhase * 0.06) * 0.4;
|
||||
// Zwei überlagerte Sinuswellen + Zufallsphase → kein synchroner Gleichtakt
|
||||
float sway = sin(t * 2.1 + wavePhase * 0.08 + randPhase) * 0.6
|
||||
+ sin(t * 1.4 + wavePhase * 0.06 + randPhase * 0.73) * 0.4;
|
||||
|
||||
// Mindest-Stärke damit bei wenig Wind noch Bewegung sichtbar ist
|
||||
float effectiveStrength = max(m_WindStrength, 0.05);
|
||||
// Halbierte Windstärke für Textur-Gras; Mindest-Stärke für minimale Bewegung
|
||||
float effectiveStrength = max(m_WindStrength, 0.05) * 0.5;
|
||||
|
||||
// Quadratische Gewichtung: Spitze bewegt sich mehr als Basis
|
||||
float bend = sway * effectiveStrength * inTexCoord.y * inTexCoord.y;
|
||||
|
||||
Reference in New Issue
Block a user