Motion blur scale

This commit is contained in:
unknown 2017-12-26 01:58:40 +01:00
parent 0788a00792
commit c669c44d09
4 changed files with 12 additions and 7 deletions

View file

@ -13,14 +13,12 @@ uniform mat4 prevVP;
uniform vec3 eye;
uniform vec3 eyeLook;
uniform vec2 cameraProj;
uniform float frameScale;
in vec2 texCoord;
in vec3 viewRay;
out vec4 fragColor;
// const float motionBlurIntensity = 1.0;
// const int samples = 8;
vec2 getVelocity(vec2 coord, float depth) {
vec4 currentPos = vec4(coord.xy * 2.0 - 1.0, depth, 1.0);
vec4 worldPos = vec4(getPos(eye, eyeLook, viewRay, depth, cameraProj), 1.0);
@ -43,8 +41,7 @@ void main() {
return;
}
float blurScale = 1.0 * motionBlurIntensity; //currentFps / targeFps;
// blurScale *= -1.0;
float blurScale = motionBlurIntensity * frameScale;
vec2 velocity = getVelocity(texCoord, depth) * blurScale;
vec2 offset = texCoord;

View file

@ -26,6 +26,10 @@
{
"name": "cameraProj",
"link": "_cameraPlaneProj"
},
{
"name": "frameScale",
"link": "_frameScale"
}
],
"texture_params": [],

View file

@ -8,13 +8,13 @@ uniform sampler2D gbuffer0;
uniform sampler2D sveloc;
uniform sampler2D tex;
// uniform vec2 texStep;
uniform float frameScale;
in vec2 texCoord;
out vec4 fragColor;
void main() {
vec2 velocity = texture(sveloc, texCoord).rg;
velocity *= motionBlurIntensity; // * (currentFps / targetFps);
vec2 velocity = texture(sveloc, texCoord).rg * motionBlurIntensity * frameScale;
fragColor.rgb = texture(tex, texCoord).rgb;

View file

@ -7,6 +7,10 @@
"compare_mode": "always",
"cull_mode": "none",
"links": [
{
"name": "frameScale",
"link": "_frameScale"
},
{
"name": "texStep",
"link": "_screenSizeInv",