How to Create PUBG style Sniper Zoom Function

Hi
I’m trying to create a sniper scope with zoom function just like PUBG but i’m having trouble when i try to zoom-in as it also zooms on the scope mesh itself which is not correct.
here is a video of how pubg scope works:

as you can see in the video when the camera zooms out, the location of the scope on screen stays the same size.
at first one might think there are 2 cameras but it’s not and thats because the outside part of the scope is also affected by camera FOV.
so any ideas how this can be done?
Thanks !

I think the inner picture is a render target:

or

Thanks for the reply!
the tutorials you have sent me are using an extra camera which is heavy on performance since it renders the scene twice!
but the video i have posted is only using the player’s camera and proof of that is that when he zooms, both the inside and outside of scope have the same FOV.

Extra camera is not a performance hit. Render target is. You can have as many camera as you want within reason…

my bad, I had meant render targets and as you also stated they are not good for performance but sadly the links you have sent me are also using render targets which is not a viable option for me.
so im trying to find the pubg method in which from what i see it does not use a render target.

How can you tell? :slight_smile:

Please look at the two pictures i have uploaded.
in these 2 pictures there are 2 different zoom levels 1 is zoomed in and 2 is zoomed out.
now here is the thing, outside and inside of the scope have the same FOV and thats pretty obvious if you take a close look at it. lets say it does use a render target for inside but it begs the question why would you adjust the FOV of player camera to match the render target? it doesnt make sense. whats more important for me, since the FOV of player camera is getting changed then why is it not zooming on scope mesh itself? one might think its umg but i dont think so because the lighting of the world is affecting scope material.

EDIT:I’m starting to think it’s actually a umg but with render target for scope mesh itself with some tricks, but im not really sure…

I see what you’re saying. If think it’s a UMG overlay. So you can change the FOV, put the sight image in the HUD and blur out the part around the sight. I -think-

The only part I’m not sure of is how to avoid blurring the central section.

I was just googling around for some way of masking the background blur, not obvious…

I watched the video again and the way player brings in the scope to screen is definitely weird as if its done for the sake of umg to not look out of place.
I think i know where to look now.
Thanks for the help, I really appreciate it :slight_smile:

Yeah, sorry I couldn’t give a definitive answer :slight_smile:

I personally think its a dolly zoom. The FOV gets lowered but then the main camera moves away from the scope mesh. There is a relationship between the FOV and the distance behind the target mesh.

Have a look at [this][1]

Here is a screenshot of the formula from Wikipedia:

335611-screenshot-2021-04-11-224843.png

They are for sure using UI Scope.
Get in ADS mode and create a widget having the sight texture relative to the sight attached to the weapon.
Keep the sight image in the center of the screen in the widget.
Hide the Sight mesh, just take care to not hide it for other clients if the game is MP.
Now you can just play around with the FOV of the camera like in PUBG.

Why they are not using render target or Dolly Zoom?
1: Render target is performant for simple games with small maps with less amount of objects and with low res textures, and for the game like pubg it will be super performant.
2: Dolly Zoom will have some issues like if you stand near the wall and try to zoom it will just not work, cause the camera will be blocked by the wall.

Hope it helps cheers!