First person view model

I am currently developing a First Person Shooter game, and I am looking to implement a first-person weapon in the game.
The following are the requirements for the weapon’s rendering:

  • It should always be visible and not obscured by other world models.
  • It should not be clipped by the near plane of the view frustum.
  • SSAO should not be applied to it.

Can you provide guidance on how to render a first-person weapon that meets these requirements?

1 Like

That was a challenge! But I figured out the good way to implement it in a game via a custom rendering for a weapon and compositing it over the main game viewport. This method allows to easily select player weapon objects to be rendered (via WeaponLayer mask) and additional objects drawing (eg. sun light via AdditionalLayers mask). You can also select rendering features to use via RenderFlags property (eg. enable SSAO or disable SSR for a gun rendering). Additionally, you can use a custom Projection Matrix for a gun by adjusting FOV/NearPlane/FarPlane to make the gun appear more fixed (eg. don’t depend on screen resolution or aspect ratio).

It requires master branch build of the upcoming Flax 1.5 update (ETA 1-2 weeks max).

Full tutorial: FlaxDocs/render-fps-weapon.md at 1.5 · FlaxEngine/FlaxDocs · GitHub

weapon-fps

2 Likes

Thank you for your detailed and kind tutorial. That’s exactly what I wanted.

1 Like