Weapon Optic Creation – Arma Reforger

From Bohemia Interactive Community
Jump to navigation Jump to search

Goals

This tutorial will explain how to:

  • Prepare optic mesh for import into the game
  • Setting accessories slots
  • 2D & PIP optic configuration
This tutorial is continuation of Weapon Creation tutorial - some of the things on this page are interlinked with Sample New Weapon.
📥
Sources files for this tutorial can be found on Arma Reforger Samples Github repository

Mesh preparation

General

In principle, mesh preparation is not that different from weapon preparation itself. Again, orientation of the mesh is very important and there are few extra elements needed on the model which are described below.

When it comes to the mesh itself, keep in mind that rear part of the scope will be really close to the players camera when aiming down sights so its worth investing extra polygons in that place. For instance, don't be afraid to use 32 or more sides for cylinders right in front of the player eye. If you are worried about performance impact, you can reduce poly count quite sharply in next LOD, so that detailed mesh will be visible only when player is really close to it.

Colliders

Accessories should have collider with two collision layers - Weapon & FireGeo.

Weapon layer preset is responsible for physical interaction of the accessory, like collisions with other objects, while FireGeo is used for collisions with projectiles and also for detection of inventory actions. In case you don't see your actions in game, double check if item is using correct Layer Preset.

Depending on the complexity of accessory, collision of optic can be done either with single collider convex (UCX or UBX), which is using WeaponFire layer preset or by using two colliders - one simple convex (UCX) collider for Weapon layer preset and second, more complex trimesh (UTM) collider for FireGeo preset. In case of Sample Optic, second method was used.

armareforger-new-weapon-optic-colliders.gif


In both cases, it is recommended to use one of the Weapon_xxx Game Materials on those colliders like:

This will ensure that attachment doesn't stop every bullet on impact.

More information about colliders can be found on FBX Import page

Memory points

Slots

armareforger-new-weapon-optic-snap-weapon.png

Attachments like optics are attached to slots and while technically it is not mandatory, adding snap point is a very handy thing. Procedure for adding that is same as on weapon. Below are few tips regarding

  • Place snap_weapon empty object at location, where you want to snap with the weapon. See Weapon Slots and Bones page for more details.
    • snap_weapon works together with slot_optic point on parent weapon
    • Without snap_weapon point, origin of the model would be used for snapping
  • In case of RIS rail, middle point in Y axis is sort of way to go.
    • Some freedom is allowed though - for instance accessories like Carry Handle Optics, middle location would most likely make it an unusable accessory on most weapons

Points

In order to make configuration of SCR_2DPIPSightsComponent component bit easier, it is recommended to add few points directly in model for setting things like eye position when aiming down sight and front/rear points for camera calculation. Sample Optic has two sights - primary, optical sight with 4x zoom and backup ironsights located on top of it.


Starting with primary sight, perform following actions:

  • Create eye empty object - it should be placed few cm away from the middle of the ocular
    • This point will be used for main optic, when character is aiming down sights (ADS)

armareforger-new-weapon-optic-primary-points.png

  • Create eye_ironsight - place it in line with ironsights located at the top of the optic
    • This point will be used for backup ironsights

armareforger-new-weapon-optic-ironsights-points.png

Keep in mind that rotation of those points matters and will be used by the engine!

Creating Optic Mesh for PIP

armareforger-new-weapon-optic-uvmapping.png

Next step in weapon optic creation is adding additional mesh to the scope on which scope view will be rendered. This can be done in few steps:

  • Create flat mesh for picture in picture (PIP) sight rendering and place it at the ocular
    • Scope view will be rendered on this surface so make sure it is detailed enough
    • UVs of that mesh should cover whole UV island
      • If texture is not render correctly (i.e. rotated by 45 degrees to the left or right) and you are sure that  , make sure that UVs are rotated correctly
  • Create new material called for instance "Optic_pip" and assign it to mesh created in previous step

armareforger-new-weapon-optic-pip-material.png

