Introduction
- Category: Materials
- Update: 1.2 (10-10-2019)
- Unreal Engine: 4.18 - 4.23
- Platforms: PC, Console, HTML
Weapon FOV is an advanced and very useful material node that solves many issues related to the first-person character. This package will take your FPP game to industry standards like Shadow Warrior, HL2, Battlefield, Dying Light, and much more without any noticeable additional cost.
It is just one node in material calculated per vertex, so implementation is very fast. You don’t need to use an additional render target or separate pass to fix problems with a weapon.
Unreal Marketplace :
https://www.unrealengine.com/marketplace/weapon-fov
Features:
- Separate weapon FOV – You can set a custom field of view per weapon. This fixes the weapon stretching when changing the game FOV and is helpful for calibrating weapon size on the screen independently of the camera.
- Weapon depth priority – Weapon scale in camera Z-axis (depth). This feature fixes the intersection of weapons with walls. The player capsule radius can be smaller, and the weapons can be rendered over the environment.
- Near-plane clipping – Modify the near-clip plane to see more/less mesh in the camera.
- Weapon transform – Applies a custom position of the weapon in camera space.
- Effect blending – Implements the transition between FOV space and world space. It is useful for projectiles and the character’s body that is standing on the ground.
- Material node – Can be customized per weapon or controlled in global material parameter collection.
- Clean implementation – Calculated per-vertex, very fast no need to use the separate pass to fix problems with a weapon.
- Zooming effect – Change the camera FOV when the weapon stays the same. That makes scope zoom effect really easy to implement.
- NEW! Realistic sniper scope – Multiple parameters: lens refraction, aberration, overlays, etc.
Get Started
- Open material that should be rendered in special weapon FOV mode.
- Go to detail panel on the left-hand side ( Default Viewport on 4.23 )
Check ” Materials > Use Material attributes [ Bool Value ] “ to true. - Create a new node ” MakeMaterialAttributes “ and plug everything the same as how your materials work.
- Create a new materials function node ” ML_WeaponFOV “ plug into ” Material Attributes “.
- Or in case you have “ Use Material attributes = False ”in the material then put” MF_WeaponFOV “ material node before the final node in the chain.
- Here is an example of materials.
Parameters
All global parameters can be edited by ( MP_WeaponFOV [ Material Parameter Collection ] ) inside of the Weapon FOV folder.
MP_WeaponFOV |
|
Weapon FOV | Custom field of view per weapon. This fixes the weapon stretching when changing the game FOV. It helps implement the zoom effect and calibrate weapon size on the screen independently of the camera. |
Depth Scale | Weapon scale in camera Z-axis (depth). This feature fixes the intersection of weapons with walls. The player capsule radius can be smaller, and the weapons can be rendered over the environment. |
ClipDistance | Modify near clip plane to see more/less mesh in the camera. |
Blend Effect | Bending between enabled(1.0) and disabled(0.0) effect. |
Weapon Offset | Transformation of the weapon into the camera space. |
Weapon FOV
A custom field of view for the mesh applied with materials fixes the weapon stretching when the field of view of the game camera has been changed to other values. This is useful for implementing the zoom effect and calibrating weapon size on the screen independently of the camera.
Clip Distance
Modify near clip plane to see more/less of mesh in the camera, This function is working same as (Near clip plane) features in Unreal Engine 4.
Depth Scale
Weapon scale in camera Z-axis (depth). This feature prevents weapons from intersecting with walls. The Player capsule radius can be small, and the weapons will still be rendered over the scene’s geometry.
Blend Effect
It implements a transition between FOV space and world space based on the distance from the camera. This is useful for projectiles and character bodies standing on the ground.
Wide Screen
By default, the engine uses Horizontal FOV ( adjusting FOV when the screen stretches on the X-axis). To enable widescreen support, you need to change how FOV is calculated in the player camera:
Camera.AspectRatioAxisContraint = Maintain-XAxisFOV
The WeaponFOV System needs to know how to interpret the constant FOV in the project.
MP_WeaponFOV.ConstantRatio = 0 This option forces the system to keep the mesh size the same when the screen is wide.
Scope Material
The WeaponFOV package in version 1.2 introduces a new feature that helps to implement sniper scope in your games.
Basically the scope implementation is base on rendering the scene to texture form second zoom camera installed inside the scope so it can be little heavy and should be used wisely
New advanced material M_ScopeLens can be found in the Utils folder.
For example, the material of M_ScopeLens can be found in the Demo folder WeaponFov/Demo/Weapon/MI_ScopeLens. Multiple parterres can be modified to achieve a very realistic effect of scope all visual effects are divided into three categories Lens Layer, Overlay Layer, Circle Mask:
Circle Layer
The black circle represents the mask of effect.
Circle |
|
Circle Radius | The radios of the circle mask. |
Circle Width | Width of circle mask edge. |
Circle Color | Color outside of the circle mask. |
Use Circle Mask | Whether the circle mask should be used. |
Lens Layer
Distortion is used on texture rendered from the additional camera.
Lens |
|
Lens | Aberration of R/G/B channel and exponential power of effect in encoded in the Alpha channel. (UseLensAberration=true) |
Lens Color | A color multiplier of the lens texture. |
Lens Map | Render the target of the scene. |
Lens Refraction | Lens refraction effect scale (fisheye). (UseLensRefraction = true) |
Specular Offset | The base secular of the lens (lens reflection) |
Specular Scale | The secular scale of the lens out of the screen center. (lens reflection) |
Overlay Layer
The texture layer renders the telescopic sight.
Overlay |
|
Overlay Alpha Source | The source channel of overlay alpha. |
Overlay Color | The color multiplier of the overlay mask. |
Overlay Depth Offset | Depth offset of the overlay texture. |
Overlay position Scale UV | RG-Position, BA-Scale of overlay texture. |
Overlay Texture | The texture is used as an overlay map. |
Use Overlay Texture | Whether to use the overlay map. |
Advanced Mesh UV
Mesh UV is a group of advanced parameters that can be used to adjust the UV mapping of the scope projection on the screen.
Circle |
|
Depth Offset | Offset scale when the circle is not centered on the screen. Use 0 for no offset. |
Depth Scale | Scale the circle when the circle is not centered on the screen. Use 0 for no scale. |
Pivot Direction | Pivot the direction of the scope relative to the weapon. It helps to calculate the projection of the camera texture on the screen. |
Pivot Pivot Offset | Pivot the location of the scope relative to the weapon. It helps to calculate the projection of the camera texture on the screen. |
Use Component Space Pivot |
Should the circle mask be calculated in the pivot space? |
Questions & Answers
Unreal Engine 5 camera FOV is not consistent with blueprint function
Unreal 5 introduced a dynamic aspect ratio which is not supported by this product yet. You have to switch those two in the main player camera to make everything work correctly:
- Constrain Aspect Ratio = true
- AspectRatio Axis Constraint = X-Axis-FOV
The weapon mesh is disappearing (flickering). Why?
It's a known issue of the engine. Sometimes occlusion culling marks meshes as invisible so they are excluded from the rendering pipeline. It can be fixed by increasing bounds size in the mesh component (Bounds Scale) or mesh asset (Bounds Extension).
Hi, is this for sale/download? 🙂 The link doesn’t work…
The link is working now 🙂
I have bullet trails and particles that come out of my guns that I want to have depth and physics interactions with the world, so they can’t be in the modified first-person FOV . Is there a way to convert from the modified FOV coordinates into world-space coordinates and vice-versa? I need them to look like they are coming out of the guns barrel. Thanks.
There is no option for this yet. I’m planning to add a blueprint function for conversion in the next version of the pack.