# Welcome

This page is an overview of the FORGE3D documentation and related resources.

## **Getting started**

The resources in the documentation center aimed to help you better understand our products and accomplish your creative goals with FORGE3D assets.

**Asset Manuals**

* [**Sci-Fi Effects**](/sci-fi-effects)
* [**Force Field**](/force-field)
* [**Wasp Interdictor**](/wasp-interdictor)
* [**Damage FX**](/damage-fx)
* [**Planets**](/planets)

## **Have a question or need help?**

Join [FORGE3D Discord server](https://discord.com/invite/EfvSqJaSgh) to be the first in the line to get new updates and instant support. Anything important, including release notes or deprecation notices, will be posted there first.

If you have an urgent problem that is not documented here, please reach out directly via the [Contact Form](https://www.forge3d.com/contact/).&#x20;

## Unity Forum Threads&#x20;

*Update pending...*

* 160 Fantasy Icons <https://tinyurl.com/160-Fantasy-Icons>&#x20;
* 2D Sci-Fi Platformer <https://tinyurl.com/2D-Sci-Fi-Platformer>&#x20;
* Battleships <https://tinyurl.com/F3DBattleships>&#x20;
* Camera Tool <https://tinyurl.com/F3DCameraTool>&#x20;
* Cyber Drone <https://tinyurl.com/Cyber-Drone>&#x20;
* DSS Harbinger <https://tinyurl.com/DSS-Harbinger>&#x20;
* Damage FX <https://tinyurl.com/Damage-FX>&#x20;
* Force Field <https://tinyurl.com/F3DForceField>&#x20;
* Generic Passenger Cars <https://tinyurl.com/Generic-Passenger-Cars>&#x20;
* Planets <https://tinyurl.com/F3DPlanets>&#x20;
* Sci-Fi Effects <https://tinyurl.com/Sci-Fi-Effects>&#x20;
* Sci-Fi Sounds <https://tinyurl.com/F3DSciFiSounds>&#x20;
* Wasp Interdictor <https://tinyurl.com/Wasp-Interdictor>

## Other resources

* Unity Asset Store <https://tinyurl.com/5wmfxa9x>&#x20;
* Web <https://www.forge3d.com/>&#x20;
* Facebook <https://www.facebook.com/forge3d>&#x20;
* Soundcloud <https://soundcloud.com/forge3d>&#x20;
* Youtube <https://www.youtube.com/c/Forge3d>&#x20;
* Twitter <https://twitter.com/forge_3d>

## Something Missing?

If something is missing in the documentation or if you found some part confusing, please [file an issue](https://www.forge3d.com/contact/) with your suggestions for improvements.&#x20;


# FAQ

The following are answers to some of the most common questions or problems users come across.

* **What Unity versions are supported in general?** \
  Most of the assets are tested to work with Unity 2017 and higher.<br>
* **Can I access a fix or updated build before it's available in the Asset Store?** \
  Join [**FORGE3D Discord server**](https://discord.com/invite/EfvSqJaSgh) to be the first in the line to get new updates and instant support.<br>
* **Is there a mobile support?**\
  Yes. The majority of the assets work on the mid to high range performance mobile platforms including the Sci-Fi Effects, Force Field and Planets.<br>
* **Do FORGE3D assets support Lightweight, URP and HDRP rendering?** \
  I look into adding more rendering pipelines to extend the list:\
  \* Sci-Fi Effects - LWRP for Unity 2018, URP for Unity 2019+, Standard Renderer for Unity 2017+ \
  \* Planets - Standard 2017+, URP 2022.3+<br>
* **After importing your pack to Unity I get a bunch of errors and the materials appear pink**.\
  The materials are pink because you're missing (or have incorrect) Rendering Pipeline package dependency in your project. Make sure to add and configure the appropriate rendering pipeline required by the pack: \
  \
  \* Assets built for Standard pipeline work out of the box.\
  \* LWRP setup: <https://docs.unity3d.com/Packages/com.unity.render-pipelines.lightweight@5.16/manual/installing-lwrp-into-an-existing-project.html> \
  \* URP setup: <https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@7.1/manual/InstallURPIntoAProject.html>

  \* HDRP setup: <https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@13.1/manual/Getting-started-with-HDRP.html><br>
* **After importing your pack to Unity the materials look incorrectly/too intense.**\
  All FORGE3D assets are built for **Linear** color space. Go to *Edit -> Project Settings -> Player -> Other Settings* and switch the Color Space to **Linear**. \
  Read more: <https://docs.unity3d.com/Manual/LinearRendering-LinearOrGammaWorkflow.html><br>
* **The heat/blastwave/refraction shader looks weird in LWRP/URP.**\
  Open Universal Render Pipeline Asset and check the **Opaque Texture** to allow the GrabPass in the Heat shader. You can also check **Depth Texture** to enable soft particles.\
  Read more: <https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@8.1/manual/universalrp-asset.html><br>
* **After importing the Sci-Fi Effect for URP in Unity 2020, 2021 all Universal Renderer Pipeline/Particles/Unlit materials ignore transparency and become filled with fog color.**\
  It's a bug in the URP starting with 10.4.0 affecting some of the default Unity shaders. As a quick workaround you can disable fog in *Window/Rendering/Lighting Settings/Environment -> Fog* or replace the shader in the material with FORGE3D/Additive as a temporary solution.

## Something Missing?

If something is missing in the documentation or if you found some part confusing, please [file an issue](https://www.forge3d.com/contact/) with your suggestions for improvements.&#x20;


# Sci-Fi Effects

Introducing Sci-Fi Effects, an extensive collection of over 90 high-quality weapon and effects prefabs designed to enhance your sci-fi projects.

This guide describes the features of the Sci-Fi Effects. A basic understanding of the Unity engine, as well as C# programming language is assumed. Having basic knowledge of the shader and visual effects design in Unity may be advantageous.&#x20;

Example scenes provided within the package utilize some of the prefabs and demonstrate usage of these effects while all scripts are self explanatory and well documented.&#x20;

**Public demos**

* [**WebGL Demo**](https://s3.amazonaws.com/forge3d/webgl/sci-fi-effects-2.0b/index.html)
* [**Mobile Android APK**](https://s3.amazonaws.com/forge3d/apk/sci-fi-effects-2.0b-android-demo.apk)

**Complete feature list**

* Standard Renderer / URP / HDRP
* [Amplify Shader Editor](http://amplify.pt/unity/amplify-shader-editor/) support
* Modular turret parts counting 22 components
* Turret Editor and Turret Constructor
* Turret Tracking Controller
* Pool Manager
* 12 ready to use weapon effects with sounds
* 8 Explosion effects
* 8 Missile models with additional LOD
* Missile prediction controller
* Trail and exhaust effects
* Warp tunnel
* Warp jump
* Burnout effect
* Holographic effect
* Fading debris field
* Nebula clouds

**Basic requirements**

* Unity **2019.4+**
* Standard Rendering Pipeline / URP / HDRP\*
* Linear Color Space

*\*HDRP requries Input System package installed from the Package Manager.*

**Scriptable Renderer Pipeline**

* Universal Render Pipeline (URP) requires Unity 2019.4+
* High Definition Rendering Pipeline (HDRP) requires Unity 2020.2+

**Compatibility**

* The Sci- Fi Effects is a [**Linear Color Space**](/sci-fi-effects/getting-started#switch-to-linear-color) package
* In LWRP/URP the Heat/Refraction shader requires enabling [**Depth and Opaque textures**](/sci-fi-effects/getting-started#enable-opaque-texture)
* Tested with Unity Unity 2018.&#x34;**,** 2019.4, Unity 2020.3, Unity 2021.1, 2022.3

**Known issues**

* After importing the Sci-Fi Effect for URP in Unity 2020, 2021 all Universal Renderer Pipeline/Particles/Unlit materials ignore transparency and become filled with fog color. It's a bug in the URP starting with 10.4.0 affecting some of the default Unity shaders. As a quick workaround you can disable fog in *Window/Rendering/Lighting Settings/Environment -> Fog* or replace the shader in the material with FORGE3D/Additive as a temporary solution.

If you have any questions, suggestions, comments or feature requests please do not hesitate to reach out via [**Contact Form**](https://www.forge3d.com/contact/) or join my [**Discord Server**](https://discord.com/invite/EfvSqJaSgh) for new updates and instant support.


# Getting started

The installation information contains the installation requirements and instructions for preparing to install, installing, configuring the Sci-Fi Effects for various rendering pipelines.

## Choosing which render pipeline to use

The Sci-Fi Effects supports the following render pipelines:

* The [Built-in Render Pipeline](https://docs.unity3d.com/Manual/built-in-render-pipeline.html) is Unity’s default render pipeline. It is a general-purpose render pipeline that has limited options for customization.
* The [Universal Render Pipeline (URP)](https://docs.unity3d.com/Manual/universal-render-pipeline.html) is a Scriptable Render Pipeline that is quick and easy to customize, and lets you create optimized graphics across a wide range of platforms.
* The [High Definition Render Pipeline (HDRP)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@13.1/manual/Getting-started-with-HDRP.html) offers uncompromising GPU performance. Achieve looks ranging from photorealism to stylized.

{% hint style="info" %}
Projects made using URP are not compatible with the High Definition Render Pipeline (HDRP) LWRP, or the Built-in Render Pipeline. Before you start development, you must decide which render pipeline to use in your Project. For information on choosing a render pipeline, see [the Render Pipelines section of the Unity Manual](https://docs.unity3d.com/2019.3/Documentation/Manual/render-pipelines.html).
{% endhint %}

## Installing from the Asset Store or Unity Package Manager

> **Make sure your project is always backed up before proceeding with any upgrade!**

Use the Unity Package Manager window (in Unity’s 2020+ top menu: **Window** > **Package Manager**) or the Asset Store built in browser to download and extract the Sci-Fi Effects in your project.

The downloaded package provides support for three different rendering pipelines and can be found in the root of the Assets/FORGE3D/Sci-Fi Effects/ folder:

* **Sci-Fi Effects 2.2 Standard Renderer**
* **Sci-Fi Effects 2.2 HDRP**
* **Sci-Fi Effects 2.2 URP**

1. Double click the .unitypackage compatible with your rendering pipeline to extract the content of the package.&#x20;
2. After the process is complete you will find new content under the *Assets/FORGE3D/Sci-Fi Effects/* folder.&#x20;
3. You can safely remove unwanted .unitypackages after the extraction.&#x20;

Please note there is no cross compatibility between Standard Renderer Pipeline and LWRP/URP/HDRP, and you should only extract one package that is compatibe with your selected rendering pipeline.

## Standard Render**ing** Pipeline

The standard renderer version is included as **.unitypackage** under the *Assets/FORGE3D/Sci-Fi Effects/* and cannot replace any existing SRP version of the asset.

{% hint style="info" %}
**Warning: Do not extract the Standard Renderer .unitypackage into existing project if you have SRP version of the Sci-Fi Effects installed. By doing so you will overwrite the previous package content and break the structure of the asset.**&#x20;
{% endhint %}

It is highly advised to backup your project before proceeding with an update to avoid any losses.

Other than the note of warning above, the Standard renderer pipeline requires no extra configuration and should be ready out of the box. Check with the [**Set color space** ](/sci-fi-effects/getting-started#set-color-space)chapter to continue.&#x20;

## Scriptable Rendering Pipeline (HDRP/URP)

> Creating an HDRP Project from the Template:
>
> * [Unity provides an HDRP Template Project](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@13.1/manual/Getting-started-with-HDRP.html) which you can use to quickly get set up with HDRP. To create an HDRP Template Project:
>   1. Open the Unity Hub, go to the **Projects** tab, and click **New**.
>   2. Enter a **Project Name** and, in the **Template** section, click on **High Definition RP**.
>   3. Click **Create**.

> To use the Universal Render Pipeline (URP), you can start a new Project or upgrade an existing Project. You can do this in the following ways:
>
> * [Create a new URP Project from a Template](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@10.4/manual/creating-a-new-project-with-urp.html). If you are starting a new Project from scratch, this is the best choice. When you do this, Unity automatically installs and configures URP for you.
> * [Install URP into an existing Unity Project](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@10.4/manual/InstallURPIntoAProject.html). If you have started a Project using the Built-in Render Pipeline, you can install URP and configure your Project to use URP. When you do this, you must configure the URP yourself. You will need to manually convert or recreate parts of your Project (such as lit shaders or post-processing effects) to be compatible with URP.

**Opaque and Depth textures**

To ensure the proper output of the *heat/blastwave/refraction* shader, open the Universal Render Pipeline Asset and check the **Opaque Texture** to allow the GrabPass in the Heat shader. You can also check **Depth Texture** to enable soft particles.&#x20;

{% hint style="info" %}
&#x20;The [Universal Render Pipeline Asset](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@10.4/manual/universalrp-asset.html) controls the [global rendering and quality settings](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@10.4/manual/universalrp-asset.html) of your Project and creates the rendering pipeline instance.
{% endhint %}

![Universal Rendering Pipeline location](/files/-MZ3PMlov4eDErLjndHR)

Open your Universal Render Pipeline Asset and check the **Opaque Texture** to allow the GrabPass in the Heat shader. You should also check **Depth Texture** to enable soft particles.&#x20;

![](/files/-MBEf-cnUMyqXJvhvS_K)

## Set color space

> Working with linear color means lighting and rendering in a color space where the mapping between numeric color values and absolute color is a straight line. This is the standard in digital cinema and is the best way to produce realistic lighting.

The Sci-Fi Effects is built in Linear color space. To set your project settings to linear color space go to *Edit > Project Settings > Player* and select Linear using drop down list

![Linear color space](/files/-MAkn7pb0QP-KCdQ7QSB)

While a linear workflow ensures more precise rendering, sometimes you may want a gamma workflow (for example, on some platforms the hardware only supports the gamma format).

As a matter of personal preference you might decide to stay in gamma space thus it may require tweaking material color values depending on the situation. Most of the materials are good for using with both color spaces.

{% hint style="info" %}
Read more on [**Linear or Gamma workflow.**](https://docs.unity3d.com/Manual/LinearRendering-LinearOrGammaWorkflow.html)
{% endhint %}

## Effect prefabs

Some of the one shot particle effects are looped over time for demo purposes. It may require to uncheck *the Looping* flag for the particle system and its children before use.

![Particle system 'Looping' flag location](/files/-MAknNLYzwBHQphvmpYX)


# Turrets

*We have made numerous changes to reduce the entire asset difficulty and the amount of time required for turret parts swapping by introducing the modular approach. Much of this system happens automatically. And if you’re going to add new parts why not do it in style?*

Let’s check out one of the most useful tools on the list: the Turret Editor window. It’s in the Forge3D menu located in the upper center of your screen.

![Turret Editor can be accessed from the Window/FORGE3D/Turrets/Turret Editor menu](/files/-MAkuZXd8xjhSsvdhdwr)

It will take you to a new window dedicated to turret assembly and general setup. This is where things start to get interesting.

![](/files/-MAkuq-SAeymsxVVpGdl)

The first and the leftmost column lets you create, manage and keep turret templates, which are shared across the entire project in a ScriptableObject database.

**Name** – This returns a template name you can modify

**Add to a scene** – One can create a new turret instance in the scene from a particular template. It will also position new turret transformation regarding the current selection in the hierarchy.

**Add** – This adds an empty turret template into database

**Duplicate** – One can create a duplicate for any template by selecting an existing template and clicking ‘Duplicate’.

**Remove** – This option deletes a selected template from the database. Please note, removing a template will unlink all the relevant turrets in the scene.

**Templates** – This lists all the Turret templates available in the ScriptableObject database. Selecting any item from the list will update the Turret setup column. You can also delete a template by clicking the ‘X’ button next to an element in the list.

![](/files/-MAkuu73JDbeMcdy4EUL)

Once the new turret template is confirmed, the editor will pick up all the available parts, and the user can then use them to build the turret.

When the user makes a change such as swapping parts or toggling a checkbox, the Turret Constructor component starts the reconstruction process immediatel&#x79;*.*

![](/files/-MAkv2bq4nhVGVHpltFK)

The general technique is the same for any platform with one exception: the mobile platforms should be limited to LOD1 prefabs only, and the LODGroup checkbox should be disabled.

## Dynamic components

From the perspective of the modular asset, the easiest way to take care of dynamic editing of the content was establishing an entirely covered rig with interchangeable parts. With that in mind, we introduced the unified skeleton with a few requirements so that a turret section requires a special socket to plug in.

### **Skeleton**

The frame is based on a parent game object with various parts distributed across the turret rack. Depending on a role in the rig, certain parts require a socket in its prefab.

![](/files/-MAksUYiMwD9TuJzkyqF)

### **Sockets**

The socket defines an attachment point describing how the parts stack together. Further customization is possible by nesting multiple sockets within a prefab.

Depending on the part, a particular type of socket is required to determine the component group it belongs to:

![](/files/-MAksNB1puQ5E7ZA45sl)

Socket search options define a strict pattern in finding a socket object within a prefab. For example, the existing socket name can be described such as:

**\*SOCKET\_#GROUP#\_#NAME#**

* **\*SOCKET\_** Visual identifier of a socket object in the hierarchy
* **#GROUP#** Component group this particular socket belongs to
* **#NAME#** Unique socket name

In addition to that, the socket name can be fully customized

### **Adding new parts**

The last rightmost section of the editor is where you can add new turret parts and modify socket names.

![](/files/-MAksF6jOKsTYmw1GMM8)

That’s all it takes. But before we can make anything move, we need to unlink the new turret from the editor. We’re going to select the turret in the scene and check out the Turret Constructor component.

### **Turret constructor**

One of the greatest things about Turrets is the ability to sculpt any turret design no matter what type you’re trying to build. In the very same way, we also allowed the automatic parts assembly on a turret skeleton using the utility component.

![](/files/-MAks6nXTFm8yEWK2vXZ)

The concept is simple. Turret Constructor ensures a turret is always updated with the latest changes and once the template is confirmed, the parts of the turret skeleton are replaced in the process. The Turret Constructor component is added automatically upon building up a turret.

In addition to that, a particular turret can also be toggled between the templates using a popup.

The key thing to remember is that a Turret Constructor will overwrite any user changes through a skeleton reconstruction during the editor updates.

### **Unlink from turret template**

Now that we’ve looked at how to setup a turret from scratch, we’ll now disconnect our instance from the Turret editor to prevent any further changes to its state.

You can unlink a turret by clicking ‘Unlink from turret template’ button located at the very bottom of a Turret Constructor.

![](/files/-MAkrqdHEHWbkWWBliky)

That’s it! When you’re happy with the changes, you can now create a new prefab and toss it into the action!


# Turret Controller

&#x20;*Perfect for any kind games, the redesigned turret controller is now highly customizable including the arc of fire handles and several aiming algorithms.*

![](/files/-MAkst6AcVwaY3ZVWlvh)

**Before a turret will target anything, you must setup a few things and specify a transform of an object to aim. Let’s have a look at the new options we’ve added to the turret controller with this update:**

**Debug Target** – A transform of an object the turret will aim at

**Mount** – Specifies the transform of the horizontal tracking component along the heading plane

**Swivel** – Specifies the transform of the vertical tracking component along the elevation plane

**Heading tracking speed** – The rate at which the turret can rotate towards target on the horizontal plane

**Elevation tracking speed** – The rate at which the turret can pivot towards target in the vertical plane

**Heading limit** – The arc of fire along the horizontal plane. The editor gizmo marked with red

**Elevation limit** – The arc of fire along the vertical plane.  The editor gizmo marked with blue

**Smooth controlling** – Enables the interpolated tracking algorithm and variable tracking speed. If disabled, the fixed angle rotation is applied

**Debug draw** – Whether to draw a debug line between the swivel center and the far end point

**Animators** – Barrel animator list. A subject to improve over the course of the next update<br>


# Pool Manager

Object Pooling is a great way to optimize your projects.

## What is object pooling?

Object pooling is where you pre-instantiate all the objects you'll need at any specific moment before gameplay — for instance, during a loading screen. Instead of creating new objects and destroying old ones during gameplay, your game reuses objects from a “pool”.

{% hint style="info" %}
Check out [**Introduction to Object Polling**](https://learn.unity.com/tutorial/introduction-to-object-pooling) from Unity Learn
{% endhint %}

## **Pool Manager basics**

The Pool Manager allows you to toggle between a collection of pools and contains a lot of useful innovations such as load balancer, a scriptableObject database and separate settings for each pool.

![](/files/-MAkt8iGT1XklAK4Q_rZ)

It’s highly suggested to switch to the optimized despawn in code:

**Despawn(Transform obj, Transform objTemplate)**  – it will significantly increase the despawn productivity. Moreover, the more prefabs, the greater the gain.

For example, if there were about 300 prefabs, 200 objects each – than a regular despawn would have taken a significant time to skim through all spawned objects. But thanks to the advanced despawn it will only go through the ones of the same type as objTemplate. So, the total gain is getting close to about 300 times faster!

## **Pool** **Manager Overview**

### Database

The changes are serialized within a database under the  *Assets/Resources/F3DPoolManagerCache/* ; hence a separate set of pools per level, as well as a project, is possible by design. Creating a database is easy: type the database name and click “Create Database”

### **Pool**

Next to the Database is a popup list which will toggle between the available pools. Click the “Create Pool” button to add one beforehand. Each pool contains the options affecting the designated prefab set, hence allowing as much of abstraction and control:

**Initial parenting** – Will parent all prefab instances to the Pool game object upon initialization

**Runtime sorting** – Will parent a particular prefab instance to the Pool game object upon despawn to ensure its returned to its original parent to prevent the direct use of  the SetParent which affects performance significantly

**Broadcasting** – Calls the specified method name for every spawn and despawn event on the certain game object or any of its children.

#### **By the default, the Pool will instantiate all prefabs in the first frame, but you can change this behavior referring to the following options:**

**Load control** – The pool will limit the number of objects instantiated according to the maximum amount specified per frame

**Load balancer** – Toggling the option will try to keep the target FPS through limiting the quantity of instantiated objects per frame dynamically

**Debug** – Shows details about the results of running internal commands. It can be especially useful when a verbose console output is required.

**Prefab items** – total quantity of prefabs in the pool

### **Prefab**

**Base** – The minimum number of a particular instances created during the initialization

**Max** – The maximum amount of a particular instances allowed in the scene. The pool will ignore any further spawn requests above this value.


# Examples

There are several example scenes included under **Assets/FORGE3D/Sci**-**Fi Effects/Examples** path:

* **Turrets** Weapon example scene that uses specific copies of prefabs located inside the Example folder
* **Effects** This scene has most of the prefabs came with the initial version of the asset, which are ready to be used in your project. Make sure to disable ‘Looping’ flag on a particle system when appropriate.
* **Burnout** Check the F3DBurnoutExample script located on the turret for a basic usage example.
* **Warp Tunnel** This example demonstrates a warp tunnel over nebula clouds.
* **Holographic** The holographic shader settings are self explanatory. The interlaced effect applied by using screen space coordinates.
* **Nebula** The nebula cloud is faded by using normal to view angle difference, as well as camera distance to board surface.&#x20;
* **Debris Field** The debris field is faded according to camera distance to its surface to achieve smooth transitions.
* **Warp Jump** The warp jump effect uses combination of particles systems and special mesh. Each mesh is scaled at the moment of opening, while its texture is twisted with help of special shader. You can use \_ShipPosition game object to match the ship’s position with the warp spark moving through the tunnel.&#x20;
* **Missiles** The missiles example scene contains sample missile meshes (LOD0) and the example launcher script to demonstrate missile trails and explosions in action. The missile script has three modes: Unguided, Guided and Predictive. This scene has the onscreen UI overlay which explains the controls.

{% hint style="info" %}
Please note that example scripts provided may require additional modifications before they can be used in your project or may not be suited for usage in different environments at all.
{% endhint %}


# Scripts

This section will give you brief details on scripts used by the turret example. It also important to know that most scripts rely on F3DTimer class and require an instance of such to be present in the scene. Please take your time to examine each script more carefully to fully understand what is happening behind the scene.

### CombineChildren&#x20;

Attach this script as a parent to some game object. The script will then combine the meshes at startup. This is useful as a performance optimization since it is faster to render one big mesh than many small meshes.

### F3DAudioController&#x20;

This script is an example of audio management and playback. What it does is playing an audio clip at specific position and modifies various audio settings such as random volume or pitch depending on the method called.&#x20;

### F3DBeam&#x20;

This script is mainly used for updating beam weapons such as beam laser with uv animation for tiled textures, real time raycasting and interacting with rigid bodies by applying AddForceAtPosition. It is also scales the texture along its length depending on the beam length so it’s never gets stretched.&#x20;

### F3DDespawn

&#x20;This script is used to despawn most of the effects after predefined delay by calling corresponding method of the pool manager that is included in this package.&#x20;

### F3DFlameThrower&#x20;

This script is used by flame thrower prefab to manage some utility tasks such as fading in/out the lights and despawning the effect.

### F3DFXController&#x20;

This script defines all the weapon types and the way the are spawned such as managing prefab references, rate of fire, invoking specific audio routines and finally the GUI drawing seen in turret example.&#x20;

### F3DLightning

&#x20;This script is mainly used for updating lightning gun weapon such as updating amount of lightning points and animating the uvs. It is also scales the texture along its length depending on the beam length so it’s never gets stretched.&#x20;

### F3DMissile

&#x20;This script is a missile controler. It has several modes of operation such as: Unguided, Guided and Predictive. An assigned target is required for Guided and Predictive modes to operate. Only the Unguided mode uses ray casting to detect colliders and relies on RaycastAdvance variable. Guided and Predictive modes rely on the DetonationDistance variable. In Predictive mode make sure to set the missile velocity variable large enough to catch up with the moving target to avoid unnatural missile trajectories.&#x20;

### F3DPool&#x20;

This script is a pool manager which is used to pre instantiate all the provided prefabs before the scene starts playing. All weapon scripts use OnSpawned and OnDespawned methods which also makes them compatible with other pool managers found on the asset store.&#x20;

### F3DProjectile&#x20;

This script is a projectile controller. It is using ray casting to detect colliders in advance and in case of an impact calls corresponding method to play sound effects and spawn impact prefabs.&#x20;

### F3DPulsewave&#x20;

This script is used to control pulse wave scaling and fading over time.&#x20;

### F3DRandomize&#x20;

This script is used to randomize transform’s scale and rotation for currently spawned object. Mainly used with muzzle flashes and projectiles.&#x20;

### F3DShotgun&#x20;

This script is used to manage shotgun particle system and react to particle collision events sent by spawning impact prefabs and playing audio clips at impact points.

### F3DTime&#x20;

F3DTime class is a singleton instance used to create and manage the timers. To start using this component simply attach it to any gameobject in scene use one of the following overloads to create a timer: int F3DTime.time.AddTimer(float rate, System.Action callBack); int F3DTime.time.AddTimer(float rate, int ticks, System.Action callBack); AddTimer method has two overloads. The first one can be used to invoke a specified method at specified rate until stopped while the second one requires you to specify number of ticks before it stops. The return value of AddTimer is a unique int handle which should be used with RemoveTimer method to stop it’s execution. Let’s look at the code example below where two timers are created. Note that we store the id for the first timer in myTimerId variable so we could dispose it later.

![](/files/-MAkr-2R6BHJIJXj0XU_)

Once initialized the first timer will begin invoking OnTimer method each 0.1 seconds until stopped by second timer after 5 seconds elapses. Then both timers are disposed since we explicitly tell first timer to be removed and the second self removes since it’s life scope is only a single tick.&#x20;

### F3DTurret

This script is used to control turret’s base and barrel rotation in a specified range as well as checking user input and invoking weapon firing methods on F3DFXController.&#x20;

### F3DWarpJump&#x20;

Controls the warp jump effect by sending the appropriate messages to child objects invoking mesh tunnel scaling. Moves the warp spark through the tunnel and updates *ShipPosition* gameobject. Make sure to disable SendOnSpawned before using with pool manager.&#x20;

### F3DWarpJumpTunnel&#x20;

The script is responsible for scaling the warp jump tunnel mesh, fading colors, and rotation. Should be used with F3DWarpJump script. F3DWarpTunnel Randomly rotates the warp tunnel over time.


# Changelog

Sci-Fi Effects 2.2.3

### \[Version 2.2.3 changes]

* Shaders compatibility update for 2022.3.0f1
* URP Shaders rolled back to FORGE3D/Additive and Alpha Blended to fix fog issue

### \[Version 2.2.2 changes]

* Added HDRP support
* Asset Store download now combines Standard, HDRP, URP as three separate .unitypackage files in the asset folder

### \[Version 2.2.1 changes]

* Asset Store download now combines Standard, LWRP, URP as three separate .unitypackage files in the asset folder
* Added installation readme text file
* Fixed turret editor window bug&#x20;

### \[Version 2.2.0 changes]

* Added LWRP support for 2018.4.33
* Added Standard Renderer support
* Heat shader fixes for LWRP and URP
* Minor fixes

Standard Renderer support included as .unitypackage. Copy into a new project before extracting.

* LWRP support for 2018.4
* URP support for 2019.4.32+

Unity 2020.3.5, Unity 2021.1.4 (URP 10.4.0+) know issues:

* Universal Renderer Pipeline/Particles/Unlit shader becomes colored with fog. Disable fog in Window/Rendering/Lighting Settings/Environment -> Fog

### \[Version 2.1 changes]

* Asset is now Unity 2019.4+ compatible
* All content has been updated to support Universal Render Pipeline (URP) 7.3.1+
* You can modify shaders with [Amplify Shader Editor](https://assetstore.unity.com/packages/tools/visual-scripting/amplify-shader-editor-68570)

### \[Version 2.05b changes]

* Asset is now Unity 2017.4+ compatible
* Example scenes have been revamped
* Shaders have been rewritten to support Amplify Shader Editor and PBR pipeline

  \[Version 2.02b changes]
* Added Unity 5.6.0 Support
* Build errors have been fixed
* Beam UV Animation has been fixed
* Turret's scene missing weapon sockets has been added to MLRS and Laser turrets
* The package has been extended with additional Unity 5.3.6 support

### \[Version 2.01b changes]

* The PoolManager database creation path has been fixed. We've added the string path variable to the editor script pointing to the "Assets/FORGE3D/Resources/F3DPoolManagerCache" folder.
* PoolManager's Limit frame and Keep target FPS is now applied correctly
* The FORGE3D menu in the Unity Editor has been redesigned including several new links and categories
* The Sci-Fi Effects video overview has been added to the product page

### \[Version 2.0b changes]

* Added 22 modular turret parts for PC and Mobile
* Added Turret editor&#x20;
* Added Turret constructor
* Added Turret tracking controller
* PoolManager has been redesigned completely
* Fixed bugs, errors and warnings from legacy version
* Multiple turret duplicates are now allowed reusing the legacy weapon controller
* Warp tunnel fixes has been applied


# Force Field

Version 2.4

*A fundamental understanding of Unity Engine, as well as C# programming language is assumed. Basic familiarity with Unity Shaders and Visual Effects Design is advantageous, but not a requirement.*

Force Field is a shader based solution that renders a visual effect on a mesh surface. The connection between your code and the Shader is accomplished through the Force Field Controller component.

A collider is required to capture a point of an impact which then passed further to a Force Field Controller. A collider mesh should be identical with the mesh of a MeshRenderer used to represent the shield itself.

To issue a hit point rendering a world space coordinate has to be extracted from results of a ray cast against the collider and sent to a public OnHit(…) method of a Force Field Controller. It is also possible to pass a hit spot size and initial alpha value as additional parameters.

Rigid body collisions can also be used to supply impact coordinates through the system of Unity events. The collision events only sent in case of one of the colliders has a non­-kinematic rigid body attached.

### **Recommended setup**

Before you can start with the example scenes it is advised to perform fine tuning of the editor according to the suggested checklist:

* **Enable Linear Color mode and set Rendering Path to Deferred**

Enabling linear rendering in Unity is simple: It is implemented on a per-project basis and is exposed in the Player Settings which can be located at **Edit -> Project Settings -> Player -> Other Settings**

Read more: [Linear Pipeline in Unity Manual](https://docs.unity3d.com/Manual/LinearLighting.html)&#x20;

![](/files/-MAuGVEloL-74MJo-MLz)

* **Enable HDR on your camera**

HDR is enabled separately for each camera using a setting on the Camera component. More convincing visual effects can be achieved if the rendering is adapted to let the ranges of pixel values more accurately reflect the light levels that would be present in a real scene.

Read more: [High Dynamic Range Rendering](https://docs.unity3d.com/Manual/HDR.html)

### **Have a question or need help?**

If you have any questions, suggestions, comments or feature request please do not hesitate to reach out via [contact form](https://www.forge3d.com/contact/).


# Getting started

The easiest way to understand the basics is to create your first Force Field object.  Let’s get started with a new scene and a few things to help us along. We will use one object to render the shield effect and the other to render a surface it covers.&#x20;

### **Creating geometry**

* &#x20;Create sphere from Unity menu **GameObject -> Create Other -> Sphere** and place it in front of the camera

![](/files/-MAuGuG1rB_WH2DyE0eE)

* &#x20;Duplicate the Sphere game object using **Edit -> Duplicate** menu and rename it to “**Shield**“. Select Sphere game object and remove Sphere Collider component.

![](/files/-MAuH37ANRTbQMwJU8nj)

### **Adding a controller**

Next thing required is a controller script. Let’s add one to the Shield and assign the game object reference to be used as a shield surface.

* Add **Forcefield.cs** script component to the Shield game object using the inspector’s “**Add Component**” either manually from **Assets/FORGE3D/Force Field/Scripts** folder by dragging it on top.

![](/files/-MAuHBekBSou4bhkAf33)

* Select Shield game object in the Hierarchy panel and drag it on top of the empty ‘**Field**‘ property of the Force Field Controller within the Inspector.

![](/files/-MAuHD5fHNA5FNOR5HLX)

### **Adding a material**

It’s time to create a new material and assign it to the Shield. We will use Force Field shader to render the shield and the corresponding effects.

![](/files/-MAuHJjjGXoZXpmy-Fnk)

* Create new Material in Project panel: **Right Click -> Create -> Material** and name it “**Shield**“.
* Select the material and pick **FORGE3D/Force Field/Force Field** shader from the drop down list.

### **Shader setup**

Force Field ships with a set of textures to help you create various kinds of shield effects. In this chapter, we will set the shield, its colors, and different properties so it looks and feels the way it should.

* Plug the texture mask into the Field Texture slot, such as “**field\_charge\_003**“, which can be found under the **Assets/FORGE3D/Force Field/Textures** path, and set the texture tiling to 8 on X and 4 on Y  to help the spherical shield appear in a more pleasant way.

![](/files/-MAuHU0qtfEnto8Al8yc)

Next important step is to set up a shield color gradient with help of both Inner and Outer Masks Tints. Note the alpha value is used to boost the multiplier, and it is vital to get it shine with your juicy Glow Image Effect.

* Set ‘**Inner Mask Tint**‘ RGBA color values to (**R: 130, G: 220, B: 255, A: 40 /** **HEX Color #82DCE128**)
* Set ‘**Outer Mask Tint**‘ RGBA color values to (**R: 0, G: 150, B: 255, A: 40 / HEX Color #0096FF28**

![](/files/-MAuHVg4nTu8Wurd2Ck8)

The “**Mesh Offset**” will push the shield along its normals and the “**Pan Speed**” will animate the texture so you shield looks more like alive. So leave the positive default values as it is more than enough for our purpose.

![](/files/-MAuHXHRNE3BZHbQUA-w)

Now it’s time to set shield feedback at the moment of impact. “**Background Visibility**” is the first layer that makes the effect.

* Set “**Field Background Visibility**” value to **2**

“**Sparks**” are the eye candy which makes texture masks shine at the moment of its intersection. Let’s set it’s visibility as well:

* Set “**Field Sparks Visibility**” value to **3**

“**Inner Mask**” will flash first at the point of impact and will fade inwards by the speed of the “**Decay**” parameter controlled from the Force Field script. “**Offset**” specifies the size of the original mask where higher values will make the mask appear smaller due to POW function.

* Set “**Inner Mask Offset**” value to **8**
* Set “**Inner Mask Feather**” value to **8**

![](/files/-MAuHcJfvOZHzkXCW_WT)

“**Feather**” controls how smooth the mask should be drawn. Let us set some values to get the hang of it before diving into much of the technical details. The additional “**Outer Mask**” will reveal at the impact point spreading outwards and forming a “blast wave” effect:

* Set “**Outer Mask Offset**” value to **4**
* Set “**Outer Mask Feather**” value to **4**

### **Triggering the shield**

Last chapter concluded the shield set up and it is about time to wreck the havoc on the field. The Force Field controller you have attached earlier will handle such task of assuring the shield reacts accordingly to the damage dealt.

To simplify things, you will use a **SimlpeGun.Cs** that simulates the projectile cast from camera’s screen point beneath your mouse cursor.

* Attach the **SimpleGun.Cs** script to the camera. You will also find it located under the **Assets/FORGE3D/Force Field/Examples/Scripts** folder.

![](/files/-MAuHrG5-BbsUbvPeRNA)

### **Blast it!**

We went through the process of a shield assembly from scratch, and now everything is ready to launch into the game mode and trigger the shield.

* Hit **Play** within the editor and click and hold the **Left Mouse Button** on top of the sphere.

![](/files/-MAuHze5NkyZJTaHiVfv)


# Force Field Video Tutorial

#### Fine Tuning the Shield

This tutorial explores the best available options to set the various shield material values achieving the top-line result. You will learn how to create a shield from scratch and a few valuable tricks to apply in the process.

{% embed url="<https://www.youtube.com/watch?v=geH0L0tRzMU>" %}


# Force Field Controller

## Force Field Controller

The Controller component handles the Shield shader behavior by acquiring impacts sent through the OnHit() method.

![](/files/-MAuKzDy3G49ktSuQiij)

“**Fix Rigidbody**” – Enables a workaround to the Unity limitation introduced starting with version 5.0 and higher, where a MeshCollider and a Rigidbody no longer work together attached to the same object leading to an error spam in the console.

“**Field**” – A reference to a Shield object(s) to control.

“**Collision Enter**” – The shield will respond to a collision when its collider/rigid body has begun touching another rigid body/collider.

“**Collision Stay**” – The shield will respond to a collision once per frame for every collider/rigid body that is touching its rigid body/collider.

“**Collision Exit**” – The shield will respond to a collision when its collider/rigid body has stopped touching another rigid body/collider.

“**Decay Speed**” – The speed at which the current hit points are faded away. Higher decay value leads to a faster decay. Setting the value to zero will freeze the effect. You may use this feature to fine-tune the shield.

“**React Speed**” – A time gap in milliseconds at which the controller registers new hits. A zero value will remove a limitation, and a value of one will limit to one hit per second.

“**Fix** Non Uniform **Scale**” – This option is designed to help with setting a shield affected by a scaled transform.


# Rigidbodies

### Convex MeshCollider Issue

Since version update 2.4, the Controller script has the capability to get past the limitation of a non-convex MeshCollider with a non-kinematic Rigid body introduced with Unity 5.0.

![](/files/-MAuLnB8DmvNN7KSFeKL)

This feature requires a few changes in your typical workflow such as rearrangement of the components and disabling MeshColliders. To understand the specifics of such changes, we will have a closer look at the example involved in the **Weapon\_Range\_RigidBody\_Fix** scene.

![](/files/-MAuLoUYyt2AaJTPF6zA)

To start out, the parent object “**ship**” contains two sets of subobjects representing various parts such as engines, sensors, etc. One set of meshes used to render the actual geometry of the ship and the other is the Force Field surface covering particular components.

The key elements reside on parent “**ship**” including Rigid body and Force Field Controller. Notice the Controller’s Field slots stacked with shields marked with a green rectangle on the screenshot. This is one of the important differences along with the shield surface setup.

Looking at the “**engine**” child under the Shield game object first thing to be aware of is the absence of Force Field Controller. When using “**Fix Rigidbody**” option, you no longer have to put the Controller on each shield instance, but instead, attach one instance to your top most object. That said, the Controller will automatically detach the slotted shield pieces and will carry them along.

![](/files/-MAuLursmsrjaVmHiaT3)

One more thing to keep in mind is the MeshCollider component should be disabled on each shield element the hierarchy. It is a necessary step that will help bypass the errors thrown by Unity into the console.

![](/files/-MAuM1iOpW0Uq07JYYUK)

To wrap up this chapter let us highlight the most important steps in non-convex mesh and non-kinematic rigid body workflow:

* Keep a SINGLE Force Field Controller instance on the top most object
* Fill in the “**Field**” slots with shield elements contained within the parent
* Avoid adding a Force Field Controller to shield objects
* Keep MeshColliders disabled

### Rigidbody Collisions

Force Field is proficient at handling Rigid body collision events sent by Unity Engine in the following methods:

**OnCollisionEnter**, **OnCollisionStay** and **OnCollisionExit**

```csharp
// COLLISIONS EVENTS
        void OnCollisionEnter(Collision collisionInfo)
        {
            if (CollisionEnter)
                foreach (ContactPoint contact in collisionInfo.contacts)
                    OnHit(contact.point);
        }
 
        void OnCollisionStay(Collision collisionInfo)
        {
            if (CollisionStay)
                foreach (ContactPoint contact in collisionInfo.contacts)
                    OnHit(contact.point);
        }
 
        void OnCollisionExit(Collision collisionInfo)
        {
            if (CollisionExit)
                foreach (ContactPoint contact in collisionInfo.contacts)
                    OnHit(contact.point);
        }
```

The collision data sent with these events is redirected to the shader throughout the OnHit() method. It is pretty similar to a ray casting technique mainly used to invoke the effect from a script.

Response to collision events can be switched using checkboxes in the Controller component:

![](/files/-MAuMeAdioVCoT-uvhYd)

**Important**

* Collision events are only sent if one of the colliders also has a non&#xAD;**-**&#x6B;inematic rigid body attached.
* If there is a reason not to use Rigid Body vs Force Field collisions it is best to comment corresponding sections in Controller script to avoid unnecessary amounts of data sent into these methods.

To get more on collision events and rigid bodies, refer to the official manual pages:

* <https://docs.unity3d.com/ScriptReference/Rigidbody.html>
* <https://docs.unity3d.com/ScriptReference/Rigidbody.OnCollisionEnter.html>
* <https://docs.unity3d.com/ScriptReference/Rigidbody.OnCollisionExit.html>
* [https://docs.unity3d.com/ScriptReference/Rigidbody.OnCollisionStay.html ](https://docs.unity3d.com/ScriptReference/Rigidbody.OnCollisionStay.html)


# Shaders

### Shader Variants

The Force Field includes several various types of shaders available in the **Assets/FORGE3D/Force Field/Shaders/** folder.

![](/files/-MAuPPt-psBrvRy0y9L5)

{% tabs %}
{% tab title="ForceField" %}
**FORGE3D/Force Field/Force Field**

ForceField is the default shader with just the basic options and 24 simultaneous impacts enabled.&#x20;

* **Field Texture** – The grayscale mask that is used by the shader to build up the visual shield effect.
* **Inner Mask Tint** –  Set up a shield color on the Inner part of the impact splash.
* **Outer Mask Tint** – Set up a shield color on the Outer part of the impact splash.
* **Mesh Offset** – Pushes the shield mesh along its normals.
* **Field Texture Pan Speed** – Animate the texture offset of the masks.
* **Field Background Visibility** – Is the first layer that makes the shield feedback at the moment of an impact.
* **Field Sparks Visibility** – Makes texture masks shine at the time of their intersection. Best used with *Field Texture Pan Speed*.
* **Inner Mask Offset** – Will flash first at the point of impact and will fade inwards over time.  Specifies the size of the original mask where higher values will make the mask appear smaller due to POW function
* **Inner Mask Feather** – Controls how smooth the Inner Mask should be drawn.
* **Outer Mask Offset** – Will reveal at the impact point spreading outwards and forming a “blast wave” effect.
* **Outer Mask Feather** –  Controls how smooth the Outer Mask should be drawn.
  {% endtab %}

{% tab title="Static" %}
**FORGE3D/Force Field/Force Field Static**

The shader includes everything the default *ForceField* shader has plus a new **Static Field**. Use it if you’d like your shield to render itself all time. The impact effects will be drawn on top the existing Static Field.
{% endtab %}

{% tab title="Mobile" %}
**FORGE3D/Force Field/Force Field Mobile**

Due to low-end platform limitations, the Mobile version has its set of features stripped providing decent performance over visual quality.

**Limitations on the Mobile include:**

* Amount of simultaneous impact points is limited to 6
* Impact spot size and alpha control from script is unavailable
* Mask options limited to Inner Mask only
* “Sparks” texture effect is unavailable
* Rigid body collisions limited to “OnCollisionEnter.”

**Important information:**

A mobile version of the shader (*ForceField\_Mobile or ForceField\_Static\_Mobile*) requires a mobile version of controller script (*Assets/FORGE3D/Force Field/Scripts/ForceField\_Mobile.Cs*).
{% endtab %}

{% tab title="Mobile\_Static" %}
**FORGE3D/Force Field/Force Field Static Mobile**

The shader includes everything the *Mobile* shader has plus a new **Static Field**. Use it if you’d like your shield to render itself all time. The impact effects will be drawn on top the existing Static Field.

**Important information:**

A mobile version of the shader (*ForceField\_Mobile or ForceField\_Static\_Mobile*) requires a mobile version of controller script (*Assets/FORGE3D/Force Field/Scripts/ForceField\_Mobile.Cs*).
{% endtab %}

{% tab title="Static\_UV1" %}
**FORGE3D/Force Field/Force Field Static UV1**

The shader includes everything from the *Static* shader and its texture lookup is using the **UV1** channel for automatically unwrapped shields.
{% endtab %}

{% tab title="VertexAnim" %}
**FORGE3D/Force Field/Force Field Static Vertex Animation Edge Falloff**

The shader includes everything the *Static* shader has plus **Vertex Animation and Edge Falloff**.

* **EdgeFalloff Exp** – The exponent grows the mask at the edges of the shield so that it renders masked zones invisible over the higher values.
* **EdgeFalloff Power** – The multiplier value that helps with the edge control.
* **Vertex Tile** – The segmentation of the vertices taken into account. Higher values produce a disorganized vertex offsets.
* **Vertex Speed** – The time multiplier at which the animation takes place.
* **Vertex Power** – The strength of the vertex expansion applied during the animation.
* **VertexFalloff** – The exponent of the mask at the edges of the shield neglecting the animation.
  {% endtab %}
  {% endtabs %}


# Impact Points

By the default, Force Field processes up to 24 concurrent impacts in a Desktop and up to 6 in a Mobile version of the shader.

These are the steps to adjust number of simultaneous impacts processed:

* Open Force Field Controller script (Forcefield.cs) and change interpolators value

![](/files/-MAuS5rBnNlUQWkV6fmS)

* Open Force Field Shader (Forcefield.shader) and find the line starting with **#include “UnityCG.cging”**

Notice two following lists of **fixed4 \_Pos\_** and **fixed \_Pow\_** declarations both starting with 0 indexes and ending with 23. Modify both lists, so they match to a number of interpolators you previously set in the Forcefield.Cs script.

For example, if you changed the interpolators from the default to a value of 8, you should set the indexes starting from 0 and end with 7.

Don’t be surprised by a number of variables required modifying by hand. Unfortunately passing an array wasn’t possible at the moment of Force Field release. Despite the fact, we look into available options considering Unity 5.4.0+ features and will be rolling new updates including even more simultaneous impacts shortly

![](/files/-MAuS76G92EFiHxIa5uR)

* In shader, find a fragment section defining a number of interpolators and local array declarations. Adjust the interpolators value and array lengths according to a new number of impact points

![](/files/-MAuS8AaiPpEI2tfHYSJ)

* A few lines down bellow in the shader are two lists of **pos\[]** and **power\[]** array initialization. Adjust their names and indexes to correspond to the number of impacts you set earlier

![](/files/-MAuS97sp_mGnhrncPTT)

* Lastly, go to the first line of the shader and change its name string to reflect the number of points then save the file by giving a different name. Switch back to the Editor and wait for it to compile.

You can now switch to your modified shader in a drop-down list of a shield material.

### **Important**

* It is not recommended to increase the number of impact points in a Mobile shader due to platform limitations and a limited number of registers available on low-end platforms.
* Raising a number of impact points too high will result in a performance decrease and should be used with caution.


# Upgrading

### **Before you start**

Force Field 2.4 made some changes to the underlying folders and the structure of its assets. We also introduced the Effects & Hangar level and made changes to the shader path names.

* Nevertheless, the upgrade should be a painless process. We highly encourage you to do a backup of your project before proceeding.

### **Download and import**

* To start out with the upgrade, download the package, and import the Force Field 2.4 into your project

![](/files/-MAuG2XkiQKs8wIGOJHD)

### **Important**

*There might be a console error affecting users from using Force Field 2.4 due to redundant references kept by the **AssetStoreTools** which caused parts of the Standard Image Effects and Cinematic Image Effects trap into the package at the moment of the asset submission. So if this is your case, head here for the solution on* [***our Forum***](http://forum.forge3d.com/t/force-field-2-4-package-import-errors/37)*.*

* In the Import Unity Package window, click “All” and then click “Import” to proceed with the upgrade

![](/files/-MAuG3pv7ZVMDQ5w5XGj)


# Platform Differences

Force Field ships with a set of scripts and shaders best suited for both Desktop and Mobile. Due to low-end platform limitations, though, the Mobile version has its set of features stripped providing decent performance over visual quality.

### **Limitations on the Mobile include:**

* Amount of simultaneous impact points is limited to 6
* Impact spot size and alpha control from script is unavailable
* Mask options limited to Inner Mask only
* “Sparks” texture effect is unavailable
* Rigid body collisions limited to “OnCollisionEnter.”

### **Important information:**

A mobile version of the shader (*ForceField\_Mobile or ForceField\_Static\_Mobile*) requires a mobile version of controller script (*Assets/FORGE3D/Force Field/Scripts/ForceField\_Mobile.Cs*).


# Changelog

The latest Force Field Update 2.4 is loaded with features that will enhance your experience in various ways. We’ve improved the overall Shield system, allowing you to make it easier to apply to a complex surface, such as Ships meshes cluttered with the details by utilizing the built-in Unity’s UV1 unwrapping.&#x20;

We’ve changed the example scenes with a brand-new PBR Reactor and Hangar Example along with the new Wasp Interdictor model to demonstrate how you can get back to the MeshCollider and the Rigidbody pipeline.&#x20;

We’ve also added new shader variations including the Edge Fade and Vertex Animation already seen in our Planets what makes Force Field even better in exciting ways.

### **\[Version 2.4 changes]**

* PBR Space Ship model with docking animation
* PBR “Reactor & Hangar” scene
* Edge Fading and Vertex Animation shader
* UV1 shader to use with an automatic lightmap unwrapping which helps fitting shield texture on a complex mesh
* RigidBody and MeshCollider should be fixed now! Check the new example scene
* The FORGE3D menu in the Unity Editor includes several new links and categories


# Wasp Interdictor

Version 1.0

This guide describes the basic steps to get started with Wasp Interdictor: PBR Ship and VR-Ready Cockpit Kit.

The kit has been tested with Unity Engine 5.3.6f1 and 5.4.1f1 Versions.

**What This Package Includes**

* Wasp Interdictor Ship Model
* VR-Ready Cockpit
* Head Camera Script
* Gun and Radar Tracking Controller
* Nozzle Flaps Controller
* Thruster Exhaust and Heat Haze Effects
* Terrestrial Prefab from Planets Pack
* Skybox Set (Stars, Nebulas)
* Customizable Skybox Shader
* 3 Substance Painter Sources (Ship, Cockpit, Canopy Glass)
* PSD Paint Decals Template
* Ship and Cockpit Shake Animations

### **Recommended setup**

Before you can start with the example scenes it is advised to perform fine tuning of the editor according to the suggested checklist:

* **Enable Linear Color mode and set Rendering Path to Deferred**

Enabling linear rendering in Unity is simple: It is implemented on a per-project basis and is exposed in the Player Settings which can be located at **Edit -> Project Settings -> Player -> Other Settings**

Read more: [Linear Pipeline in Unity Manual](https://docs.unity3d.com/Manual/LinearLighting.html)&#x20;

![](/files/-MAuGVEloL-74MJo-MLz)

* **Enable HDR on your camera**

HDR is enabled separately for each camera using a setting on the Camera component. More convincing visual effects can be achieved if the rendering is adapted to let the ranges of pixel values more accurately reflect the light levels that would be present in a real scene.

Read more: [High Dynamic Range Rendering](https://docs.unity3d.com/Manual/HDR.html)

### Example Scenes

![](/files/-MAuWtff8IG2_JUJfHAH)

The kit has several example scenes including versions with and without the Image Effects each.

Here is the list of scenes and their descriptions:&#x20;

**Cockpit -** The scene version with camera controlled through the movements of a mouse and different head position including a cockpit and two wingman space ships with thruster effects.2

**Cockpit\_VR -** No mouse controller. The head positioning matches VR scale.3

**Exterior\_Planet -** The scene wraps two space ships on a Terrestrial Planet background. Best used with Cinematic Image Effects.4

**Gun\_Tracking -** The ship has the mounted gun and radar setup with the tracking script. Click "Play" and drag the "\_\_\_Target\_\_\_" Game Object.

### **Have a question or need help?**

If you have any questions, suggestions, comments or feature request please do not hesitate to reach out via [contact form](https://www.forge3d.com/contact/).


# VR Setup

VR support is enabled by visiting Edit > Project Settings> Player > Other Settings > Rendering. Then enabling the “Virtual Reality Supported” checkbox in the Inspector.

Set your SDK according to the device requirements you currently have connected to your PC/Mac

![](/files/-MAuW9iJ4MPNJp_AiJGs)

### **Learn More**

[Virtual Reality Tutorials](https://learn.unity.com/tutorial/getting-started-with-vr)

[Oculus Rift Support Center](https://support.oculus.com/rift/)


# Controller Components

### Tracking Controller

The easy setup includes the animated mounted parts where script manages the elevation-heading limits and controls the tracking speed.

![](/files/-MAuXQwSU85hpHM_Vgy4)

Before a controller will target anything, you must setup a few things and specify a transform of an object to aim. Here are the options available in the inspector tab of a controller component:

**Target** – A transform of an object the controller will aim at

**Body** – Specifies the transform of the vertical tracking component along the elevation plane

**Mount** – Specifies the transform of the horizontal tracking component along the heading plane

**Heading tracking speed** – The rate at which the component can rotate towards target on the horizontal plane

**Elevation tracking speed** – The rate at which the component can pivot towards target in the vertical plane

**Heading limit** – The arc of fire along the horizontal plane. The editor gizmo marked with red

**Elevation limit** – The arc of fire along the vertical plane.  The editor gizmo marked with blue

### Nozzle Flaps Controller

The script will tackle the most of the work animating the position of each nozzle flap in response to commands from the script. The options include Flap Position, Turn Limit, and Speed.

![](/files/-MAuXamHKD228sebRgOa)

**Left / Right Engine** – References to the nozzle flaps transforms found within the ship’s model.

**Servo Current Position** – The animation value in the range of 0.0f to 1.0f that controls the position of each nozzle flap piece.

**Servo Limit** – The limiting angle value that stops the controller from opening the petals further.

**Servo Speed** – A speed at which the controller animates the petals.


# PSD Template

The PSD template allows you to customize the color of the paint decals covering the ship. The Emission source has been included as well.

![](/files/-MAuXuR_WibvsdlO6Scr)

You will find the files located inside the **Assets/FORGE3D/Wasp Interdictor/Textures/PSD/** folder.


# Substance Painter Sources

The combination of 2048 texture maps along with the [Substance Painter](https://www.allegorithmic.com/products/substance-painter) sources enables full customization of the Ship and Cockpit with all requirements you have in mind.

Source files were created with Substance Painter, Version 2.3.1 Build 1363. You will find the files located inside the **Assets/FORGE3D/Wasp Interdictor/Substance Painter/** folder.

![](/files/-MAuXkDgLgtqIYVwqQOE)

Use 7-Zip free software to unpack the archives. You can use it on any computer. You don’t need to register or pay for 7-Zip. Head here to download: <http://www.7-zip.org/download.html><br>


# Damage FX

Version 1.2

This guide is aimed to quickly provide you with the essential knowledge of the Damage FX Asset. It is assumed that you are already familiar with the Unity Engine, C#, and have a basic knowledge in shaders.

Thanks to the [Amplify Shader Editor](https://amplify.pt/unity/amplify-shader-editor/) from [Amplify Creations](https://amplify.pt/), it was possible to build the Damage FX Framework without writing a single line of shader code, except one code expression node, and still, using the shader editor!

It turns very handy since you can drop the Damage FX Function node onto your canvas, and start using it out of the box. The function itself can also be easily customized giving you total control over the Damage FX.

What if you don’t have the Amplify Editor? Don’t worry! The Damage FX comes with the PBR Metal, Specular and also Battleships shader samples, so you’re pretty much covered.

You will find the shader samples under the **FORGE3D/DamageFX** path in the material inspector.

### **Recommended setup**

Before you can start with the example scenes it is advised to perform fine tuning of the editor according to the suggested checklist:

* **Enable Linear Color mode and set Rendering Path to Deferred**

Enabling linear rendering in Unity is simple: It is implemented on a per-project basis and is exposed in the Player Settings which can be located at **Edit -> Project Settings -> Player -> Other Settings**

Read more: [Linear Pipeline in Unity Manual](https://docs.unity3d.com/Manual/LinearLighting.html)&#x20;

![](/files/-MAuGVEloL-74MJo-MLz)

* **Enable HDR on your camera**

HDR is enabled separately for each camera using a setting on the Camera component. More convincing visual effects can be achieved if the rendering is adapted to let the ranges of pixel values more accurately reflect the light levels that would be present in a real scene.

Read more: [High Dynamic Range Rendering](https://docs.unity3d.com/Manual/HDR.html)

### Example Scenes

You will find them under the **Assets/FORGE3D/DamageFX** path in your project folder.

Both examples will provide you with the on screen help and values which will be updated by the  Damage FX Script Component to the Damage FX Shader on the next impact that you trigger.

**Text Plate scene**

*01\_DamageFX\_Plate.unity*

The text and background tech plate meshes have the underlying geometry layer which demonstrates the most of the effect. Shooting at the text will reveal rust as its outer mesh becomes hidden on the damage application.

![](/files/-MAu_VOJhn7u139yApav)

**Example Meshes scene**

*02\_DamageFX\_ExampleMeshes.unity*

![](/files/-MAu_XlA0K9uHvEcSOEF)

There are three new mesh samples in the scene. Some of them contain multiple parts and various implementations.


# Shader

The Damage FX Object consists of three essentials pieces:

**Damage FX Shader**

Let’s look at the basic application of the shader with the base layer which is rendering the initial or untouched mesh, and also the damage layer added by the Damage FX function. The universal example would be **FORGE3D/DamageFX/PBR** Specular Gloss shader in our case.

The damage is added dynamically upon providing an object space point and non empty value to the shader data array. The shader function will iterate through the available impact points building the required masks given the following values:

* **Hit Radius** – Defines the size of the impact. Note the mesh import scale (Unity Mesh Inspector) may affect the tiling of the damage masks. Ranges \[0f, \~]. Setting a zero value leaves a very subtle effect.
* **Dirt Mask** – The strength of the dirtiness around the impact in a range of \[0f,1f].
* **Burn Edge** – The amount of burn color applied to the inner edge of the impact usually in between the clipped spot and the dirt layer. Ranges \[0f, 1f]. This parameter works best with the positive Clip and will fade over time. The fading can be controlled from the Damage FX Script Component.
* **Heat Glow** – Is a glowing spot on top of the impact. Ranges \[0f, 1f]. This parameter will fade over time and can be controlled from the Damage FX Script Component.
* **Clip Mask** – The amount of clip applied at the impact point. Ranges \[0f, 1f]. The lower the value the less is the clip up to none. A value in between the range, e.g. 0.5f, leaves the most of the rough edges at the impact hole.

These five values are individual per impact point and you can experiment with them in the real-time by launching the example scenes.

Note the default configuration is set to 200 impact points per Damage FX Object. Adding more points over the limit will overwrite existing ones from the beginning of the shader array.<br>


# Controller

*Assets/FORGE3D/DamageFX/Scripts/DamageFX.cs*

In order to control the Damage FX Shader, an instance of the script should be present on each Damage FX Object. The script component handles the data processing for impact spots and fades the heat values over time.

![](/files/-MAuahpT1aSHZhBa1h0d)

Use **DamageFX.Hit()** method of the script to add new impacts to the surface of the mesh as shown below:

![](/files/-MAuajMtCroj_nXR65c9)

Here is the simple code snippet that will add the damage point to the Damage FX Object under the mouse cursor on left mouse click:

```csharp
public float HitRadius = 0.1f; 
public float Dirt = 1f; 
public float Burn = 1f; 
public float Heat = 1f; 
public float Clip = 0.7f;
 
private RaycastHit _hitInfo;
 
private void Update()
{
 
  if (!Input.GetMouseButtonDown(0)) return;
     
  var screenRay = Camera.main.ScreenPointToRay(Input.mousePosition);
   
  if (!Physics.Raycast(screenRay, out _hitInfo, Mathf.Infinity)) return;
   
  var dfx = _hitInfo.collider.GetComponent<DamageFX>();
   
  if (dfx != null) dfx.Hit(dfx.transform.InverseTransformPoint(_hitInfo.point), HitRadius, Dirt, Burn, Heat, Clip);
   
}
```


# Colliders

The Damage FX works best with precise colliders that match its mesh geometry, e.g. mesh colliders.

If the distance between the closest mesh point and the collider hitpoint is bigger than the hit radius, then the effect won’t be visible at all. It’s important to provide a properly designed colliders to your Damage FX Objects.

The key is to get the impact from the hitpoint of the raycast against the collider to the original vertex position of the mesh. Sometimes this is not possible, for example, because you want to use the rigid body on the same object which will cause Unity to throw an error. Here’s a workaround to it. Remember, that you can use a convex collider or any number of simplified ones instead, either detach the mesh collider in the Awake(), and move it along each frame. You can also try using any third party tools/assets to help with generating a series of convex colliders covering the mesh.


# Material

Depending on the shader, the amount of available material parameters may change, although there are always a number of parameters that added with the Damage FX Function.

![](/files/-MAubEM9tOo1fDyoij60)

You should be already familiar with the Damage FX Script method input values from the previous chapter. In the image example the material values look somewhat identical. There are more parameters though and also two texture samples for damage masks and produced glow. The DamageMap holds the clip and dirt masks, while the HeatMap is used to generate the UV animated effect along the burn edge.

As an addition, there is a Vertex Damage parameter that will offset the geometry points affected by the impact along its normals based on the clipping mask.

You can tile clip and dirt masks by adjusting in values in the inspector, while the heat map should be tiled by the sampler’s x and y instead. It is also important to know that you might want to adjust your tiling when setting a material for a new mesh.

That said, with all the given parameters of the Damage FX Material, you can control its clip, dirt, heat and burn values globally. Keep in mind that the Function input values apply individually per point and based on your global settings in the material of the Damage FX Object.

**Damage Map UV2**

The DamageMap sampler uses the UV2 channel. Make sure you have a UV2 map on your mesh by Generating a Lightmap UVs in Unity. This option is available in the Mesh Import Settings.

![](/files/-MAubJgF8jW1VM007DhF)


# Debugging damage

Usually you would want a weapon controller to call the Damage FX Script Component when you hit an object with a weapon. Following this approach to set the look of the damage on the object might become time consuming. There is a more quicker way with the **ApplyDamage.cs** script which implements all the necessary tools for the task.

If you’re not familiar with this script, just refer to the example scenes.

![](/files/-MAubTWDi2hlaNNgSVH5)

Notice the Debug Mode checkbox which turns the object itself into a real time impact generator given the values from the user input. Enable the Debug Mode and move it around. Use the hotkeys such as W-S, 1-2 and Space to reset.

![](/files/-MAubVPZazB925TTVdll)

Additionally, you can set the Damage FX Script Object Decay Tick Rate and Decay Per Tick to zero to stop the glow from fading.

![](/files/-MAubXkR60RNgJGVntUd)


# Impact points

### **Damage FX Script Component**

Modify the constant value of the Damage FX Script Component:

*Assets/FORGE3D/DamageFX/Scripts/DamageFX.cs*

![](/files/-MAubmVf2oEX6IvYLwhX)

### **Amplify Creations Shader Editor Users**

Open the DamageFXDistMask function from the **Assets/FORGE3D/DamageFX/Shaders/** and change the number of MaxPoints constant matching the number set in the script component. Recompile both Damage FX Functions and all shaders affected by this change.

![](/files/-MAubnvde_67o0IR3214)

### **Modifying shaders by hand**

Open the Damage FX Shader sample and search for the existing number of points in the search field of your favorite editor:

![](/files/-MAubsXuDUIyAQzmGg8m)

![](/files/-MAubuDVvLp9IXgnWww3)

![](/files/-MAubpCSybc5jXl2uaQc)


# Damage FX Shader Node

The Damage FX Function can be reused within the Amplify Shader Editor. It fits perfectly into any existing node framework. As you already might know, the function itself is all it requires to add a Damage FX support to your existing shaders. Using it for the first time, please make yourself familiar with the output nodes and where you can connect them.

![](/files/-MAuc8LsNWBWk7ky4fEr)

The Damage FX Function can be reused within the Amplify Shader Editor. It fits perfectly into any existing node framework. As you already might know, the function itself is all it requires to add a Damage FX support to your existing shaders. Using it for the first time, please make yourself familiar with the output nodes and where you can connect them.


# Planets


# Changelog

### \[Version 1.51 changes]

Minimal required Unity version is LTS 2021.3+

**Universal Rendering Pipeline:**

* Requires Universal RP 12.1.7+
* Fixed Deferred rendering support&#x20;
* Minor atmosphere and cloud shadows tweak

### \[Version 1.5 changes]

* Added Universal Rendering Pipeline support
* Materials, shaders, shader functions and scenes are now packed into 'rendering templates' or .unitypackages
* Appropriate rendering template (URP or Standard) will be imported automatically upon first project launch based on the current installed pipeline in your project
* Rendering pipeline can be switched/imported manually from /Assets/FORGE3D/Planets/SRP Templates/. *Please note this will overwrite any custom changes you may have in the existing Planets materials and shaders.*

### \[Version 1.41 changes]

* Fixed falloff values on triplanar nodes which caused surface textures disappear when upscaling the planet
* UV Offset parameter in the atmosphere shader is now named properly in its inspector
* Minor atmosphere tweaks

### \[Version 1.41 changes]

* Custom vertex/fragment lighting system removed in favor of Unity’s lighting.
* Multiple lights support: Directional, Point. Added Reflection Probe support.
* All planet prefabs have been recreated from the ground up using new shader framework
* PRB Surface (Specular) shaders built with Amplify Shader Editor v1.4.5
* Out of the box shader compatibility across all platforms (SM 3.0+)
* Linear Color prefabs (Gamma color prefabs not included)