Additionally, it is a good idea to have additional layer of mesh in front of the PIP selection which has glass like material with some tint and subtle reflections. To do so, follow below steps:

  • Create 2nd, more round and convex, mesh for glass optic. Place it in front of PIP mesh. Additionally, you can also use same mesh on the opposite side of the scope
    • This is mesh would be only used as eye candy, showing i.e. glass reflection, so don't be afraid to put some extra polygons there
  • Create new material called for instance "Optic_lensglass" and assign it to mesh created in previous step

armareforger-new-weapon-optic-lens-glass.png

Model Import & Registration

Sample Optic materials

Once that is done, it is possible to import the model into Workbench. Process itself is same as for the weapon, so refer to Model Import & Registration segment of Weapon Creation tutorial.

After model is imported, open it in Resource Manager and change default materials which are assigned to Optic_pip & Optic_lensglass material slots. A nice starting point could be simply assigning to those fields following materials:

Of course, if you wish to make some tweaks to those materials then it is also possible to duplicate above mentioned materials, do tweaks to them and then assign it to the optic you are working on.


Since this model is using empty objects as snap/slot points, it is necessary to check Export hierarchy in Import Settings section. Of course, once this step is performed, don't forget to click on Reimport resource button!

armareforger-new-weapon-optic-hierarchy.png

Texture & Material

Reticle

Reticle channels in Photoshop

Next step in optic creation will be making of a reticle texture. Create a new texture in graphic editor of your choice and start painting the texture. In case of Sample Optic, TGA texture with Alpha channel was used. In Alpha channel section, which is supposed to be transparent was painted in black.

Vanilla reticles also tends to use PNGs with transparency in the background although creation of such might be troublesome if software that you are using doesn't allow preservation of RGB values when alpha is set to 0.


Below are few tips to keep in mind while making such texture:

  • 1024x1024px size is recommended for smaller, less detailed reticles
    • If its needed, higher resolution could be used but caution is suggested
  • Reticle should fill most of the canvas
  • Color of the reticle doesn't mater - it is later replaced by the engine - therefor using just white for the reticle is recommended
    • To fix reticle texture blurriness or artifacts you can either:
      • Change manually in reticle EDDS Import Settings two parameters - Conversion Quality to 100 and uncheck Generate Mips checkbox. In this scenario, you need to use _UI suffix for your textures!
      • Replace the Configuration section of .meta file (open it in text editor) as following, then reimport the texture. You might use _Reticle suffix for your texture
Replace TGAResourceClass with PNGResourceClass if you are using PNG textures!
Configurations {
 TGAResourceClass PC : "{33F97FFE35E57E1D}Configs/System/ResourceTypes/PC/TextureReticle.conf" {
 }
 TGAResourceClass XBOX_ONE : "{0B42FA7CFD77120F}Configs/System/ResourceTypes/XBOX_ONE/TextureReticle.conf" {
 }
 TGAResourceClass PS4 : "{C1FA7DC8973FA4A1}Configs/System/ResourceTypes/PS4/TextureReticle.conf" {
 }
 TGAResourceClass HEADLESS : "{9664EF94CE7C4525}Configs/System/ResourceTypes/HEADLESS/TextureReticle.conf" {
 }
 TGAResourceClass XBOX_SERIES : "{A4AA0C6FDF186747}Configs/System/ResourceTypes/XBOX_SERIES/TextureReticle.conf" {
 }
}

Material

With reticle textures ready, it is possible to prepare material for picture in picture sight:

  • Duplicate one of the existing optic HDR materials (HDREffect class) like - Optic_ARTII_HDR.emat . In this case this file was called Optic_SampleOptic_HDR.emat
  • Open that new material and in Details tab locate Reticle Map property.
    • Assign previously created reticle texture to Reticle Map property and save the file

Prefab

Creation

Inventory configuration

Setting display name, weight, size, preview model + Character Modifier Attributes (ADS speed)

