Weapon Optic Creation – Arma Reforger

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with " = Mesh = == General == * Make scope more detailed from the rear - players will look at it from up-close ** Don't be afraid to use 32 or more sides for cylinders right in fr...")
 
No edit summary
Line 15: Line 15:


In both cases, it is recommended to use one of the '''Weapon_xxx Game Materials''' like:
In both cases, it is recommended to use one of the '''Weapon_xxx Game Materials''' like:
*{{Link|enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/WeaponParts/weapon_metal.gamemat|weapon_metal.gamemat}}
*{{Link|enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/WeaponParts/weapon_plastic.gamemat|weapon_plastic.gamemat}}
*{{Link|enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/WeaponParts/weapon_wood.gamemat|weapon_wood.gamemat}}


* <nowiki>https://enfusionengine.com/api/redirect?to=enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/WeaponParts/weapon_metal.gamemat</nowiki>
==Memory points==
* <nowiki>https://enfusionengine.com/api/redirect?to=enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/WeaponParts/weapon_plastic.gamemat</nowiki>
* <nowiki>https://enfusionengine.com/api/redirect?to=enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/WeaponParts/weapon_wood.gamemat</nowiki>


== Memory points ==
===Slots===
 
=== Slots ===
Adding slots for attaching it with other attachments
Adding slots for attaching it with other attachments


* Place '''snap_weapon''' empty object at location, where you want to snap with the weapon. See <nowiki>https://community.bistudio.com/wiki/Arma_Reforger:Weapon_Slots_And_Bones</nowiki> page for more details
*Place '''snap_weapon''' empty object at location, where you want to snap with the weapon. See <nowiki>https://community.bistudio.com/wiki/Arma_Reforger:Weapon_Slots_And_Bones</nowiki> page for more details
** '''snap_weapon''' works together with '''slot_optic''' point on parent weapon
**'''snap_weapon''' works together with '''slot_optic''' point on parent weapon
** Without '''snap_weapon''' point, origin of the model would be used for snapping
**Without '''snap_weapon''' point, origin of the model would be used for snapping
* In case of RIS rail, middle point is sort of way to go. Some freedom is allowed
*In case of RIS rail, middle point is sort of way to go. Some freedom is allowed


=== Points ===
===Points===
Adding points for scope configuration like "eye" point
Adding points for scope configuration like "eye" point


* Create '''eye''' empty object - it should be placed few cm away from the middle of the '''ocular'''
*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)
**This point will be used for main optic, when character is aiming down sights (ADS)
* Create '''eye_ironsight''' - place it in line with ironsights located at the top of the optic
*Create '''eye_ironsight''' - place it in line with ironsights located at the top of the optic
** This point will be used for backup ironsights
** This point will be used for backup ironsights
* Keep in mind that rotation of those points matters and will be used by the engine!
*Keep in mind that rotation of those points matters and will be used by the engine!


== Creating Optic Mesh for PIP ==
==Creating Optic Mesh for PIP==
Creating selection and material for PIP scope
Creating selection and material for PIP scope


* Create flat mesh for '''picture in picture (PIP)''' sight rendering and place it at the '''ocular'''
*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
**Scope view will be rendered on this surface so make sure
** UVs of that mesh should cover whole UV island
**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
***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 2nd, more round and convex, mesh for glass optic. Place it in front of PIP mesh
*Create 2nd, more round and convex, mesh for glass optic. Place it in front of PIP mesh
** This is mesh would be only used as eye candy, showing i.e. glass reflection
** This is mesh would be only used as eye candy, showing i.e. glass reflection


= Texture & Material =
=Texture & Material =


== Reticle ==
==Reticle ==


