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.

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

  • 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

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.