InventoryItemComponent

  • Item Display Name
    • Adjust Name & Description - both will be shown in in-game inventory system
      • Strings need to be localized - otherwise attachment strings are not going to work
  • Item Phys Attributes
    • Adjust Weight - weight in game affects for instance how fast character is tired
    • Change Size Setup Strategy to Manual and adjust Item Dimensions & Item Volume - those two parameters are responsible

Attachments configuration

In Custom Attributes section of InventoryItemComponent attributes you can find WeaponAttachmentAttributes class, which has one important parameter - Attachment Type. This parameter, similar to Magazine Well class, controls what type of attachment it is and where it can be attached.

Since Sample Optic is using a RIS rail, one of the RIS attachment classes should be selected.

Optics configuration

Configuration of the optic is stored in SCR_2DPIPSightsComponent component. As name suggest, this component enables both 2D & PIP mode on the scope depending on the preferences selected in Gameplay section of the in-game settings.

Diagnostic tools

  • Hold LWin + LAlt to open Diag Menu
  • Use arrow keys and mouse to navigate and enable mouse cursor to edit properties
  • Use the GameCode > Weapons > Show optics diag debug to experiment and verify reticle or scope settings
  • The debug rendering circle in PIP can be inaccurate. It has precise on screen angular size in 2D optics mode

Additionally, it is recommended to enable following debug options in GameCode > Weapons category:

  • Disable aim modifiers
  • Disable character aim modifiers
  • Disable weapon offset

Setting base sight properties

  • Set Sight FOV Info
    • SCR_SightsZoomFOVInfo for fixed power scopes
    • SCR_VariableSightsFOVInfo for variable power scopes
    • Set Base Zoom to match the lowest magnification
  • Set Sights Rear Position in the middle of Ocular - rear glass
  • Set Sights Front Position straight in front of rear sight point (X and Y should match) on the plane of the Objective - front glass
  • Set Sights Position (main camera eye) behind the rear sight
    • Sights Rear Position, Sights Front Position and Sights Position should all be aligned on single axis for simplicity sake
    • Use Camera Offset property to move camera to middle of the objective if the objective is in not aligned with Sights
    • Use Camera Angles property to rotate the scope camera if necessary

Setting 2D scope

Scope

  • Set Objective FOV in degrees
  • Set Magnification to match Sight FOV Info Base Zoom
  • Tweak Ocular Scale so that the optic does not leak out of Full HD 16:9 screen (recommended, optional) - expected values are between 1 and 0.5
  • Tweak Vignette scale similarly, style it as you like

Reticle

PSO horizontal markings
  • Set Reticle Texture and Reticle Glow Texture
  • Set Reticle Base Zoom
    • For Front focal plane reticle, this should be set to zero
    • For Rear focal plane reticle, this should match Magnification or any zoom level that should be used as reference for Reticle Angular Size
  • Set Reticle Angular Size in degrees
    • Reference marks angular size/distance
    • The further away these marks are from each other, the better
    • Example: for PSO-1 should measure horizontal 10 USSR mils marks, that should be 20 USSR mils apart 20 * 6000 mils / 360 degrees = 1.2 degrees
  • Set Reticle Portion in percent
    • part of reticle that should match the specified Reticle Angular Size, allowing quick adaptation and verification of different reticle textures
    • Example: for PSO-1 the horizontal 10 mils marks are 304 pixels apart on 1024x1024 texture 304/1024 = 0.29687

Setting PIP scope

Scope

  • Make sure your 2D scope is set up properly, otherwise you may have to set it up again
  • Tweak sight point distance from rear sight, until Apparent FOV matches the FOV of 2D sight closely
  • Tweak scope radius until the PIP sight image is as close match with 2D as possible
  • Sight Position attribute Angles can be used to rotate the main camera if necessary

Reticle

  • PIP sight needs HDR material with same texture as the 2D optic
  • To avoid misalignment, the reticle movement option in HDR material should be disabled
  • Tweak vignette settings in HDR material so that it looks similarly to 2D sight