The dual FOV approach has me wondering something. In a lot of games, increasing the FOV beyond a certain point will make the player's view model look pretty weird. With your two-camera approach, could you ensure a consistent perspective of the view model while changing the FOV?
Actually yes. The hands dont so much break 'they stretch out. Have you seen max fov on FT2? There's console commands to go further if you want to try this for your self. Id demo but i dont have a PC/Laptops Tho to probably answer the question in a way i think would work is maybe past a certain fov you will need to reset the camera on the gun overlay to repeat the clean look beyond say 120-150 for to prevent the stretch
You could actually keep the fov of the gun independent from the fov of the camera with this approach too. So if you extend the fov of the camera, the fov of the gun stays the same.
you can't really. Best you can do is not use such a narrow fov so it warps less, but then that brings you back to the issue with the scope blocking your view. It's all tradeoffs. The gun looks much better to me when the fov stays consistent, plus there's the performance benefits of using just one camera, so that's also something to consider
Many shooters use the dual fov approach and it works to change the fov without making the player model look weird, doom eternal is a good example, although some people use console commands to make the view model fov high too
At my job as a weapon artist, when we use ironsights aiming, we move the weapon and change fov. But when using scopes and collimators, we create second scope model with deleted geometry far from scope glass (or few milimetters behind it). It makes the view more clear and better to aim.
Yeah a few people mentioned it on the last video, suprised he didn't mention it as he also saw those comments because a lot of big triple A games use this exact method.
That's so weird method why don't you just use stencil masks for scopes and collimators? If you don't know what is this it's a shader that gives you selective rendering behind an object for example behind this plane render the gun but don't render the scope and if the tip of the scope is long separate the front of the scope and render the front with the weapon it's much better and extremely performate
@@DePistolero Hey I've been trying to figure this method out, can you point me in a direction? I tried, but what I ended up with was having to use translucent mats on my gun and sight, which caused the depth sort issues common with translucent mats. What am i missing? Appreciated.
@@ahmadgamal65 Hey I'm super new to UE and game dev, this was the method I was trying to figure out but ran afoul of translucent mats and depth sorting. Can you tell me what I should be looking into to make this work correctly?
Using a separate viewport indeed has a noticeable performance penalty (especially when MSAA is involved). Instead, I recommend relying on non-uniform scaling of the weapon model to simulate FOV changes. To ensure mesh normals are still correct after non-uniform scaling, enable Ensure Correct Normals on the SpatialMaterials used by the weapon models. (This is not required in Godot 4.0alpha anymore, as normals are now automatically scaled when needed.) To handle the wall clipping situation, I recommend just pushing the weapon model back when a hit with a wall is detected using a raycast. Even Quake 2 RTX does this :)
The plan from the start was to use a single camera and move the gun out of the way when needed, but I wanted to test this method out as well and see how I liked it. The performance issues are pretty noticeable though, so it might make it into the final game
One solution that occurred to me, and I’m not sure if Godot supports this, is to enable “backface culling” on the model of the gun. I’m practice, this means that textures are only drawn on the outside of the model and if you were to clip inside it and look from the inside out it would appear transparent. If only the outside of the scope was textured and the inside of the scope was not modeled, you would be able to see through it like you can see through a one way mirror. This may not work from other angles, but would be interesting to experiment woth
Yeah i was also thinking about one way textures where the opposite end of the scope is only textured on the outside and not on the inside, kinda like wall textures when oob You explain it much better tho
I like the new art direction you're taking the graphics in. It gave me this feeling of being out of bounds in a hi fidelity game. You know when you think "I wanna know what that town in the distance looks like" but when you get there it has the appearance of being made of painted card board. It got me thinking, what if you leaned into that vibe? A game that feels like it takes place in one of those "you aren't supposed to be so close to these buildings" places. Of course I'm not sure it's not the vibe you had in mind but that would be a very unique art style, greatly separating it from the many other "look at my PS1 graphics" games. You already have such a powerful surrealism in the art and I for one think it's super cool. Shooting up some backdrop houses would be a blast. Also the reveal on how the scopes work felt like a Eureka moment I was waiting for this video. It's a really elegant graphical way to solve a graphical issue. Keep it up garbaj
I think that's an excellent idea! Halfway through the tutorial, you clip out of the game and end up in forgotten levels with abandoned characters and concepts. Like the island of lost toys meets the backrooms.
A fun fact about the flipped left handed model. All guns in counter strike 1.6 are flip the wrong way around. This is because the dev was left handed, modeled the guns for the left handed option, and then just flipped the model to be the default right handed.
@@soulghost9718 Well, there's a reason they usually eject to the right. A shell casing ejected to the left could hit your other arm, or, if ejected backwards at an angle, could hit your shoulder or even your face. Ejecting to the right is ejecting it away from you, so it can't hit you. I don't think it's so bad that you can't use a right-handed gun left-handed, you just have to be careful about how you hold it so the casings don't get too close to you. Different guns also eject the casings at different angles, so one gun might be easier to use left-handed than another.
Bit of a tip. Instead of moving the gun super forward, maybe try moving the viewmodel camera backwards. Moving the viewmodel itself forwards could mess up lighting on the gun. (i.e. aiming into a wall and the gun becoming super dark because it's in a wall, and things like that).
You generally don't zoom in while right next to a wall... At that point the gun could be made to tilt up or something. But you _might_ zoom in while your back is against a wall or a fence. And you'll end up seeing the fence from the other side, blocking your view. Or if someone is right behind you (a teammate), you'll end up seeing inside his character when you zoom in. I think as long as the camera doesn't extend too far back (past the capsule collider) it should be fine.
Flipping the layer doesn't exactly create left handed versions of the animations, because the gun is also mirrored. Think about the position of the bolt, bullet ejection, and other parts of the gun that are asymmetric. Also you can achieve separate viewmodel fov with a custom shader that modifies the projection matrix. I have a video showing this shader with src. Vid here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-NF-U5J92ivk.html
Technically speaking, left handed guns are manufactured (which is relatively easy nowadays thanks to only needing to give a mirrored file to the CNC machines and not retool the entire machine line) they are just rare and usually only made for individual purchases. For a more arcady game like this, it wouldn't be a dealbreaker to just mirror the layer imho.
some guns are ambidexterious in their controls, and some even have ability to switch on which side brass is ejected, so its realy plausible for example to make scifi shooter feature fictional weapons with such design
Oh, just 32 seconds in and I think the solution just occurred to me. The objective end of the tube must have a larger diameter than the ocular end! I mean, that's how all of my real optics are built and game engines are purpose built to emulate the real world as much as possible. Let's see if I'm right.
I don't think you are wrong either. Fake light beams in a perspective game still converge so designing optics like they do in the real world would probably give you more realistic results. That said, it would not be as clear as the fov method because real world scopes do block the edges of your vision too.
Pick up your cross and follow Jesus! The world is quickly headed for destruction, and sooner or later you will have to sit at the judgement seat and give an account for your actions. Belief in messiah alone is not enough to grant you salvation - Matthew 7:21-23, John 3:3, John 3:36 (ESV is the best translation for John 3:36). Call on the name of Jesus and pray for Him to intervene in your life! - Revelation 3:20. Contemplate how the Roman Empire fulfilled the role of the beast from the sea in Revelation 13. Revelation 17 confirms that it is in fact Rome. From this we can conclude that A) Jesus is the Son of God and can predict the future or make it happen, B) The world leaders/nations/governments etc have been conspiring together for the last 3000+ years going back to Babylon and before, C) History as we know it is fake. You don't really need to speculate once you start a relationship with God tho. Can't get a response from God? Fasting can help increase your perception and prayer can help initiate events. God will ignore you if your prayer does not align with His purpose (James 4:3) or if you are approaching Him when "unclean" (Isaiah 1:15, Isaiah 59:2, Micah 3:4). Stop eating food sacrificed to idols (McDonald's, Wendy's etc) stop glorifying yourself on social media or making other images of yourself (Second Commandment), stop gossiping about other people, stop watching obscene content etc and you should get a response. Have a blessed day!
2:00 flipping the layer wouldn't be enough. You would need to also flip the gun itself, or else you will have the ejection port on the "wrong" side. Fun fact, that's the reason why guns in CS have the port on the wrong side. At first the weapons were left handed. But they flipped the view because it looked weird. But they didn't flip the gun, so we had mirror guns
i also love the solution i saw in garrys mod for sniper rifles, your gun is just yeeted out of your FOV when you scope in and you just get a crosshair image slapped over your camera
Pick up your cross and follow Jesus! The world is quickly headed for destruction, and sooner or later you will have to sit at the judgement seat and give an account for your actions. Belief in messiah alone is not enough to grant you salvation - Matthew 7:21-23, John 3:3, John 3:36 (ESV is the best translation for John 3:36). Call on the name of Jesus and pray for Him to intervene in your life! - Revelation 3:20. Contemplate how the Roman Empire fulfilled the role of the beast from the sea in Revelation 13. Revelation 17 confirms that it is in fact Rome. From this we can conclude that A) Jesus is the Son of God and can predict the future or make it happen, B) The world leaders/nations/governments etc have been conspiring together for the last 3000+ years going back to Babylon and before, C) History as we know it is fake. You don't really need to speculate once you start a relationship with God tho. Can't get a response from God? Fasting can help increase your perception and prayer can help initiate events. God will ignore you if your prayer does not align with His purpose (James 4:3) or if you are approaching Him when "unclean" (Isaiah 1:15, Isaiah 59:2, Micah 3:4). Stop eating food sacrificed to idols (McDonald's, Wendy's etc) stop glorifying yourself on social media or making other images of yourself (Second Commandment), stop gossiping about other people, stop watching obscene content etc and you should get a response. Have a blessed day!
I'm glad you did this response video to a response video lol. It took me seeing both demonstrations to fully understand what's going on with the field of view.
Man, I have been in this adventure of watching u building ur game, figuring out problems and solutions and turning the table agsinst the odds...it's been fun :). And I can just say that I can't wait to play ur game and that I hope I am still alive until then xD. Keep it up 👌
One way to make the scope less obscuring while ADS when having everything on the same render is just flattening the scope when ADS. AFAIK Insurgency Sandstorm does this with the "Red Dot" sight (or a CompM4 to be exact), but doesn't remember to do it when using a magnifier.
When I was messing with first person viewmodels the way I solved the gun clipping into geometry was to just make the gun smaller and closer to the camera such that it stays within the player collider, I don't know the extent to the pros and cons of this method but it did require that the near clip plane be quite small.
Well, in fact it can be much easier scope rendering can be split in different steps 1. weapon model rendering 2. lens mask rendering at the place of the optics 3. depth cut by the mask 3. other stuff renders the mask itself is also helps to apply post effects and render weapon sight with "moving" effect
For Unreal Engine devs, since dual camera setup is not desirable due to screen capture + render target performance implications, an alternative way of doing this is to use World Position Offset tricks. Fake dual FOV on the FP viewmodel skeletal mesh can be achieved with Panini projection trick in WPO, effectively displacing the vertices to compensate the main camera FOV. Then you can use additive animations (or moving the mesh with WPO again if you're lazy) to get into ADS position.
I don't know if you'll see this but, for the performance: think of the animations (reloading, aiming, moving the gun forward and what not) as sprites in 2d games basically just prerender them and you will notice a considerable boost in performance if you are worrying about having to render swaying of the gun (while running or jumping up and down) just make the bake (or the prerender, however you wish to call it) bigger in resolution (or at least in scale) and just move the bake around with a script for swaying and all that. to summerize: -bake every animation as a video or whatever feels the most performant for godot (maybe even just pure .png frames would be better, I don't know, I don't use godot, but Unity) -make the bakes bigger than the screen by like let's say 10% (on the X and Y axis) to allow for swaying -for reloading, you play the reload bake, for shooting, the shooting bake, for aiming + shooting you play that and etc. etc. the downsides are: -a bit more work, unless you can just send the animations and models to someone and ask them to render them all for you -the framerate will be limited to the bakes (tho you could render them at 60fps and then make a script that will sync the animator and the bake with the framerate of the screen) tho I doubt it will be much noticeable -interpolation between the animations will be difficult to implement because you are working with prerendered frames sidenotes: -for the lighting; just bake the normals with the projection on the camera (and do some research on 2d tile normals) good luck
on the approach of flipping the 2nd layer for left handed gunplay - this will have a notacible effect when your gun models arent symertrical, as seen in the first counter strike, where left handed shooting will be have an incorrect "flipped" gunmodel
I’ve noticed in a lot of fps games for guns with more extreme scoped in fov like snipers, they actually change the whole screen to where the whole screen is inside the scope. Think of like widowmakers scoped in, or valorants snipers scoped in
The way I’ve done it for DayZ where it’s pretty damn limited is I’ve got 2 separate models of my scope but one is always hidden until you ads then it shows the hidden one and hides the original one which I then have tweaked a lot and removed parts that wouldn’t be visible and kept parts that are visible and it’s all hidden inside this extended tube so that when you shoot or lean you won’t see floating parts and adding a lens effect (dark outer ring) will help remove seeing the tube from the inside as well thus creating a fake PiP effect.. DayZ has a weird scope zoom feature so it will zoom in but the scope gets put closer to your screen and the reticle too so at full zoom the reticle would be in your face
Be careful swapping left vs right hand with the gun model. Depending on the weapons and their textures they will looks funny if you just mirror it. Shell ejection, changing handles, slides, scope details ect. are typically only on one side. Small details that might not be needed with the low poly models but something to look out for.
Personally, if there are not a lot of scoped guns, I would just model out the front outline of the scopes (maybe with a little bit of depth) and model the back tube separately. You could have a black cap, camera render, false reflection, etc covering the scope when it's at hip then fade the cover and back geometry as it's pulled up to the face.
some games actually have a separate optic model they switch to while aiming (at least CoD Ghosts, Advanced Warfare, Black Ops 3), and the changed model has less obstructing geometry, but the method in the video is also actually not something I thought of before!
I would like to see a game render the sight in a transparent manner. Besides long range scopes you always shoot with both eyes open so sights don’t nearly block your vision as much as depicted in video games.
This makes total sense! In the last video, you mentioned that due to perspective, the edges of the sight get in the way. Now, with a drastically reduced FOV, the effects of perspective aren't as present, eliminating the problem. Very cool!
I still use shaders to achieve the trickery, instead of using a second camera. Using shader world position offsets, which move verticies on the GPU as its being rendered, im able to also adjust its rendering FOV with some fancy math. AND keep it from going into walls using pixel depth offsets. Shader magic gets weapons much farther than anything else, as it also keeps shadows/shading. I wish I could link to some related references, but youtube likes to delete my comments when I do.
For realism's sake, unmagnified tube-style red dots (like the one you use) are just mostly blocked by the optic walls. But for gameplay's sake it def makes sense to "remove" the walls. But for a magnified tube optic, it will look like that because it uses lenses that project a larger image onto a smaller space to make it look like that and magnify the scope.
I think we're going to see a renaissance in indie video games thanks to people like you. I think everyone is fed up with being let down by the big AAA studios and that's lead to many people wanting to create their own. Really appreciate the work you do explaining your thought process and asking for help when you don't know whats going on. Information like this should be accessible to all, not some industry secret that is coveted by the big players.
That's actually pretty smart, thought it would require more work that involves changing the model of the specific weapon sight when aiming. I wonder how many games actually used this method?
Thanks for adding left handed view! I am so upset when a game alows to flip the view between sides but keeps the gun on the same places like battlefront 2 or several 3° person shooters, but also I feel bad for left handded people that play fps, they're probably used to it but it probably was wierd at first for them
I recommend watching the video "tf2’s syringe gun isn’t what it looks like..." by shounic to see how TF2 does viewmodels. Specifically for scoping in: TF2 simply hides the viewmodel, lowers your FOV, adjusts the render distance for LODs, and puts a big overlay on your screen.
I joke that any combination of words that get an idea from your head into another "is English", but sometimes you just need to see/do it to really grok it. Plus there is an art to explaining - ie the comments might have been correct, but might not have been reordered to let your brain follow the lines. Love watching you learn and progress w the game 💚
Legit, try an inner cone. If needed, I can make a small sketch on how it would work, but in the most basic way, from the camera to the front of the scope, instead of making the back to front part a straight cylinder, make it conical, so the "meat" of the scope doesn't get as much in the way. This is the best performance wise, but can look a bit funky.
Insurgency's PIP scopes will always be my favourite, full field of view outside the scope, and zoomed inside. Best of both worlds, and source engine handled it like a champ.
Another funny touch is that you can technically do the dual FOV effect without rendering the player’s hands in a separate pass: Just pass them a different projection matrix in the vertex shader and you’re done. I believe there was also a way to solve the clipping problem without introducing an additional render pass but it probably has other issues (maybe compatibility?)
Watch out the "just flipping around the image" this will create "flipped" guns where for an AR for example you get the ejection port on the left (as you simply mirrored a correct looking at)
I was kind of expecting the solution to be something like that. Since it does technically also keep the slight parallax effect you were talking about with the end of the barrel. Another thing that wouldbe interesting to look into in videogams is the fact that gras (or any vegetation for that matter) almost never looks correctly on an incline. Usually grass irl always grows straight up, no matter the surface angle, but in videogames the grass usually grows perpendicular to the ground. I personally have some theories to why that is, but it would be could if you could look into that!
Grass meshes are usually batches of grass together. Having every single grass strand be individual object would be terrible for performance. If they didn't follow the ground surface rotation then in cases like hills, one side of the grass mesh would be clipped inside the hill while other was floating in air. But now I'm curious if you could deform them performantly in shader to all be straight up while having the roots still stay in place.
@@ZalvaTionZ yea, that's the reson that i thoutght as well. I'm sure there's way to do it proper, since i've seen decent implementations for it, but it's probably not easy and lots of manual tweaking.
This is a commonly known Cinematography trick! A good example will be Guardians of The Galaxy 2 (spoiler ahead:) The scene when quill finds out who kill his mom. Camera zooms on peter while increasing the FOV. Quite the opposite approach, but the same method of increasing one while decreasing the other. I interchange zoom with moving the camera forward here, though.
just be sure that if you're mirroring the view model for left hand options that your models don't have a reloading bolt/catch/etc on one side only as it becomes really obvious that the view model is being mirrored
Omg it's that effect from guardians of the Galaxy when the camera zoom in but the camera is physically moving far it but distorts the actors face like the scope in the gun... Smort trick
Oh man, this was the hardest thing to figure out when I started doing 3D modeling at work. "we need a shot where you're looking through the door, but can see everything inside the room." Uh, what? But realizing FOV and zoom are two entirely different things to software that handles 3D projection, made things possible that definitely aren't in real life.
You should also blur and add transparency to the weapons as we humans "see" when we are not focused on the gun but in the target. Levelcap mentioned something about it ones
I still want to see someone make an old school type of shooter, where a simple red dot would take up the entire screen. Like STALKERS scopes. Or rainbow six' acog
if you still want to do picture in picture optics you could probably make it happen with just a screen space shader instead of a completely different camera. that might even perform better than what you're doing here, since there's still only one game camera. of course, if you're going to render two worlds anyway to prevent your gun from clipping through things this fov trick is basically free.
Be careful when you flip the image because if you flip it the gun will not be accurate from your original Modell. A nice example is in CS-GO. The AWP is flipped when you hold it in your right hand, you can see it because of where the bullet comes out should be the other sight
I just want to ask, and tell you something: So when you trí to export your godot game to .exe the Inputs from the InputMap are not exported, only that starts with ui_. Do you have any idea how to solve that issue?
your game textures look like older games when I set the LOD bias to some absurdly low number in Nvidia inspector, which is a compliment btw I like the look a lot lol very early-3D graphics
Using a separate camera for the character model in FPP is the standard that 99% of FPP games use, I don't know why you'd want to avoid it. Even games that render full player body (legs etc.) do this at the very least for hands and gun.
there are many games that dont do this (the arma series being the main example people use) and there are plenty of games that simply don't need to (receiver 2 doesn't have arm models and there are no scopes, just ironsights)
A bullet counting system for reloading (for example a shotgun knowing how many shots to load in instead of a full reload) explanation would be interesting, always wondered if its really simple or a bit more complex