# Force Field

*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/).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.forge3d.com/force-field.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
