First Person Viewmodel Correction (Z clipping and separate FOV)

Sometimes the weapon looks weird with high camera FOV and it can pass through the wall. I was seeking for a solution and finally made one.
Thanks to this forum…fov-for-weapon for providing a code from unreal tournament weapon material functions and Unreal Tournament development team for making these files in the first place.

You need 2 material functions one for FOV correction (I named it FovCorrection)
And the final material function itself (ViewmodelCorrection)

Here is how it works:
In your material, plug desired weapon FOV in FOV input of final material function (I found that the values from 60 to 120 work fine with default fps project). Z_Scale is for removing the clipping issue, it puts every vertex closer to camera while keeping visual scale the same (0 is in camera, 1 is no change, larger FOV means smaller Z scale value).
[HR][/HR]My material setup:
Camera FOV 135, weapon FOV 105, Z Scale 0.4
Camera FOV 60, weapon FOV 135, Z Scale 0.1
[SPOILER]60-135.png[/SPOILER] [HR][/HR]- Lighting on the arms is weird because i used the same material for a gun and for the arms, so it is a wrong normal map

  • Don’t forget to set near clip plane in project settings to something small like 0.5 (0 will bug out the rendering engine)
  • Hope this helps