mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-22 03:13:15 -04:00
Merge branch 'underwater-specular' into 'master'
Disable sun specular underwater See merge request OpenMW/openmw!4893
This commit is contained in:
commit
80015bc7af
@ -165,11 +165,15 @@ void main(void)
|
||||
// specular
|
||||
const float SPEC_MAGIC = 1.55; // from the original blender shader, changing it makes the spec vanish or become too bright
|
||||
|
||||
vec3 specNormal = normalize(vec3(normal.x * SPEC_BUMPINESS, normal.y * SPEC_BUMPINESS, normal.z));
|
||||
vec3 viewReflectDir = reflect(viewDir, specNormal);
|
||||
float phongTerm = max(dot(viewReflectDir, sunWorldDir), 0.0);
|
||||
float specular = pow(atan(phongTerm * SPEC_MAGIC), SPEC_HARDNESS) * SPEC_BRIGHTNESS;
|
||||
specular = clamp(specular, 0.0, 1.0) * shadow * sunSpec.a;
|
||||
float specular = 0.0;
|
||||
if (cameraPos.z >= 0.0)
|
||||
{
|
||||
vec3 specNormal = normalize(vec3(normal.x * SPEC_BUMPINESS, normal.y * SPEC_BUMPINESS, normal.z));
|
||||
vec3 viewReflectDir = reflect(viewDir, specNormal);
|
||||
float phongTerm = max(dot(viewReflectDir, sunWorldDir), 0.0);
|
||||
specular = pow(atan(phongTerm * SPEC_MAGIC), SPEC_HARDNESS) * SPEC_BRIGHTNESS;
|
||||
specular = clamp(specular, 0.0, 1.0) * shadow * sunSpec.a;
|
||||
}
|
||||
|
||||
// artificial specularity to make rain ripples more noticeable
|
||||
vec3 skyColorEstimate = vec3(max(0.0, mix(-0.3, 1.0, sunFade)));
|
||||
|
Loading…
x
Reference in New Issue
Block a user