Attempt at creating a magnifying glass effect in Shotcut

For a school project, a relative of mine asked if I could help her to come up with a way to simulate a magnifying glass hovering on top of map and other documents. Here’s our first attempt.

It still needs some improvements, but I’m please with the result so far.
I created the loupe in Photoshop, based on a photo found on the web.

To be honest, it’s not really my first attempt at this since I already tried something similar a couple of years ago. But I couldn’t find the original project, so we started again from scratch.

8 Likes

Wow, looks amazing! Bravo! :smiley: :+1:

2 Likes

That looks great. Is the process tedious? Is it using a mask of a resized layer? If so how much effort is needed to reposition the zoomed in layer inside the magnifying glass?

It is a bit tedious. You have to apply the same keyframes on 3 filters. But markers help a lot

Track V1 : The map. Size 1920 x 1080 pixels.
Track V2 : Copy of the map. Size 4231 x 2380 pixels.
Track V3 : The loupe image.

The clip on track V2 gets a Crop: Rectangle filter and a Size, Position & Rotate filter, and the loupe clip a Size, Position & Rotate filter.

Honestly, I’m not sure I can explain in words how to do the effect. I’ll put this on my to-do list of tutorials.

4 Likes

This is what I imagined the workflow would be. It is a very appealing finished product. Well Done!

1 Like

Thank you @reachingnexus .

And thanks also to you @jonray for your nice comment.

Loupe - new word for me. Interesting … Thanks for the instructions. If only I had the time to try it out …

1 Like

This remids me of the “Sniperscope” filter I did some years ago that uses Webvfx (no longer available in later versions of Shotcut). Here is a short clip I made with it:

If you have a version of Shotcut with Webvfx (e,g, 20.07.11) you can get the filter from here: Shotcut Video Filter: SniperScope

3 Likes

I remember that clip @Elusien. So cool.
One of the improvements I want to add, if possible, is the lens deformation we see in your video.

I’m afraid I can’t think of a way to do that. The code I modified to do it is pretty simple GLSL (see below) used in WebGL and by inference OpenGL, but I don’t know how I could get this into a filter without using Webvfx. It must be possible, so maybe I’ll dig a bit deeper into Shotcut filters when I have the time,

uniform vec2 resolution;
uniform vec4 mouse;
uniform sampler2D tex0;

void main(void)
{
	float R = 100.0;
	float h = 40.0;
	float hr = R * sqrt(1.0 - ((R - h) / R) * ((R - h) / R));

	vec2 xy = gl_FragCoord.xy - mouse.xy;
	float r = sqrt(xy.x * xy.x + xy.y * xy.y);
	vec2 new_xy = r < hr ? xy * (R - h) / sqrt(R * R - r * r) : xy;
	
	gl_FragColor = texture2D(tex0, (new_xy + mouse.xy) / resolution);
}

I think the Lens Correction filter might work for this if introduced at the right position in the filters list.

Not bad. If I were doing it I’d probably blur the edges of the glass, but it’s pretty good.

1 Like

I saw this on YouTube. Excellent use case!

1 Like

I’ll try this next time I revisit this effect. Thanks!

Thanks Ben!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.