All Projects → laurenth-personal → Lightmap Switching Tool

laurenth-personal / Lightmap Switching Tool

Licence: mit
Tool that allows switching different baked lightmap sets on a unity scene at runtime.

Projects that are alternatives of or similar to Lightmap Switching Tool

Contactshadows
Experimental implementation of contact shadows for Unity.
Stars: ✭ 219 (-42.52%)
Mutual labels:  unity, unity3d, lighting
Fontainebleaudemo
Fontainebleau demo
Stars: ✭ 524 (+37.53%)
Mutual labels:  unity, unity3d, lighting
Vectorfieldexamples
Unity VFX Graph examples with vector fields
Stars: ✭ 370 (-2.89%)
Mutual labels:  unity, unity3d
Timelineparticlecontrol
An example of controlling particle system from timeline.
Stars: ✭ 348 (-8.66%)
Mutual labels:  unity, unity3d
Hsv Color Picker Unity
HSV color picker for Unity UI
Stars: ✭ 355 (-6.82%)
Mutual labels:  unity, unity3d
Akvfx
Azure Kinect plugin for Unity VFX Graph
Stars: ✭ 366 (-3.94%)
Mutual labels:  unity, unity3d
Unityfx.outline
Screen-space outlines for Unity3d.
Stars: ✭ 335 (-12.07%)
Mutual labels:  unity, unity3d
Kondo
Save disk space by cleaning non-essential files from software projects.
Stars: ✭ 373 (-2.1%)
Mutual labels:  unity, unity3d
Klakspout
Spout plugin for Unity
Stars: ✭ 332 (-12.86%)
Mutual labels:  unity, unity3d
Opencvforunity
OpenCV for Unity (Untiy Asset Plugin)
Stars: ✭ 359 (-5.77%)
Mutual labels:  unity, unity3d
Texture maker
A texture maker tool for unity.
Stars: ✭ 358 (-6.04%)
Mutual labels:  unity, unity3d
Unity2d Components
A constantly evolving array of Unity C# components for 2D games, including classes for pixel art cameras, events & messaging, saving & loading game data, collision handlers, object pools, and more.
Stars: ✭ 375 (-1.57%)
Mutual labels:  unity, unity3d
Laspvfx
Audio reactive Unity VFX with LASP
Stars: ✭ 337 (-11.55%)
Mutual labels:  unity, unity3d
Unity3dcrosssectionshader
CG shader for unity3D to create a cross section through meshes
Stars: ✭ 333 (-12.6%)
Mutual labels:  unity, unity3d
Starforce
This is a demo made with Game Framework.
Stars: ✭ 375 (-1.57%)
Mutual labels:  unity, unity3d
Water2d Unity
A simple shader + example of a water surface with reflection in 2D
Stars: ✭ 335 (-12.07%)
Mutual labels:  unity, unity3d
Retro3dpipeline
A minimal example of a custom render pipeline with the Retro3D shader.
Stars: ✭ 354 (-7.09%)
Mutual labels:  unity, unity3d
Unity Srp Vxgi
Voxel-based Global Illumination using Unity Scriptable Render Pipeline
Stars: ✭ 361 (-5.25%)
Mutual labels:  unity, unity3d
Dungeongenerator
A dungeon generator for Unity
Stars: ✭ 324 (-14.96%)
Mutual labels:  unity, unity3d
Crystalai
A Utility AI for C# and Unity
Stars: ✭ 328 (-13.91%)
Mutual labels:  unity, unity3d

Tool intended for switching pre-baked lightmaps, light probes and realtime lighting on a static scene at runtime.

Depending on the platform or depending on the content, the switch might not be instant but take some seconds, this script just allows you avoid duplicating your scene if you just want to change the lighting.

This version is compatible with unity 2019.3 and above, check previous releases for unity 5.5 - 5.6 version.

If you want to use lightmaps of different resolutions in your different lighting scenarios you will probably need to disable static batching in the PlayerSettings (if you use the same lightmap resolution on all your lighting scenarios and the object packing in the lightmap atlas doesn't change accross lighting scenarios it's ok to keep static batching enabled).

The system relies on this component :

LevelLightmapData It references the different lighting scenes, builds the lighting, and stores the dependencies to the lightmaps.

If your lighting scene contains Realtime/Mixed lights or Reflection probes, the script will consider it's necessary to load the lighting scene at runtime to replicate the full lighting. The lighting scene will thus need to be part of the "Scenes in Build" list in the Build settings (File/Build Settings).

How it works :

  • Make a scene with your static geometry only. Disable Auto baking (important). If you want to use lightprobes, also add a lightprobe group to the geometry scene.

  • Make several lighting scenes in your project. These scenes should not contain static geometry. The Lighting scene settings must not use auto baking.

  • Add your lighting scenes and your static geometry scene to your Build Settings scene list.

  • In your static geometry scene, add an empty gameObject and attach a LevelLightmapData component to it.

  • Fill the "lighting scenarios size" with the count of lighting scenarios you want, and in the "element" fields, either drag and drop scenes from your Project view or click the little point on the right of the field to choose a scene from your project

  • One by one, you can now Build the lighting scenario, and when the bake is done Store it. You need to do these steps in the lighting scenario order ( you have to build and then store lighting scenario 1 before lighting scenario 2 according to the order in the list). The first time it is crucial to do it in the right order, if you misclicked I'd recommend redoing the whole setup (click the wheel in the top right corner of the component and hit "reset" and do the setup again).

  • Now add an empty Gameobject to your scene and add a LightingScenarioSwitcher for previewing the switch

  • The Default lighting scenario field is the ID of the lighting scenario you want to load when you start playing. The ID is the number associated to the lighting scenario in the LevelLightmapData ( ID of the first element in the list is 0, next one is 1, etc ... )

  • Start playing -> When clicking ( left mouse button or Fire1 if you have changed the input assignments ) the lightmaps should switch between your different lighting scenarios.

  • Mixed lighting mode are supported (tested only "baked indirect" and "shadowmask")

  • Reflection probes supported, they need to be placed in the lighting scenes.

LATEST UPDATE :

  • Add editor script in order to cache and restore light probes from your currently open scene. Avoids dirtying the currently open scene.
  • Remove lightmap switcher script and use on screen Buttons to demonstrate the lighting switch in the project.
  • The path to the lighting scenes is no longer hardcoded
  • The UI of the level lightmap data is slightly nicer (not a big change)
  • Add note about scenes needing to be in the build settings scene list

Contributions :

  • Thanks to Kretin1 for his effort on shadowmask support.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].