This is less common with games like DayZ and Arma (same engine) where the "mil-sim" aspect of the game kind of required a bit more consistency of where the bullet was coming from. However, as you will notice, there's downsides to both a "in world" view model and bullets coming out of the actual muzzle. 1.) We don't hold our guns perfectly in our vision. The idea of a "view model" was instilled into gaming with it not being super realistic, mechanically it allows us to see what gun we're using but in reality if you ever actually play paintball/airsoft (or actually engage in combat) with a go pro on your head giving your "FPPOV" you'll notice that at most you'll see the gun when you aim down sight, but the rest of the time the gun is flailing around outside a normal camera FOV. So having the gun be a part of the real world model means you'll see less of it, and the view can be sickening to try and follow, especially for more action hero characters (Arma characters are well trained enough to not make heroic and action hero like wild movements). If you want to get a normal FPS game perspective of real life shooting, you would effectively need to have a camera on your chest. 2.) Depth Perception This is a major reason why games, like Arma in this example, utilize a crosshair despite it being debated on it being an unrealistic UI element or with the idea of it being cheaty. The reality is if you've ever held a gun (paintball or airsoft applies) you'll know that intuitively the general area you're pointing due to having TWO eyes and making use of your natural depth perception. With the Arma rifle being both in world and firing from the actual muzzle, gaging where the bullet is going to go is a little bit easier, but nowhere near as good as if you were holding the gun with both your eyes, and while this effect is actually worsened in separate view models, the bigger issue is the bullet comes out of the gun. Which means commonly people will peak out over cover, be unable to read the fact that their gun is actually below the cover you're shooting over and you just plant a few point blank rounds into whatever you were hiding behind. Now imagine having a fake view model and having your bullets come out of the theoretical third person gun model that you can't even see. 3.) Heads up This is the main reason most games end up abandoning "world models" or 3rd person view models, the idea is that we're going to make a character and we're going to plant the camera on the characters head, and make the first and third person models the same thing. The first glaring issue is the fact that you can see your own head. Most games that tend this way actually remove your own head from rendering to function better, it's the same model but the head is just invisible to you, so you don't see weird floating polygons that is actually just your nose or hair/helmet. But this also leads to really janky looking movement. Naturally as you walk your head is actually swaggering left to right and up and down and even leaning forward and back with every step, but your entire body is telecasting your intentions to the motion centers in your brain so you can automatically calibrate your human viewport to be smoothed out and not cause motion sickness. But when looking at the 2D viewport of a game, this peripheral information doesn't get translated and your brain just sees a shaky blurry mess. While it's getting more common to see games tackle this idea, understand that a majority of games steer clear of these mechanics for good reason. That's why games like Apex, Overwatch, and Valorant all went with laser vision.
in a few games the gun rreally works, example:Phantom forces (a roblox game) here the models are preetty well made, the gun shoots where it is supposed to shoot, instead of your eye shooting.
TF2 and other Source games, as far as I know, are capable of using one camera to render a scene multiple times and superimpose the rendered scenes together. Garry's Mod uses it to handle 3D2D objects- it temporarily moves the camera, draws the object, then moves the camera back and draws the rest of the world.
I remember seeing something in one of Shounic's videos about how all the viewmodels in TF2 are actually separate, enlarged models of the characters' arms and weapons that appear in front of their head, that are simply invisible when viewed in third person or by other players unless some cheaty stuff is enabled
Unlike a traditional shooter, in VR, the bullets actually come out of the gun model instead of your face. This is real neat, since motion controls allow you to freely miniplate the position and orientation of the gun in 3D space. This means that, without the programmers needing to program in the specific function for it, the player can play the game more like Gears of War if they want, blind-firing and all that. This horribly breaks barebones VR ports, which aren't expecting the player to be able to do this. Especially if they didn't bother to add collision to your hands, which means you can just straight-up ghost through walls and interact with things you shouldn't be able to do. Like being able to get the Cryolator in Fallout 4 before you even leave the vault, simply by snatching it out of the locker without picking the lock.
That’s why I always get a bit annoyed when people talk about VR like it’s just another console, when it changes every facet of play. A great example is 40k Battlesister. Simple things like being able to hold larger weapons with two hands, being able to hold onto the front without holding the back, parrying with your sword actually working, manually removing and inserting magazines, bludgeoning heretics with non-melee weapons, etc. Stuff like that is only experienced in VR. Sure, I can run out of ammo and click the right stick to melee a guy on Xbox. But that is entirely different from my meltagun running out and instinctively turning it around to bash a cultist’s head in.
@@williamwhitehouse8741 Seriously? Ah, good old buggy Bethesda! Though another cheat you can do in the VR version is taking a shortcut to the end of dungeons by reaching through those doors that are placed near the dungeon entrance (the ones that are intended to help the player quickly exit the dungeon after they've reached the end) and unlocking them from the opposite side.
fun fact, a lot of old FPSs did the same thing. to piggyback on Fallout, Fallout 3 uses that method, the bullet comes from the gun, hence why you may shoot at something, but have the bullet hit the wall or piece of cover directly in front of the gun. New Vegas, switched to the old bullet leaving the front of your face to combat this annoyance, and im sure for other reasons.
@@fireaza If you are talking about Skyrim, I heavily suggest getting HIGGS (I believe it is what it's called) among other mods like a full body. It makes the game infinitely better in VR because you actually have a digital both that can interact with things (Like balancing cheese wheels on my triceps) and see what you wear. As for HIGGS, it allows you to actually grab things, for realsies, like actually grab corpses by the ankles and drag them. Amazing stuff. Fixes the glitch too since you are no longer some bodiless Skyrim ghost that levitates things slowly and can phase through walls, which is neat.
In TF2 each character has two models: a full character mesh and their view model. both are rendered in game as 3d objects just like the characters, projectiles, and terrain, but the view model is only visible from the first-person perspective, and it renders over everything else but the HUD. I used to turn-off the view model and render the character mesh in first person because it freed-up my POV and could also help me get a feel for where my hitboxes were at.
2:30 I was going to throw a theory on the matter, but turns out that it has been already covered, so here's another clarification. If you remove the z reading or writing, it would affect the polygons of the weapon itself rendering over each others in reversed calling order, so to achieve this effect, it's probably clearing the depth buffer of the scenary before rendering the weapon without disabling the depth reading or writing. Another clarifiaction in 2:50 is that only raytraced bullets are shot from your eyes, however proyectile type bullets (like Lucio's example) are actually coming from the weapon, but using a raytrace from the eye's perspective to calculate the direction of bullet so it hits where you're aiming to. This is better explained in Shounic's video about the rocket launcher, I recommend watching it out.
Overwatch doesn't do this like TF2. Although it looks like the projectiles are coming from your weapon, they do actually come from your eyes. So it basically shows a fake projectile path to the player who's firing the weapon.
What valve does is scale the depth range of the renderer to 0-0.1, so if you had level geometry close enough it clips through your camera, it would also clip through the viewmodel
@@Thornskade That's wrong, Overwatch only uses eyes for hitscan, projectiles are 100% coming from the gun itself. It's why if you're standing in front of a wall and shoot as Pharah for instance, the impact is where the gun's tip is.
To be honest, I really do appreciate it when FPS games make an effort to make the gun physically real and not in a separate layer; it avoids collision, bullets come from the gun's tip instead of your face etc. StarCitizen did a lot of neat things with this.
I think it's more about the game design rather than implementation difficulty. Imagine scenario where you're hiding from your enemies behind boxes, stand up and shoot into the box because your weapon is too low. That would be really frustrating! Devs could implement animation for character to raise hands, which would kind of solves the issue, but how high does the character need to raise his hands? And what if the enemy under crosshair is also behind some cover? Now that I think about it, maybe it IS about implementation difficulty... Too much effort for no practical use? Projectile weapons, on the other hand, tend to shoot from the weapon tip, like the rocket launcher from TF2. And yes, that means that when you're behind some cover it's easy to shoot on the right side but hard on the left - you have to peak further to not shoot into the wall, since default settings imply right-handed player model. Although, there is a special rocket launcher called Original, which is in the middle of the screen like weapons in *original* Doom games :D
@@AlexProGear yeah, like it's neat when it's implemented but it can really hinder a game if it was not designed for it, for example, CSGO would be literally unplayable if bullets came out of your gun
@@AlexProGear An alternative could be to use a camera-centric shooting mechanic, where bullets come from your face, but the character adjusts where his gun is held to satisfy (as best it can) the constraint that a light of sight must be established between the gun's tip and the visible point under the crosshair. This would cause the gun to move around the wall or ledge, and would look a bit like the gun is blind firing around a corner, switching handedness when appropriate. It would all be cosmetic and not affect the gameplay but would create the look of authenticity. It'd also communicate effectively to other players that - because their gun is visible and pointed at you - they are able to shoot you. Could also add another constraint to prevent the gun from obscuring your line of sight. I think it'd be pretty sweet if a game implemented a system like this, where the character moves his weapon dynamically and adaptively to his cover like some sort of movie! Sure, it'd be hard to implement, but it is important to move the art form forward
2:47 "Does this mean i can shoot through a wall" Arma 3, I believe they use one camera, but the gun does not interact with certain walls as it should, if there is a thin sheet of metal you're able to stick the barrel of your gun through and shoot without having the penetration damage penalties. Same goes for floors of buildings and most other thin walls.
Escape from tarkov actually calculates the bullet direction from the barrel of the gun. Not sure if you can shoot through walls like Arma but its cool to think about
Basically in order to draw a mesh on the screen its vertices are multiplied by 3 matrices. One to move it to where it is in the world, one to then move that location relative to your camera, and then one to transform that relative position into a position on your screen. That third matrix is called the projection matrix and it's what simulates depth perception by for instance making objects smaller the further they are, and it's calculated according to a desired FOV. So, rendering a viewmodel with a different FOV on one camera is as simple as calculating a projection matrix for a specific FOV and sending that to the weapon model instead of the regular projection matrix the camera will use with its FOV.
Exactly this. We think of every object in the scene having to receive the same camera matrix, but absolutely nothing stops you from changing the camera for each object.
I love how this illusion completely is ruined when it comes to mirrors, as in you can see the mirrored model clipping through the mirror even though you aren’t, I remember discovering this when playing hitman III, even though you don’t look like you’re clipping through the mirror Your mirrored self definitely is
The illusion also kinda breaks when you compare to thirdperson. Usually the viewmodels make it look like you hold a gun in front of your face, while the character model usually holds it around the waist.
there's a game i've been playing recently that actually does FOV differently than most called Stalker Anomaly, where instead of your gun being rendered like in most other games, the weapon is instead considered a part of the HUD. and there's a second slider in the game that changes how close or how far it is from your face called the HUD FOV slider.
TF2 Can make use of a vec4's quaternions to distort the rendered object to appear as if the fov is being changed, where in reality it is being stretched/skewed through the 4th dimension.
For the TF2 viewmodels, there is basically a giant viewmodel rendred in front of your character. No one else sees it but you. They are actually shown in this video if you want to see how it would look like in thirdperson. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-BAs-ph7lqqA.html Because they are rendered in 3D changing the viewmodel fov just moves the viewmodel away from the player.
This isn't quite right, it causes warping on the viewmodel indicating that an FOV change is actually taking place. A better example for this is in CSGO (same engine as TF2) where you can change the viewmodel X, Y, and Z position as well as the FOV - the FOV isn't just moving the viewmodel, it is actually altering the FOV of it. I have no idea how that would work myself though, I'm sure someone else can explain it
@@heliusuniverse7460 likely doesn't even use a special vertex shader. Most likely, they just simply pass in a different perspective matrix when the viewmodel is rendered. It's that simple.
@@EmApex We use something called view and projection matrices, which is just fancy 3d renderer speak for changing the math that interprets it on the fly. It's all still done in the same pass, but we can change how certain things render in that space by changing the math that applies to it.
TF2 probably subtracts the main camera's projection matrix from a project matrix of whatever FOV the gun is supposed to render as, and then multiplies the vertices of the gun by the differential projection matrix. Originally I assumed TF2 just applies the intended FOV matrix to the mesh instead during rendering, but I'm pretty sure that would be hard to pull off without weird stretched reflections.
It's just swapping out the projection matrix / clearing the depth buffer between draw calls. Source's rendering system is still very much designed for fixed-function hardware where operations like that would be costly
2:24 I think you have to go beyond thinking with high-level abstractions like cameras. I'm not an shader whiz (never written one in my life), but this is how I think it could work 1. Render the world as usual 2. Swap the projection shader for one with a different FOV 3. Flush z-buffer 4. Render the gun with otherwise same procedures except the swapped shader.
Speaking of the TF2 FOV case: there are no such things as cameras in computer graphics. In order to draw something "from a camera view" we build a view matrix that will translate every object (specifically every vertex) from world space (your usual coordinate system) to view space and we do that in the vertex shader for each vertex. To handle FOVs we use a projection matrix. I'm not a professional graphics programmer (just a beginner) so I might be incorrect, but in order to have 2 FOVs (one for the world and one is for the gun/hands) you just have 2 projection matrices. First, draw world stuff, then disable depth test and draw gun/hands with the other projection matrix (that includes a different FOV). So, only one "camera", just different projection matrices. If we would again speak about the cameras then we might say that TF2 is using 2 different cameras (each having a different projection matrix). In my small engine, which I'm developing for educational purposes I only have 1 camera, you can't have multiple cameras, but you can always use another projection matrix in the vertex shader to handle this kind of stuff, so there you go: only one camera but different FOVs. :)
No such thing as matrix in computer graphics, its just 16 floats stored sequentially in RAM. What we do to create matrix is sending a uniform to GPU through PCI.
2:16 tf2 allows the arms to stretch in the 2nd camera because the view model is an actual model that other players can't see so when that view models fov is increased it stretches the model
You can render the gun model on top of everything without using a 2nd camera by clearing the Z buffer after rendering the scene, but before rendering the view model. Likewise, you can manipulate the FOV of the scene and the view model independently by clearing the Z buffer and then swapping out the view matrix. In my own projects, I use the same trick to render the skybox: it's actually a 1x1x1 cube around the camera, but I clear the depth buffer after rendering it, and so the rest of the scene simply gets drawn on top of it. This allows me to use the same layers for the skybox and view models, and in turn saves on graphics memory and only requires a single pass on the post-processing shaders. This also makes it much easier to keep the lighting seamless, as you've mentioned. You can drive this even further by doing multiple geometry rendering passes with different near and far Z clipping planes, clearing the Z buffer between each pass, to get a crazy high depth resolution. I'd be willing to bet that games that need very far render distances, such as flight simulators, employ this trick to render the world far away while still maintaining good detail up close. Of course, to do this sort of thing, you need direct access to the graphics library you're using (OpenGL in my case). If you're using a ready-made game engine like Unity, your options may be more limited.
Dude, all of your videos consistently appear at the top of my recommended and I’m not even subbed (I’ll fix that now) - your SEO must be crazy impressive, and congratulations on the success! They’re always a delight to watch.
The problem is that you're thinking of Cameras as actual objects when in reality they just describe how to transform the scene in the shader code. It's alot of complicated math but the camera holds a few transformation matrices that describe how to place objects in the world, their lense FOV, etc. At the end of the day it has to transform it from that world space into what I believe is clip space (although I may be mistaking it for NDC, Normalized Device Coordinates). Which is essentially what graphics API's like openGL work in. Your actual screen coordinates are represented from -1.0 to positive 1.0 on all 3 axis. This is what is actually put on screen.
Yeah, clip space is correct. It's where things end up after the projection matrix and perspective division. I've only used OpenGL and Vulkan, so i don't know if DirectX has a different term for it.
About Apex, legends like gibby actually move at the same speed as everyone else but the effect applied to FOV while running and his animations are different enough to feel much slower. I think its interesting how they worked around movement breaking immersion without actually changing gameplay and I thought you might, too.
i believe that in tf2, the game renders 2 separate models: world model, and viewmodel. your viewmodel looks much more different then your world model. they don't use two separate cameras or layers.
In Goldsource/Source-speak, viewmodel is the first person model, world model is the third person mesh. It doesn't relate to how the first person view model is rendered.
@@daveface69 Fun fact, you can use console commands to use your world model in first person. It's most likely going to clip your head into your camera, but it sort of works and shows how others actually see you
@@notalostnumber8660 In TF2, the implemented this to try to accommodate future VR support, but it also makes it easier to aim certain weapons like the Huntsman, as your perspective now accurately sees where the arrow is coming from in relation to your position, making arc estimates better.
I heard the special trick in team fortress 2 is there is an invisible pair of arms with the gun that float around the game world along with the player models, but they're only seen by the specific player or spectators
You don’t necessarily need a secondary camera to render specific objects in a specific way. For example in Unity’s URP you can insert render object commands at any point in the render pipeline and override the camera settings for that object. Under the hood it’s just modifying the projection matrix for those objects. Before SRP the way to do this was command buffers. When you have a custom render pipeline or custom engine you can render anything however you’d like. Game cameras in general are nothing more conceptually than convenience objects used to set up a specific rendering state/projection matrices. You can always do that manually in other ways.
Coming from a Garry's mod player, the view model is a model projected in front of the camera, and they are spawnable within gmod actually. So when they want to stretch the viewmodel "fov", they just stretch the actual mesh instead to give the same effect.
One thing I also noticed is that a fair number of games have certain parts of the sights be another layer on top of the gun viewmodel. This is especially prevalent in games with EOTech sights (commonly referred to as holo sights). I remember one time Apex Legends' servers were so borked that when I would ADS, the viewmodel would move appropriately but the actual reticles, and even _parts of the iron sights_ wouldn't render, making it absurdly difficult to aim.
Regarding seperate Weapon FOV: Til a model is rendered, it goes through several matrix calculations to transform it from model to world to view spaces. It's possible to render each model with a seperate chain or to calculate a matrix that counter transforms the FOV of the camera and have it look not distorted. So it means the model gets distorted in a way that counter distords the distortion imposed by the FOV. And then there are things like panini projection which avoids some distortion in general.
The shooting from the eyes was quite famously adressed in BF4. When the game was new, people headglitched a lot and that made players angry, because it was clear that the buttlets were shot from the head, while the torso and the gun alike were behind cover. They patched it and made the bullets come out of the torso on gun height, so that seeing the enemy would not mean being able to hit the enemy anymore.
2:45 in GTA V and Online you can actually shoot through walls with long weapons (Sniper is the best) if you sprint into the wall and shoot at the right time. I think with Snipers you could also just stand right next to wall and be able to shoot through
Rendering multiple meshes typically involves steps like these: Set the world-to-camera-matrix For each entity -> Set the model-to-world-matrix for the entity -> Render the mesh of that entity It's perfectly possible to change the world-to-camera-matrix in the middle of that loop: Set the world-to-camera-matrix for regular stuff For each entity except the view model -> Set the model-to-world-matrix for the entity -> Render the mesh of that entity Set the world-to-camera-matrix for the view model Set the model-to-world-matrix for the view model Render the mesh of the view model That might mess with the depth calculation, so it might still be necessary to turn the depth-buffer off. But it does not require rendering to a separate buffer.
I could be wrong about this but with source games, how it works is the first person viewmodels are just models that are drawn in front of the camera in the game world physically that are just set to hidden for every other player. The viewmodel FOV doesn't change a camera but warps the actual model itself.
Tf2 uses a "invisible" viewmodel, that's basically only visible for the player, and when you change the "viewmodel_fov", you change the distance between the camera and the viewmodel itself. And also the bullets comes from behind of the eyes like most fps games, although some weapons are different (they come from the weapon itself, like the soldier's rockets, for example).
As the developer of a FPS game, I'll shed some light here. What's going on most of the time isn't that there are two separate cameras or layers or "universes". There's usually only one render pass where most of this stuff is happening, but what happens is that prior to rendering the "avatar", we change the view and/or projection matrices. Changing the matrix and the render options for the model allows us to set a fixed FOV and change the Z-depth ordering compared to everything else. It's still actually there in the world along with everything else. In the game I develop, I actually have a penchant for "physicality", so everything is a projectile that comes from the gun muzzle. To make this work correctly, we project from the eyes down the muzzle to check if the space is obstructed.
Professional game dev here -- another method that we use is transforming the actual geometry of the gun (and the effects) to "counter-warp" the game scene so that as the FOV changes in the world, the gun is being warped precisely oppositely so that it remains the same. In Paladins, we did this directly in the Render Transforms of the mesh's components and effects. In our newest game, Starsiege Raiders, we are doing this with a shader and using a technique called the Panini projection. This allows us to render geometry in the "foreground" when there is no render layer available and also "counter-warp" the distortion as the world FOV changes.
Best way I can describe it is that the game renders the world first, then changes the "camera" to have the viewmodel fov, and makes the viewmodels depth have a range 0-0.1, so that only *really* close stuff will clip through, before rendering the view model last. Keep in mind much of this code was written for hl2 in around 2001, for hardware that did not have programmable shaders. I'd link the code responsible in the public SDK, but links are generally blocked in comments.
im making an fps rn that has a gun that clips through the walls, and my bullets do shoot out of my gun, not my eyes, but to prevent it from going through walls, i made the bullet generate at the very back of the gun.
Based on my experience developing an FPS game, one of the things that we did (specifically because we were unable to put the weapon on a different layer at the time) was we actually inversely distorted the weapon based on the current camera FOV. So exactly as you saw the TF2 gun stretch with the FOV change, we were basically applying a distortion to the gun in the opposite direction to maintain the shape of the weapon. For something like Source though, I'm pretty sure they just render the weapon in a separate pass - which is not that expensive when you're capable of direct access to the render engine.
You don't need distinct camera objects to render to different layouts. In engines where you have such control, you can change "camera" properties mid-frame between objects. The "camera" is just some parameters to the drawing system. You can change those whenever you want. Cameras aren't things. Game objects aren't things. It's just a way of conceptualising the drawing process, and you can fundamentally draw what you like.
As a filmmaker, I use greenscreen a lot to composite shots together, but I've always wondered what it would be like if the foreground footage was shot with a different lens than the background footage, with two different focal lengths. I had no idea that's effectively what lots of FPS games are doing when they add an FoV slider!
about the tf2 gun, they apply a different camera matrix to the gun than the world. a matrix describes transformation of a point in the space, and applying a matrix transformation to an object means applying it to each separate point of it. multiple matrixes can be applied one after another to an object. opengl renders triangles in so-called screenspace. screenspace is a 2x2x2 cube located in the middle of the space, any triangles outside this cube get culled. the perspectice matrix stretches the space so the further a point is the smaller it appears and the opposite. near a nd far clip are the distance at which something will go outside the screenspace bounds. applying different perspective matrixes to different objects is possible and will result in the seemingly different fov while in the same world
Honestly just commenting purely cause of the little tid bit at the end talking about how he said that to boost engagement, it was super genuine and also made me giggle, good job
tf2 renders the viewmodel separately, i have no idea where a lot of people got the idea that it's somehow being rendered in the world, it's lit /well enough/ because it uses lighting data from the player's origin point (which has its own faults) but it's 100% on its own layer separate from the world camera
In Source games like tf2 and csgo you can have a config for your viewmodel lots of players have custom commands set up to get it just the way they like its not modifying the fov its actually shifting and moving the models and to keep things from clipping the same trick is used where the viewmodel has the highest priority The freedom this gives players is ultimately the best option cause you can run 120 FOV and bring back the normal viewmodel with the right config so it looks like the standard or run 70 FOV with you gun a mile out in front of you
With the two camera FOVs you can adjust the gun one so your gun looks nicer. I remember back in the days of Counter Strike modding people would make their guns scale up towards the front so they would look nicer. It's more noticeable on longer guns. Just another thing to tweak to dial your game in :)
As a Fun Fact: Medic's Syringe Gun is the only gun in TF2 that actually fires the Visual Bullets from the View Models' gun, compared to Weapons like the Rocket Launcher, which only fires (technically renders) the Visual Rockets from the position that the View Models' gun is normally located at. Shounic also made a video on that if you want to know more.
Hey I know this is a month or so late but here’s everything I know about the tf2 cameras, tf2 has a lot of cameras, you see unlike other games tf2 guns aren’t cosmetic, you can do things like corner shooting, if you’re at a corner and you’re close enough to the wall of the corner you’ll see your gun go past that corner and you’ll be able to shoot throw that wall, that’s because your gun shoots a little bit from the right of your screen, of course if you use flipped gun view models then your gun will shoot a little bit from the left, however that only to non pyro and heavy guns and it also doesn’t apply to the “the original”. As far as I am aware there are more than two cameras, one of them is ofc the main player camera, the second camera wells it’s not only a camera but also an object in the game and it’s responsible for your gun ( it’s really hard for me to explain it ), the third camera is sorta combined with the first camera you see. The first camera is responsible for what your looking at while the third camera is responsible for what’s coming at you. You see this is required for the tf2 predictability software, you see tf2 has something that tries to predict your next movement ( apparently this makes the game smother, makes it require less space, and also easier for your pc and servers to handle ). In order for the software to do that it’ll need its own visual and audial capturing devices and you also use those devices. There’s also a camera that captures the things are approaching you and another for the things you’ll be approaching, I know a lot of cameras, but you see it’s required in tf2 because well spawn teammate outline give you a temporary camera. The only reason why I know soo many cameras exist is because I was told that by my friend who tried to make a wall hacking mod for projectiles, yes apparently even projectiles have their own camera but you don’t use that one, if you ask me that’s just a lot cameras , they’re using the same thing that was used in the matrix movies to capture bullet time, it’s a lot of cameras, what worse is that there’s even more, there’s the teammate spectate camera, and the map camera, so yeahhhhh A LOT OF CAMERAS
In source engine games like Team Fortress 2, the viewmodel is projected onto a plane directly in front of the camera. You can see this by noclipping very closely into some map geometry--the viewmodel plane will clip through the wall's geometry slightly before the main camera plane does.
And then you have oddities like Bungie's Oni, where bullets actually do come out of the gun but the player's camera does absolutely no parallax adjustment. As a result, you end up with "depth scopes" and a system which makes hitting anything beyond 10 paces REALLY difficult.
The render pipeline is very complex, but a simplified explanation is that the source engine also uses a separate "camera" to draw the viewmodels to. It copies all the values from the main ViewSetup to a new instance of the ViewSetup class, and replaces some of the values (like farz, nearz and fov). and then "layer" this view on top of the 3D view. However in source they do use a (presumably) cheap hack (trick) where instead of clearing the entire depth buffer to prevent poking into walls, it just sets the depth buffer range to max of 0.1 probably to save on performance. Once it's done with the viewmodel camera, it restores the depth buffer range and continues on with the next "camera" to "layer" on top. The only case a viewmodel is rendered to clean depth buffer is in Portal, when going through a portal, because otherwise you'd see clipping when getting too close. Cameras and layers are a very simplified term to help understand how things are treated internally, which is probably why it can get confusing at times.
You absolutely can do the FOV trick with a single camera - the trick is to use special materials on the weapon that counteract the standard FOV, and this is the way it's done in Unity's FPS Sample.
In D2, bullets do come out of the barrel. This has the weird effect that guns with longer barrels but poor range stats can actually have a better effective range than those with better stats but smaller barrels.
If I recall correctly, back when F.E.A.R. came out I was thoroughly impressed with how the flashlight was actually linked to the first person gun model. That wasn't something that was commonly done and trying to explain it to people wasn't so easy, because most people were like "Yeah, that's how it should work." and I would be like "Yes, but that's not how most games are made. The First person view is completely detached from the world you play in." Good to see someone else explain it all these years later.
There's this thing called a vertex shader that is basically a function running on the gpu that's responsible of transforming each vertex of the model being rendered from model's local space to world space, to clip space etc. Between these transforms there's a transform called the projection transform and it's responsible for projecting a vertex (3d) on a 2d plane (your screen). To achieve that, the vertex is basically multiplied with a projection matrix that is build based on your frustum's properties (near / far field, fov). To render the object with the same camera, but with a different fov, all you have to do is making sure that your weapon's materials use shaders that implement custom vertex shaders that use a different projection matrix - one that is built on a different fov frustum. I suspect that's the "sneaky" that Valve is doing. Regardless, you can render two objects at different fovs if you take care of the projection matrix for each independently.
You can alter the perceived FOV of any object by applying a clever material with position-offsets. Certain engines (Like Unreal) don't play nice with multiple cameras/scenes, so tricks like this are handy.
about 3:05. in destiny 2 certain weapon ornaments can increase the range of a weapon. You can look this up specifically the "Chaperone" gun ornaments. I think this is because the bullets must come from the barrel in destiny 2 because there is sometimes 3rd person perspective.
2:25 The problem is that there really isn't a camera. It's just a bunch of transformations, usually three matrices (world, view, projection) and you can easily switch them between objects. There is nothing preventing you from switching FOV (and/or clipping distance) at any point in time, even with a single "camera".
Well done on your previous video. Never seen your channel but gaming stuff pops up in my feed and you got lucky. I don't even play fps lol, but it's interesting.
Most FPS games has a different gun models and arms for first person and third person view. As you might notice in first person view, the gun looks very detailed and high quality. But if you look at the gun in 3rd person view, it is somehow less detailed as well as the arms.
in valve games built on the source engine the models are indeed rendered on a separate layer, however since the lighting is all pre processed and baked into the map, its fairly trivial to use the same lighting on both the world and the gun. this is why in source games the gun is not illuminated by dynamic shadow casting lights, however since the separate "view" is using the same scene data SOME dynamic lights can be cast onto the weapon, just not lights that cast shadows since in the "scene" with just a viewmodel and world lighting, the few dynamic lights that are used cannot have shadows cast onto them from objects in the other "world" (although there are tricks to get around this limitation).
In GTA 5 (even though it's mainly a third person game) the bullets do come out of the gun, specifically the tip of the barrel. So if you run quickly with an aimed long weapon (for example the heavy sniper rifle) you can clip the barrel through a very thin wall to shoot through it.
the trick in tf2 could be that they apply the inverse of the FOV to the gun model, so instead of using 2 cameras, the single camera "remove" the warping from the pre-warped model. But that may introduce some artifact from the double transformation
FOV is just part of the perspective transform matrix, so you render the world and then change the perspective matrix, turn off the z-buffer test (or just clear the z-buffer if your gun model won't look right without it), and render the gun.
i like how gunz: the duel works. it shoots a ray or projectile from the barrel to where the crosshair is pointing to the screen, which means often the gun is shooting diagonally. Still there's a trick where you can get the crosshair on an enemy behind you by looking almost straight up and shoot him.
yes, the source engine has a separate viewmodel FOV. Which means that both TF2 and Apex Legends use it. TF2 allows to change the viewmodel fov, Apex doesn't.
You don't actually need 2 cameras, just some shaders knowhow. In shaders you can modify the projection matrix. So in your viewmodel shader what you do is both ignore the Z-Depth AND change the projection matrix to match with the desired view FOV. At some point I actually messed around with that in Unity and was pretty much there (I just forgot to have the actual "render" match up to the FOV, only the pixels ignoring the Z-Depth were right, but the actual weapon rendering was still rendered at the camera's FOV) with that specific technique. As for Doom, those who said it moves the weapon out of the way are only partly right. When you get up to the wall the animation is not immediate, but the gun still doesn't clip. Plus you can still shoot and it restores the animation. I think the gun getting out of the way is purely aesthetic in Doom 2016's case. Another common technique among UE4 users is apparently to have the weapon scaled WAY down but have it so close too the camera it appears big. Personally not a fan. It distorts the shadows and controlling the FOV on this becomes a massive mess. Edit : For further precision, the usual giveaway of either techniques is the shadows. If your viewmodel is affected by world objects' shadow then it's only a shader trick, no layers and cameras. If no lighting affects the model whatsoever or only very basically (just general ambient lighting, which is easy to give to the shader even if the model's rendered by another camera) then it definitely uses layers/cameras.
Most engines give developers finer control over rendering than just the high-level "camera" concept. A camera ultimately is decomposed into two or more 4x4 transformation matrices, often called "view" and "projection". To achieve FOV-invariance for the gun, you just need to use a different projection matrix, not a different "camera" because the "view" matrix will be identical. Similarly, you can use this same alternate projection matrix to achieve the "layering" effect without actually needing to render a separate layer. Just set the z-colum of each matrix so that the gun renders in into e.g. the nearest 0..0.1, and the world renders into 0.1..1. But that can cause problems with screen-space effects so must be done with caution.
Everyone else: talking about fancy video game mechanics and other complicated stuff Me : wait a second the bullet doesnt come out of the gun? My whole gaming life has been a lie!
You can change the fov by applying a transform to the gun, its as "easy" as that. You could even calculate the difference in the cameras fov and the desired fov of the gun and apply that so it never changes shape from the point of view of the main camera. That's all the camera is doing anyway, just applying the cameras view transform to all objects in the scene so they move / scale / rotate into "camera space" before being sent to be rendered
In takeover the bullet comes from the gun, that is to say that if you are brushed up against a wall the shoot the bullet goes to where the barrel is and not where you are looking, so that is like super attention to detail
Video may be old but like, in TF2, as a Soldier/Demoman (maybe others) their projectile weapons, if I have the Left Hand option selected in the advanced settings, the Rocket/Slugs will come out from the left and it's actually a thing. Rockets coming out a from the Left Side able to go through a corner while if I were to switch to Right Side, they would collide against the corner while standing in the same area... it would seem like it is just a visual change but it really isn't.
I know this is kind of an old video, but whatever method TF2 may be using most engines that allow for the Z-buffer settings and render priorities will have features for custom render passes which includes pass based FOV settings. So while it isn't on another layer the mesh for the first person model may be rendered in another past after other meshes per frame.
Cameras are just a convenient abstraction around projection and transform matrices. By skipping the abstraction and manipulating the projection matrix directly, you can alter the FOV for an arbitrary portion of the scene without additional "cameras"
The Viewmodel in Team Fortress 2 is right in front of the camera. When you switch the Fov of the Viewmodel it only gets further away from the camera. That also explains why you see the Viewmodel of other teammates. The real FOV can be changed seperatly from the Viewmodel FOV. Hope that helps.
You still don't necessarily *need* a separate "layer" to render the gun to, just the same way you can clear the Z buffer before rendering the gun you can simply update the projection matrix, rendering to the same target.
Ironically on GTA Online, clipping the gun does allow you (but most notably NPCs) to shoot through walls, since the bullet comes out of the gun. On Battlefield the bullet spawns around the neck area to avoid those "laser eyes sniper" situation where only the forehead of the player is shown
Older CoD games (e.g. CoD WaW) use only one camera for both the view model and the environment... Changing the FOV (using console commands in dev mode) causes some funny clipping in gun and hand models... It also shows you some funny quirks to the animations that weren't meant to be visible to the player... (PPSH comes to mind)
2:57 in destiny 2 the bullet actually starts at the tip of the barrel f.e: there's a slug shotgun called "the chapperone" wich has a reskin where the barrel is longer wich gives it a few cm more range
in tf2 the viewmodel of the gun is a physical client side only model that is positioned to follow the camera, you can actually change this model out for the world model with toggle cl_first_person_uses_world_model 1
In some situations like the new DOOM games, they simply shrink the arms and guns and place them really close to the camera. This avoids clipping and maintains consistent lighting.
In addition, the weapon pose is FPS games is completely unnatural, holding or reloading the weapon just under your nose, made that way just so your weapon is always in camera.
some stuff that happens in a lot of third person games, in the rigth angle you can shoot behind walls cause the game just check the dot in the center of the screen, it is something that i abuse a lot in games to shoot in cover
You can also do camera/viewmodel FOV independence by doing math on your gun's shader to offset your gun vertexes to render in the fov and position you want them to.
I've noticed in games like Rainbow Six that even your character is on a different layer because if you lay down on your back and slide towards a wall or makes your body look tiny
2:45, in GTA 5 you can actually shoot through walls but only in third person and you can't be aiming down the sight or scope of your gun but I'm not entirely sure about that last one, it might only be the case for the sniper since using it while scoped in changes where the bullet comes from as it switches you to a first person perspective.