Lighting

Recommendations and guidelines for lighting in your Creator Toolkit projects.

Note

We recommend completing Unity’s course on Lighting before working with lighting components.

You may create as many lights in your scene as you want, but all of them (except for 1) should be marked as “Baked”. Lighting Baked Mode

Only one Directional Light in the space may be set to “Mixed” and have “Soft Shadows” enabled. This main directional light will be used for real-time shadows on systems that match the system requirements.

Lighting Main Light

For lightmapping, these are the settings you’ll need to make things work correctly in Spatial. You can open the lighting panel from the Windows/Rendering/Lighting menu bar item in the top.

Lighting Mixed Lighting

Lightmapping Settings

  • Mixed Lighting Mode: Use Shadowmask. Distance Shadowmask will produce incorrect results for mixed realtime and baked lighting.
  • Lightmapper: GPU lightmapper is a lot faster than others. If your graphics card is not good enough to this, Unity will switch it to CPU automatically. (In the case, lower Max Lightmap Size and try again.)
  • Direct Samples: 32 is default and good enough. You can decrease for faster iteration and increase for higher quality.
  • Indirect Samples: 512 is default and good enough. If your scene doesn’t have much direct light and primarily uses bounced lights, and if you see noise on the lightmaps, increase this to 768 or 1024. Keep in mind that this will increase baking time a lot.
  • Environment Samples: 256 is default and good enough. This is sample count of lights from your skybox. If you still see noise after increasing Indirect Samples, try increasing this. This count is necessary when you have less light objects and most of lighting is done with skybox.
  • Min/Max Bounces: 1 for min and 2 for max is default and good enough for outdoor environments. You may need to experiment with this value if your environment is mostly indoors with dark areas, which will utilize bounce calculations more effectively.
  • Filtering: Auto is the default, and we do not recommend setting this manually because it’s very easy to create noise or artifacts.
  • Lightmap Resolution: 30 texels per unit is relatively good, but this varies depending on your environment’s physical dimensions. The Spatial Public Park environment has 37 and it has 8 of 1k lightmaps. The Spatial Agora environment has 27 and it has 9 of 2k lightmaps and 1 of 1k lightmap. You need to find the best number and it is important for efficient use of lightmaps. The larger your environment is, the lower your lightmap resolution will have to be, since having too many lightmap textures will use too much memory.
  • Max Lightmap Size: Note that Unity bakes lightmaps per object. So if there’s not enough space for the lightmap to bake the object, Unity will create another lightmap so 1024 could waste more pixels than 2048. And if one object is very large, 1024 could be too small to bake details. (Unity will fit it to the max size). 4096 could take too much bandwidth for mobile devices, so 2048 is relatively good.
  • Lightmap Compression: This compression option will just set the texture compression to ETC2 or DXT5. We’d recommend to use ASTC (ASTC6x6 or 8x8) instead. You can change the format manually in the texture settings after baking. (Note that once you bake lightmaps again, Unity will overwrite the format by this setting.)
  • Directional Mode: Currently, only Non-directional is supported. Directional lightmaps will produce incorrect results.
  • Lightmap Parameters: Use ‘Very Low’ when testing and ‘Medium’ will be enough for final. (’High’ if you’re a perfectionist. But it’s hard to notice the difference.)

Tips

Note that for objects to be included in the baked lightmap, they have to be marked as “Static”. Lighting Static Setting

Troubleshooting - Asset Import Utility

To help creators optimize their builds to smoothly across all Spatial-supported devices, we introduced the Asset Import Utility in July 2023. In some instances it may cause unintended optimization of some project files and textures. Check out the Asset Import utility documentation for help with troubleshooting these optimization changes.

Lighting FAQ

Lighting & Rendering