# Light Probe Generator

{% embed url="<https://www.youtube.com/watch?v=oCh6yaJzQ18>" %}
Light Probe Generator
{% endembed %}

### What are Light Probes?

Light Probes are an important aspect of a space if you are using [lightmapping](https://docs.monaverse.com/create/building-spaces/improve-your-space/lightmaps-unity-lightmapper) (which is recommended) in order to improve your overall lighting results.

Lightmaps only work on static, or non-dynamic, assets by creating unique textures for those assets. These look great, but as they are *fixed* textures, we can't use it on dynamic objects such as the Avatar, or canvases.

Light Probes get around this problem by creating many 'dots' of color information, or probes, in the space to take in the light at that location and dynamic objects like the Avatar will use that information to light it. It is less accurate than a lightmap, but it is also a *lot* less intensive on the processor. So, with Lightmaps and Lightprobes, you can have the best of both worlds.

### The Light Probe Generator

The Light Probe Generator tool can help make most of your Light Probes quickly and easily. You can add one light Probe generator, or multiple, it all depends on the needs of your space.

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2FOCXHGJroKlB8wZr0wkOl%2Fimage.png?alt=media&#x26;token=8813662a-5421-4f5e-8f78-3c8278eff266" alt=""><figcaption><p>Light Probe Generator Component</p></figcaption></figure>

### Light Probe considerations

Each probe does take a small amount of file size and processing, so you want the number of probes to only be what you need. Having probes very close together is usually a waste. A good target is to make sure that you have less than 1000 probes in a space at most. Smaller numbers are recommended.

Generally speaking, if there is little light change in an area you can use a lot less probes. On the other hand, if you have an area with many different lights and colors, this will look better with more.

For a more detailed explanation of Light Probes, you can check the Unity documentation [here](https://docs.unity3d.com/Manual/LightProbes.html).

### Light Probe Generator Settings

The Light Probe generator uses a number of different approaches and settings to creating light probes. Which ones you apply depends on the space and how you have set it up. Play around with them to get the best results.

**Nav Mesh**\
Creates a navmesh and uses it to generate probe positions. This placement method is useful for generating probes in areas most player avatars will traverse.

**Raycast**\
Traces the light rays of point and spot lights to find probe locations in the scene.

**Volume Scatter Placement** \
Scatters a uniform grid of probes inside the set volume.

**Object Bounds Placement**\
Places probes on the bounding box corners of objects.

**Density**\
Density controls the density of the generated Light Probe Group, a lower value means *more* Probes. These only effect the volume scatter and raycast placement methods.

### Using the Light Probe Tool

* Download the Light Probe Generator using the Mona Library > Mona Tools > Light Probe Generator 'Download' button. Import all the assets.
* Create an Empty Game Object with Right Mouse click. Name it however you like.

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2FZEBsahHX12hGXa5vZqvv%2F1_CreateEmpty.gif?alt=media&#x26;token=42148897-670d-4b8d-921b-ecb35e84ab69" alt=""><figcaption><p>Creating an Empty game object</p></figcaption></figure>

* Apply the Light Probe Generator script to the Empty game object.

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2FF7BgDwzvMCDvYTrm8VAy%2F2_AddComponent.gif?alt=media&#x26;token=70b3ad05-4846-49f8-8974-84f615afa6da" alt=""><figcaption><p>Add Light Probe Generator Component</p></figcaption></figure>

* Adjust the box to cover the area you would like to apply your Light Probes. You can do this by entering the numbers manually, or click/scrolling next to the parameter (this works for most fields in Unity).

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2F8J4YOiGiZlEvbw7oc3R8%2F3_Adjust%20Box.gif?alt=media&#x26;token=8c07793a-adc6-4202-b3e8-767b5ebabae5" alt=""><figcaption><p>Adjust box scale and position</p></figcaption></figure>

* Apply the settings on the script to get the best result, more details on these parameters are below.

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2FiN6dbhn3IVtuuXdLuGGJ%2Fimage.png?alt=media&#x26;token=8bd8c847-a407-4342-bf53-32629d77ee82" alt=""><figcaption><p>Adjust settings for Probe generation</p></figcaption></figure>

* Select 'Generate' to create the Light Probes

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2FsPVtwO6w6sXY1j13CJMu%2F4_GenerateProbes.gif?alt=media&#x26;token=92888b4b-a0e9-4389-a0da-d6feb91072aa" alt=""><figcaption><p>Select Generate to add Probes</p></figcaption></figure>

* You can choose to optimise the number of Light Probes by selecting 'Optimise' to reduce the number of Light Probes. This will merge probes that are within the Merge Distance assigned in the parameter.

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2FWMzhcZ7L8zoaDWUTbORv%2F5_Optimise.gif?alt=media&#x26;token=c845eaa5-cb27-4ee0-856a-cf6a646f827a" alt=""><figcaption><p>Optimising Light Probes</p></figcaption></figure>

* You can see the number of light probes in the Console when you create or optimise the light probes. Ideally you do not want more than 1000 probes in your space, lower is better. Otherwise, this will start affecting file size etc.&#x20;

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2FPTU9VC7Kkz0EQ8vKbnaf%2Fimage.png?alt=media&#x26;token=fc943d70-e087-423b-a866-77a56e9bc3de" alt=""><figcaption><p>Light Probe count</p></figcaption></figure>

* It is possible to manually edit the probes if needed by selecting the 'Edit Probes' button on the Light Probes Group component. \
  \
  You can also use the following to add probes as needed : \
  Ctrl + C - Copy probes\
  Ctrl + V - Paste Probes\
  Ctrl + D - Duplicate Probes\
  \
  For more information on manual approach to light probes, go [here](https://docs.monaverse.com/create/building-spaces/improve-your-space/light-probes).

<figure><img src="https://3438761929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkgZbQzoznBJC_ld633%2Fuploads%2FhH9kVYyykB9ChS8jKdeA%2F6_ManualEditing.gif?alt=media&#x26;token=6384d315-c749-4b87-a71d-444d268b6cdb" alt=""><figcaption><p>Manually editing probes</p></figcaption></figure>
