Download

Is it possible to render the first person completely seperately. Not panini related

Hello guys,

I am wondering if someone can help me with this question.

I am aware that other games render the first person weapon and arms seperately from the world, then composite them together, giving them more control such as changing FOV for each seperately.

I know panini projection can do this in Unreal Engine, but im looking for something specific that to my knowledge, panini dosent offer.

Lets just say for examples sake, I have my arms/weapon rendered by themselves, and then I have a render of the world infront of my character. Normally I will just layer on the first person render ontop of the world, and there is my viewport. But what if I want to layer on the first person based on a mask? This is something I want to do, I want to be able to mask out parts of my first person render. Is this possible, or can someone shed some light on this problem?

Thank you very much!

You could render them to a render target and then display them onto the screen as a UI element.

Basically it becomes more expensive.

Normally you try and setup panini via vector displacement because it’s extremely low cost.

Rendering separately, you are likely to add around 2ms at a bare minimum.
Regardless of how you then implement it - which is likely to increase the cost further.

So, why not just create a modular character or a material for the character that uses opacity to hide it’s parts how you need?

@MostHost_LA Its not the character that is the issue though, its that I want to mask part of my first person view based on a stencil when aiming down a scope. In AAA games like COD, when you look down your scope it looks like they mask out the front of the gun, ive slowed down videos of ADS in those games and you can clearly see that when the character goes into ADS, they should be able to see the barrel , but they can just see the ground beneath instead. I figured they were getting the lens of the scope as a stencil mask then not rendering the first person in that area. Hence you can ADS without seeing your own gun in the scope.

@Arkiras tying to avoid using a render target due to cost though…

Well… Good luck with that. Maybe someone else has ideas but I can’t think of any other way to render to a separate layer.

I don’t see why you would need a separate render layer for this, just use a masked material for the gun and mask the area in view through the scope.

I did consider using a masked material too, problem is, how would I get the area on the gun that is visible through my lens?

You’re only interested in hiding the front of the gun right? You could just paint a mask for that, seeing as the scope is attached to the gun you pretty much always know whats going to be in view.

Yeah thats what I thought, and yes, sometimes you can see the barrel/iron sights in the view (so just that) The problem is though, the scope might change and the view with it, I think I could make a mask that would work for everything but I was just wondering if there was a smarter more foolproof way to do it.

Honestly using a masked material seems robust and foolproof to me but I haven’t tried implementing it so I may be overestimating it.

There are far more knowledgeable people than me here though so maybe someone else will have better ideas.

No I agree, using a masked material is definitely a way to make it work. What im saying is rather than creating a mask that just gets turned on/off depending on whether you are ADS, Im saying making a smart way to create the mask dynamically such that if you change scopes, scope position etc, the mask still works, because its dynamically getting the scope/lens mask then using that to create the masked parts of the weapon.

I get what you’re saying, and I still think it’s possible to achieve that with a masked material. I would have to try implementing it though.

No, im agreeing, I know its possible with a masked material, im saying is there a way to dynamically create the opacity mask rather than just creating one for the weapon that I hope works for every weapon.

I understand, I’ve actually done something similar before by raytracing a virtual plane. It can be done… not as I described above but still

If there was some way to use the custom stencil to create the mask I could use it, but you need a post process material and Ive no idea if its possible to send the mask off to be used by another material.

Are you sure that’s happening? Can you link the reference you used? From what I’ve seen, that’s not the case:

I think what you’re talking about is the zoom of the scope that causes the barrel to “disappear” because of the decreased FOV through the scope, which can also be seen in those videos.

1 Like

Pretty sure. I know with 100% certainty in games like BF/Insurgency, they hide parts of the scope mesh when you ADS so that you dont see them in the scope picture (the interior/front of the scope), so it makes logical sense to assume they’re also hiding the front sights and barrel. If you look at that gif, at the very end, you can see the sight picture opens up and you should clearly be able to see the barrel of the gun, but you cant, you just see the building instead.

Also in my testing, no matter what you do with the FOV, you’re still just going to see the interior of a scope/front of the gun, im trying to avoid that.

That’s because the scope is zoomed, so you get a more focused image of where the scope is pointing.

FOV on the scope, not the camera.

Its not, COD just zooms the whole screen in to do zoom effects on scopes. Look at the cladding on the building, its the same scale as the cladding outside the scope view.