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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user