mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 10:44:31 +02:00
Make Fade.slh compatible with Open GLES SL
This commit is contained in:
parent
76b38bebad
commit
dad526d22b
1 changed files with 5 additions and 5 deletions
|
@ -34,7 +34,7 @@ vec2 hash2D(vec3 position) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float noise3D(vec3 position) {
|
float noise3D(vec3 position) {
|
||||||
float n = textureLod(fadeMaskMap, hash2D(position), 0).r;
|
float n = textureLod(fadeMaskMap, hash2D(position), 0.0).r;
|
||||||
return pow(n, 1.0/2.2); // Remove sRGB. Need to fix this later directly in the texture
|
return pow(n, 1.0/2.2); // Remove sRGB. Need to fix this later directly in the texture
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ float evalFadeNoiseGradient(FadeObjectParams params, vec3 position) {
|
||||||
vec3 noisePositionFloored = floor(noisePosition);
|
vec3 noisePositionFloored = floor(noisePosition);
|
||||||
vec3 noisePositionFraction = fract(noisePosition);
|
vec3 noisePositionFraction = fract(noisePosition);
|
||||||
|
|
||||||
noisePositionFraction = noisePositionFraction*noisePositionFraction*(3 - 2*noisePositionFraction);
|
noisePositionFraction = noisePositionFraction*noisePositionFraction*(3.0 - 2.0*noisePositionFraction);
|
||||||
|
|
||||||
float noiseLowXLowYLowZ = noise3D(noisePositionFloored);
|
float noiseLowXLowYLowZ = noise3D(noisePositionFloored);
|
||||||
float noiseLowXHighYLowZ = noise3D(noisePositionFloored+vec3(0,1,0));
|
float noiseLowXHighYLowZ = noise3D(noisePositionFloored+vec3(0,1,0));
|
||||||
|
@ -84,7 +84,7 @@ float evalFadeAlpha(FadeObjectParams params, vec3 position) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyFadeClip(FadeObjectParams params, vec3 position) {
|
void applyFadeClip(FadeObjectParams params, vec3 position) {
|
||||||
if (evalFadeAlpha(params, position) < 0) {
|
if (evalFadeAlpha(params, position) < 0.0) {
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,12 +95,12 @@ void applyFade(FadeObjectParams params, vec3 position, out vec3 emissive) {
|
||||||
alpha = -alpha;
|
alpha = -alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alpha < 0) {
|
if (alpha < 0.0) {
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
|
|
||||||
float edgeMask = alpha * fadeParameters[params.category]._edgeWidthInvWidth.y;
|
float edgeMask = alpha * fadeParameters[params.category]._edgeWidthInvWidth.y;
|
||||||
float edgeAlpha = 1.0-clamp(edgeMask, 0, 1);
|
float edgeAlpha = 1.0-clamp(edgeMask, 0.0, 1.0);
|
||||||
|
|
||||||
edgeMask = step(edgeMask, 1.f);
|
edgeMask = step(edgeMask, 1.f);
|
||||||
edgeAlpha *= edgeAlpha; // Square to have a nice ease out
|
edgeAlpha *= edgeAlpha; // Square to have a nice ease out
|
||||||
|
|
Loading…
Reference in a new issue