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 https://forums.unrealengine.com/deve…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:
[SPOILER]
Camera FOV 135, weapon FOV 105, Z Scale 0.4
[SPOILER]
https://forums.unrealengine.com/core/image/gif;base64
[/SPOILER]
Camera FOV 60, weapon FOV 135, Z Scale 0.1
[SPOILER][/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