summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMichael Goddard <michael.goddard@nokia.com>2011-12-22 13:08:25 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-22 07:23:32 +0100
commit230782546145e164ec38eb03e37c945aa059d393 (patch)
treeecbf7ef27c0798b8b6e26ad3aed5d57551ad9923 /examples
parent8af2548473a1cc12189d950f9ad3cbd68e4297cc (diff)
Fix some of the effects in qmlvideofx
* TiltShift was sometimes applying the effect in the wrong place. * Blur had some QML properties duplicated * Blur kernel wasn't quite summing to 1, and was applying opacity twice * The target width for the second pass was incorrect, so it was blending darkness, resulting in a dreary image. Change-Id: Ib8ba93d979c597cf4d225b3d24d26a22d0cdffc2 Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/video/qmlvideofx/qml/qmlvideofx/EffectGaussianBlur.qml6
-rw-r--r--examples/video/qmlvideofx/shaders/gaussianblur_h.fsh2
-rw-r--r--examples/video/qmlvideofx/shaders/gaussianblur_v.fsh5
-rw-r--r--examples/video/qmlvideofx/shaders/tiltshift.fsh2
4 files changed, 8 insertions, 7 deletions
diff --git a/examples/video/qmlvideofx/qml/qmlvideofx/EffectGaussianBlur.qml b/examples/video/qmlvideofx/qml/qmlvideofx/EffectGaussianBlur.qml
index 2e76de3eb..a4cfc5226 100644
--- a/examples/video/qmlvideofx/qml/qmlvideofx/EffectGaussianBlur.qml
+++ b/examples/video/qmlvideofx/qml/qmlvideofx/EffectGaussianBlur.qml
@@ -61,7 +61,7 @@ Item {
Effect {
id: verticalShader
anchors.fill: parent
- property real dividerValue: parent.dividerValue
+ dividerValue: parent.dividerValue
property real blurSize: 4.0 * parent.parameters.get(0).value / targetHeight
fragmentShaderFilename: "shaders/gaussianblur_v.fsh"
}
@@ -69,8 +69,8 @@ Item {
Effect {
id: horizontalShader
anchors.fill: parent
- property real dividerValue: parent.dividerValue
- property real blurSize: 4.0 * parent.parameters.get(0).value / targetWidth
+ dividerValue: parent.dividerValue
+ property real blurSize: 4.0 * parent.parameters.get(0).value / parent.targetWidth
fragmentShaderFilename: "shaders/gaussianblur_h.fsh"
source: horizontalShaderSource
diff --git a/examples/video/qmlvideofx/shaders/gaussianblur_h.fsh b/examples/video/qmlvideofx/shaders/gaussianblur_h.fsh
index 249ee3040..e2d4e7d10 100644
--- a/examples/video/qmlvideofx/shaders/gaussianblur_h.fsh
+++ b/examples/video/qmlvideofx/shaders/gaussianblur_h.fsh
@@ -55,7 +55,7 @@ void main()
c += texture2D(source, uv - vec2(3.0*blurSize, 0.0)) * 0.09;
c += texture2D(source, uv - vec2(2.0*blurSize, 0.0)) * 0.12;
c += texture2D(source, uv - vec2(1.0*blurSize, 0.0)) * 0.15;
- c += texture2D(source, uv) * 0.16;
+ c += texture2D(source, uv) * 0.18;
c += texture2D(source, uv + vec2(1.0*blurSize, 0.0)) * 0.15;
c += texture2D(source, uv + vec2(2.0*blurSize, 0.0)) * 0.12;
c += texture2D(source, uv + vec2(3.0*blurSize, 0.0)) * 0.09;
diff --git a/examples/video/qmlvideofx/shaders/gaussianblur_v.fsh b/examples/video/qmlvideofx/shaders/gaussianblur_v.fsh
index 249052c9f..9aaddf092 100644
--- a/examples/video/qmlvideofx/shaders/gaussianblur_v.fsh
+++ b/examples/video/qmlvideofx/shaders/gaussianblur_v.fsh
@@ -55,7 +55,7 @@ void main()
c += texture2D(source, uv - vec2(0.0, 3.0*blurSize)) * 0.09;
c += texture2D(source, uv - vec2(0.0, 2.0*blurSize)) * 0.12;
c += texture2D(source, uv - vec2(0.0, 1.0*blurSize)) * 0.15;
- c += texture2D(source, uv) * 0.16;
+ c += texture2D(source, uv) * 0.18;
c += texture2D(source, uv + vec2(0.0, 1.0*blurSize)) * 0.15;
c += texture2D(source, uv + vec2(0.0, 2.0*blurSize)) * 0.12;
c += texture2D(source, uv + vec2(0.0, 3.0*blurSize)) * 0.09;
@@ -63,5 +63,6 @@ void main()
} else {
c = texture2D(source, qt_TexCoord0);
}
- gl_FragColor = qt_Opacity * c;
+ // First pass we don't apply opacity
+ gl_FragColor = c;
}
diff --git a/examples/video/qmlvideofx/shaders/tiltshift.fsh b/examples/video/qmlvideofx/shaders/tiltshift.fsh
index 4323e7f00..5f52d42ec 100644
--- a/examples/video/qmlvideofx/shaders/tiltshift.fsh
+++ b/examples/video/qmlvideofx/shaders/tiltshift.fsh
@@ -67,7 +67,7 @@ void main()
{
vec2 uv = qt_TexCoord0.xy;
vec3 col;
- if (uv.x < dividerValue && uv.y >= 0.4 && uv.y <= 0.6)
+ if (uv.x > dividerValue || (uv.y >= 0.4 && uv.y <= 0.6))
col = texture2D(source, uv).rgb;
else
col = blur();