* PNG texture with transparent background
*1024x1024px size is recommended for smaller, less detailed reticles
* Reticle texture should use _Reticle suffix
**If its needed, higher resolution could be used but caution is suggested
* 1024x1024px size is recommended for smaller, less detailed reticles
*Reticle should fill most of the canvas
** If its needed, higher resolution could be used but caution is suggested
*Color of the reticle doesn't mater - it is later replaced by the engine - therefor using just white for the reticle is recommended
* Reticle should fill most of the canvas
**Texture has to use appropriate import configs to prevent blurring.
* 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, replace the Configuration section of .meta file as following, then reimport the texture
** Texture has to use appropriate import configs to prevent blurring.
** To fix reticle texture blurriness or artifacts, replace the Configuration section of .meta file as following, then reimport the texture
<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp">
Configurations {
Configurations {
Line 76: Line 73:
</syntaxhighlight>
</syntaxhighlight>


== Material ==
==Material==


* Duplicate one of the existing optic HDR materials (HDREffect class) like <nowiki>https://enfusionengine.com/api/redirect?to=enfusion://ResourceManager/~ArmaReforger:Assets/Weapons/Attachments/Optics/ARTII/Data/Optic_ARTII_HDR.emat</nowiki>
*Duplicate one of the existing optic HDR materials (HDREffect class) like {{Link|enfusion://ResourceManager/~ArmaReforger:Assets/Weapons/Attachments/Optics/ARTII/Data/Optic_ARTII_HDR.emat|Optic_ARTII_HDR.emat}}
* Assign
*Assign


= Prefab =
=Prefab=


== Creation ==
==Creation==


* Create new prefab which inherits from WeaponOptic_Base.et  <nowiki>https://enfusionengine.com/api/redirect?to=enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Attachments/Optics/WeaponOptic_Base.et</nowiki>
*Create new prefab which inherits from WeaponOptic_Base.et {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Attachments/Optics/WeaponOptic_Base.et|WeaponOptic_Base.et}} 
** Alternatively you can try to duplicate one of the existing scopes
**Alternatively you can try to duplicate one of the existing scopes
* Check '''Model Geometry''' option in '''RigidBody''' component
*Check '''Model Geometry''' option in '''RigidBody''' component
* Assign scope mesh in '''Object''' property of '''MeshObject''' component
* Assign scope mesh in '''Object''' property of '''MeshObject''' component


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


'''InventoryItemComponent'''
'''InventoryItemComponent'''


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


=== Attachments configuration ===
===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.
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.
Since Sample Optic is using a RIS rail, one of the RIS attachment classes should be selected.


== Optics configuration ==
==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.
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 ===
===Diagnostic tools===


* Hold LWin + LAlt to open Diag Menu
*Hold LWin + LAlt to open [[Arma Reforger:Diag Menu|Diag Menu]]
* Use arrow keys and mouse to navigate and enable mouse cursor to edit properties
*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
*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
*The debug rendering circle in PIP can be inaccurate. It has precise on screen angular size in 2D optics mode


OpticDebugTool.mp4  
OpticDebugTool.mp4  


=== Setting base sight properties ===
===Setting base sight properties===
Sight position & FOV info (zoom steps/no zoom), point, etc - explaining what is present/relevant in BaseSights
*Set '''Sight FOV Info'''
 
**'''SCR_SightsZoomFOVInfo''' for fixed power scopes
* Set '''Sight FOV Info'''
**'''SCR_VariableSightsFOVInfo''' for variable power scopes
** '''SCR_SightsZoomFOVInfo''' for fixed power scopes
**Set '''Base Zoom''' to match the lowest magnification
** '''SCR_VariableSightsFOVInfo''' for variable power scopes
*Set '''Sights Rear Position''' in the middle of '''Ocular''' - rear glass
** Set '''Base Zoom''' to match the lowest magnification
*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 Rear Position''' in the middle of '''Ocular''' - rear glass
*Set '''Sights Position''' (main camera eye) behind the rear sight
* Set '''Sights Front Position''' straight in front of rear sight point (X and Y should match) on the plane of the '''Objective''' - front glass
**Sights Rear Position, Sights Front Position and Sights Position should all be aligned on single axis for simplicity sake
* Set '''Sights Position''' (main camera eye) behind the rear sight
**Use '''Camera Offset''' property to move camera to middle of the objective if the objective is in not aligned with Sights
** Sights Rear Position, Sights Front Position and Sights Position should all be aligned on single axis for simplicity sake
**Use '''Camera Angles''' property to rotate the scope camera if necessary
** 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 ===
===Setting 2D scope===


==== '''Scope''' ====
===='''Scope'''====


* Set '''Objective FOV''' in degrees
*Set '''Objective FOV''' in degrees
* Set '''Magnification''' to match '''Sight FOV Info Base Zoom'''
*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 '''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
*Tweak '''Vignette''' scale similarly, style it as you like


==== '''Reticle''' ====
===='''Reticle'''====


* Set '''Reticle Texture''' and '''Reticle Glow Texture'''
*Set '''Reticle Texture''' and '''Reticle Glow Texture'''


* Set '''Reticle Base Zoom'''
*Set '''Reticle Base Zoom'''
** For '''Front focal plane''' reticle, this should be set to zero
**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'''
**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
*Set '''Reticle Angular Size''' in degrees
** Reference marks angular size/distance
**Reference marks angular size/distance
** The further away these marks are from each other, the better
**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
**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
*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
**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
**Example: for PSO-1 the horizontal 10 mils marks are 304 pixels apart on 1024x1024 texture 304/1024 = 0.29687


=== Setting PIP scope ===
===Setting PIP scope ===
'''Scope'''
'''Scope'''


* Make sure your 2D scope is set up properly, otherwise you may have to set it up again
*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 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
*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
*'''Sight Position''' attribute '''Angles''' can be used to rotate the main camera if necessary


==== '''Reticle''' ====
===='''Reticle'''====


* PIP sight needs HDR material with same texture as the 2D optic
*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
*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
*Tweak vignette settings in HDR material so that it looks similarly to 2D sight

Revision as of 14:59, 29 June 2023

Mesh

General

  • Make scope more detailed from the rear - players will look at it from up-close
    • Don't be afraid to use 32 or more sides for cylinders right in front of the player eye

Colliders

Accessory should collider with two layers - Weapon & FireGeo.

Weapon layer preset is responsible for physicial 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 both cases, it is recommended to use one of the Weapon_xxx Game Materials like:

Memory points

Slots

Adding slots for attaching it with other attachments

  • Place snap_weapon empty object at location, where you want to snap with the weapon. See https://community.bistudio.com/wiki/Arma_Reforger: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 is sort of way to go. Some freedom is allowed

Points

Adding points for scope configuration like "eye" point

  • 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)
  • Create eye_ironsight - place it in line with ironsights located at the top of the optic
    • This point will be used for backup ironsights
  • Keep in mind that rotation of those points matters and will be used by the engine!

Creating Optic Mesh for PIP

Creating selection and material for PIP scope

  • 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
    • 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 2nd, more round and convex, mesh for glass optic. Place it in front of PIP mesh
    • This is mesh would be only used as eye candy, showing i.e. glass reflection

Texture & Material

Reticle

  • 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
    • Texture has to use appropriate import configs to prevent blurring.
    • To fix reticle texture blurriness or artifacts, replace the Configuration section of .meta file as following, then reimport the texture
Configurations {
 PNGResourceClass PC : "{33F97FFE35E57E1D}Configs/System/ResourceTypes/PC/TextureReticle.conf" {
 }
 PNGResourceClass XBOX_ONE : "{0B42FA7CFD77120F}Configs/System/ResourceTypes/XBOX_ONE/TextureReticle.conf" {
 }
 PNGResourceClass PS4 : "{C1FA7DC8973FA4A1}Configs/System/ResourceTypes/PS4/TextureReticle.conf" {
 }
 PNGResourceClass HEADLESS : "{9664EF94CE7C4525}Configs/System/ResourceTypes/HEADLESS/TextureReticle.conf" {
 }
 PNGResourceClass XBOX_SERIES : "{A4AA0C6FDF186747}Configs/System/ResourceTypes/XBOX_SERIES/TextureReticle.conf" {
 }
}

Material

  • Duplicate one of the existing optic HDR materials (HDREffect class) like Optic_ARTII_HDR.emat
  • Assign

Prefab

Creation

  • Create new prefab which inherits from WeaponOptic_Base.et WeaponOptic_Base.et 
    • Alternatively you can try to duplicate one of the existing scopes
  • Check Model Geometry option in RigidBody component
  • Assign scope mesh in Object property of MeshObject component

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

OpticDebugTool.mp4

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

  • 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