Announcement

Collapse
No announcement yet.

True FPS camera issues

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    True FPS camera issues

    Hey guys I'm new here. I'm kinda stuck in my project. I was attempting a true fps controller for the past few months.

    Everything works nicely but I have a bit of a vertical headbob which I'm trying to remove.

    The camera is the child object of a spring arm and is attached to the head which takes care of the rotations issues. The pitch of the controller is driven by the head rotation via an aim offset.

    I found out that star citizen devs somehow fixed it with some ik but I cannot understand how he did it.

    https://youtu.be/Aca-y58V6_U

    Link to the star citizen dev diary

    https://youtu.be/so7eEch4whQ

    This guy says he solved it using a similar approach while handling his fps view.

    Can anybody help me with this?

    #2
    Like I have posted several times.
    Head Bob needs to die.

    The reason behind the motion you are seeing is the animations.
    Depending on the quality of the movement animations the head Bob will be more or less severe.

    To truly remove the head Bob you need to unparent the camera from the head bone.

    What parenting does (though in faster code then BP) is to match the world space location of the head bone to that of the spring arm.

    What you can do in code, is lessen the amount that the head bobbles around by setting some limits against which to check before allowing for a Lerped transition to occur.

    Why is that? Simple. You can parent to the root, but then if your animations are supposed to offset the camera they will not. So, for a crouching animation for instance, your camera will no longer follow the head.
    You have to correct this by code when the movement exceeds a pre-set threshold. And you need to make sure that your animations maintain this threshold as well.

    Other hacks to consider, if you are in a game where you never see your face, disable it from view (but enable shadows) and it will never clip your camera.

    If you cannot do so (maybe you are making some magic mirror room game?) Then the alternative would be to custom tune each and every single animation with a few curves that are then fed into and manage the camera.

    Animation curves can be very powerful for this purpose, and most importantly, since you can copy and paste them from the animation of the bones, they can be dead accurate. Even more so then parenting/socketing I find.


    The silly way around to skip all the fine tuning, is to simply force the headbone to stay in place (ignore Z, apply x and y). This can have some odd behaviour, But, because the headbone travels along with the rest of the body, it makes it easier to disable/enable this "follow no follow" behaviour based on how much the Z moves around.
    It doesn't fix the x and y, and often looks silly.
    Generally, it works fine in games that dont show the character.
    Crysis comes to mind, as one of the games where this happens constantly when peeking through cover. You may want to google for some images of that to understand the extent to which no one cares about what the mesh is doing when in cover... actually, no. Here you go
    Do notice, there is no head either, and yet you would have never known while playing.

    https://www.eurogamer.net/articles/2...ying-hilarious

    Comment


      #3
      I did consider doing that but then when including things like player self shadows and mirror reflections, messing up the player model would not be a good idea. Any idea how star citizen did this though as someone did manage to pull it off the same way on ue4 but I can't get in touch with the guy.

      Also the only movement I experience in the camera now is z axis and on the y axis. I'm trying to lock the head in place and make the rest of the body compensate using ik to look normal. Standing stance seems to work but I'm still figuring out how to handle this on stance change
      Last edited by vb2509; 11-16-2019, 02:25 PM.

      Comment


        #4
        Judging from the bird example they gave, they are using a full-body IK solution and simply use IK to lock the head in place. My first intuition would be to create an IK target bone where the neck is and animate that very smooth without any headbobbing and then rotate the final head target around that with the rotation input you get from the mouse/controller. Something like this: https://gfycat.com/boringshockedlemur
        I will try to implement this for my own project and will share my findings.
        Randomized tiling function to eliminate repeating patterns in textures.

        Comment


          #5
          Also how do I go about aligning the gun perfectly to the camera like how Wolfenstein does it? I tried camera placement with ik to keep neck in place and place the cam using timeline on stance change. Ik does not seem to be working properly for me.

          Comment


            #6
            I'd just hard copy the rotation from the camera to the head bone, not the other way around. And to avoid slight shakiness from imperfect IK I would probably use the IK target bone for the camera location. Now getting the gun to align perfectly with the camera requires either really good IK or you do roughly adjust the upper body and then just yank the arms into the correct place relative to the camera. (I have no idea what Wolfenstein does since I haven't played any of the Wolfenstein games)
            Randomized tiling function to eliminate repeating patterns in textures.

            Comment


              #7
              Just like in real life, You never put your head on the stock, the rifle come into your view.
              Basically you just set the weapon's front sight as the master IK and you match alignment to the z of the camera exaclty.
              The hands will come up with the IK chain, and you should be good to go.

              Comment


                #8
                Originally posted by MostHost LA View Post
                Just like in real life, You never put your head on the stock, the rifle come into your view.
                Basically you just set the weapon's front sight as the master IK and you match alignment to the z of the camera exaclty.
                The hands will come up with the IK chain, and you should be good to go.
                Could you give me an example of how I could set this up. Ik seems to be messed up when I try doing this

                Comment


                  #9
                  Placing the camera independently to the place where the head should be seems to work after putting an ik on the neck the keep the upper body from moving. I use a timeline to smoothly interpolate the camera Dow or up with stance change. So I guess headbob issue is solved. I'll still keep a cam on the headsocket for cutscenes or montages I guess.

                  I might share my solution someday after the hand placement is solved

                  Comment


                    #10
                    Originally posted by witch-dev View Post
                    I'd just hard copy the rotation from the camera to the head bone, not the other way around. And to avoid slight shakiness from imperfect IK I would probably use the IK target bone for the camera location. Now getting the gun to align perfectly with the camera requires either really good IK or you do roughly adjust the upper body and then just yank the arms into the correct place relative to the camera. (I have no idea what Wolfenstein does since I haven't played any of the Wolfenstein games)
                    well take pubg for example. They did use the animation starter pack to a large extent. How do you think they did it?

                    Comment


                      #11
                      Judging from threads like this: https://forums.pubg.com/topic/292714...n-perspective/
                      Different animations for first person view.
                      Randomized tiling function to eliminate repeating patterns in textures.

                      Comment


                        #12
                        Originally posted by witch-dev View Post
                        Judging from threads like this: https://forums.pubg.com/topic/292714...n-perspective/
                        Different animations for first person view.
                        hmm and how about rainbow six since the thirp person bug confirms it's the same model they are using for both views. I just wanna compare approaches to this

                        Comment


                          #13
                          Some links would be helpful to make clear we are talking about the same thing. But from what I have found that happens after people use their drone, which means they have already left their body. If the bug is showing the first person animations though you can see a ton of head movement going on which is clearly not reproduced by the camera when you actually are in first person, so they aren't copying the head position exactly with their camera.
                          Also in rainbow six, your own character doesn't seem to cast any shadow in first person, which is a strong indicator that the mesh and animations get changed when that bug happens.
                          Randomized tiling function to eliminate repeating patterns in textures.

                          Comment


                            #14
                            Originally posted by witch-dev View Post
                            Some links would be helpful to make clear we are talking about the same thing. But from what I have found that happens after people use their drone, which means they have already left their body. If the bug is showing the first person animations though you can see a ton of head movement going on which is clearly not reproduced by the camera when you actually are in first person, so they aren't copying the head position exactly with their camera.
                            Also in rainbow six, your own character doesn't seem to cast any shadow in first person, which is a strong indicator that the mesh and animations get changed when that bug happens.
                            see this
                            https://youtu.be/1NYtBsIZaXk

                            Comment


                              #15
                              Most of the movement animations available are over exaggerated, based on self conscious actor/models running on treadmills or placing a spring in their step,

                              Soldiers are not celebrating the first day of spring and the joy of life, perky young school girl skipping across the meadow to pick flowers?
                              I think not, grim determination and a heavy heart are the hallmarks of a soldiers gait.

                              Well that's my excuse for mellowing out the head bob inside the animations to remove bobbing at the source, reworking the animations based on steady head position for walk, slight bob for jog and a steady aim animation for toggling breathing while stationary.

                              Just another approach, depending on needs and skill-set might be an idea.
                              In the rainbow clip other players movements did not look very head bob ish.

                              Comment

                              Working...
                              X