Fixed weird specular on hair an teleportation target! Was a stupid mistake...

This commit is contained in:
Olivier Prat 2018-04-19 10:04:38 +02:00
parent 1c9d1f6c48
commit c8bef8651f
5 changed files with 13 additions and 13 deletions

View file

@ -109,17 +109,17 @@ vec4 computeHazeColor(vec4 fragColor, vec3 fragPositionES, vec3 fragPositionWS,
// Convert haze colour from uniform into a vec4
vec4 hazeColor = vec4(hazeParams.hazeColor, 1.0);
// Directional light component is a function of the angle from the eye, between the fragment and the sun
vec3 fragToEyeDirWS = normalize(fragPositionWS - eyePositionWS);
float glareComponent = max(0.0, dot(fragToEyeDirWS, -lightDirectionWS));
float power = min(1.0, pow(glareComponent, hazeParams.hazeGlareBlend));
vec4 glareColor = vec4(hazeParams.hazeGlareColor, 1.0);
// Use the haze colour for the glare colour, if blend is not enabled
vec4 blendedHazeColor;
if ((hazeParams.hazeMode & HAZE_MODE_IS_ENABLE_LIGHT_BLEND) == HAZE_MODE_IS_ENABLE_LIGHT_BLEND) {
// Directional light component is a function of the angle from the eye, between the fragment and the sun
vec3 fragToEyeDirWS = normalize(fragPositionWS - eyePositionWS);
float glareComponent = max(0.0, dot(fragToEyeDirWS, -lightDirectionWS));
float power = min(1.0, pow(glareComponent, hazeParams.hazeGlareBlend));
vec4 glareColor = vec4(hazeParams.hazeGlareColor, 1.0);
blendedHazeColor = mix(hazeColor, glareColor, power);
} else {
blendedHazeColor = hazeColor;

View file

@ -64,7 +64,7 @@ void main(void) {
vec3 fragNormalWS = normalize(_normalWS);
TransformCamera cam = getTransformCamera();
vec3 fragToEyeWS = fragPositionWS - cam._viewInverse[3].xyz;
vec3 fragToEyeWS = cam._viewInverse[3].xyz - fragPositionWS;
vec3 fragToEyeDirWS = normalize(fragToEyeWS);
SurfaceData surfaceWS = initSurfaceData(roughness, fragNormalWS, fragToEyeDirWS);
@ -77,7 +77,7 @@ void main(void) {
vec4(0), vec4(0), opacity);
}
_fragColor = vec4(evalGlobalLightingAlphaBlendedWithHaze(
_fragColor = vec4(evalGlobalLightingAlphaBlendedWithHaze(
cam._viewInverse,
1.0,
occlusionTex,

View file

@ -66,7 +66,7 @@ void main(void) {
vec3 fragNormalWS = normalize(_normalWS);
TransformCamera cam = getTransformCamera();
vec3 fragToEyeWS = fragPositionWS - cam._viewInverse[3].xyz;
vec3 fragToEyeWS = cam._viewInverse[3].xyz - fragPositionWS;
vec3 fragToEyeDirWS = normalize(fragToEyeWS);
SurfaceData surfaceWS = initSurfaceData(roughness, fragNormalWS, fragToEyeDirWS);

View file

@ -66,7 +66,7 @@ void main(void) {
<$evalMaterialNormalLOD(_positionES, normalTex, _normalWS, _tangentWS, fragNormalWS)$>
TransformCamera cam = getTransformCamera();
vec3 fragToEyeWS = fragPositionWS - cam._viewInverse[3].xyz;
vec3 fragToEyeWS = cam._viewInverse[3].xyz - fragPositionWS;
vec3 fragToEyeDirWS = normalize(fragToEyeWS);
SurfaceData surfaceWS = initSurfaceData(roughness, fragNormalWS, fragToEyeDirWS);

View file

@ -75,7 +75,7 @@ void main(void) {
<$evalMaterialNormalLOD(_positionES, normalTex, _normalWS, _tangentWS, fragNormalWS)$>
TransformCamera cam = getTransformCamera();
vec3 fragToEyeWS = fragPositionWS - cam._viewInverse[3].xyz;
vec3 fragToEyeWS = cam._viewInverse[3].xyz - fragPositionWS;
vec3 fragToEyeDirWS = normalize(fragToEyeWS);
SurfaceData surfaceWS = initSurfaceData(roughness, fragNormalWS, fragToEyeDirWS);