Add motion blur and better interpolation when OES_texture_float_linear is not available

This commit is contained in:
schmelczerandras 2020-10-31 11:15:45 +01:00
parent 2889fd54db
commit 7803bbeaee
7 changed files with 50 additions and 8 deletions

View file

@ -2,6 +2,8 @@
precision lowp float;
#define FLOAT_LINEAR_ENABLED {floatLinearEnabled}
uniform float maxMinDistance;
uniform float distanceNdcPixelSize;
in vec2 position;
@ -28,6 +30,11 @@ void main() {
{functionCalls}
distanceValue = minDistance;
#if FLOAT_LINEAR_ENABLED
distanceValue = minDistance;
#else
distanceValue = minDistance * 8.0;
#endif
fragmentColor = color;
}

View file

@ -4,6 +4,7 @@ precision lowp float;
#define INTENSITY_INSIDE_RATIO {intensityInsideRatio}
#define SHADOW_TRACE_COUNT {shadowTraceCount}
#define FLOAT_LINEAR_ENABLED {floatLinearEnabled}
{macroDefinitions}
@ -23,7 +24,11 @@ vec4 getColor(vec2 target) {
}
float getDistance(vec2 target) {
#if FLOAT_LINEAR_ENABLED
return texture(distanceTexture, target)[0];
#else
return texture(distanceTexture, target)[0] / 8.0;
#endif
}
float shadowTransparency(float startingDistance, float lightCenterDistance, vec2 direction) {