• Stars
    star
    118
  • Rank 298,527 (Top 6 %)
  • Language
    C#
  • License
    GNU General Publi...
  • Created over 4 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Unity Light Map Prefab Baker

Unity Lightmap Prefab Baker

The idea of prefab baker is to allow adding prefabs with baked lightmaps during play into the active scene

If you want to buy me a beer
Donate

Screenshots

Interface Example Bake Dark Scene Settings Lightmap files after bake

Usage

  1. Add "Prefab Baker" Script to any Game Object or Prefab
  2. Open baker window ( Window -> Prefab Baker )
  3. Bake !

How is it done ?

Unity will bake lightmaps for the current active scene, the resulted image files will be moved to the target prefab folder. The prefab baker script in the prefab object will store those lightmaps references relative to each rendered component inside the prefab alongside the index, UV's scale offset. Once the prefab is added to the scene it will scan the current existing lightmaps and add any missing lightmaps.

Notes:

  • Make sure the lighting settings of your bake scene will match your level scene ( same skybox light source and directional lights if any )

  • Quick bake was made for rapid lightmap prototyping which will use low quality for quick bake preview ( using this potions will not override the current scene lighting settings )

  • When baking multiple prefabs their lights will effect each others lightmaps if they are spaced closely together, its recommended to bake one prefab at a time to avoid this result or place the prefabs far away from each other.

  • Adding the script to an object which is not a prefab and clicking bake, will automatically convert the game object into a prefab and save it in the same folder as the current open scene

  • By default the lightmaps export folder will be located in Resouces/Lightmaps.

  • The lightmaps will be copied to a new folder inside the selected target folder. To avoid lightmap collisions, make sure all baked prefabs have unique names across the project.

Installation

Simply download the unitypackage file from here

Or add the following line to manifest.json file in your project packages folder (UnityProject/Packages/manifest.json)

"com.nukadelic.prefabbaker": "https://github.com/nukadelic/Unity-Lightmap-Prefab-Baker.git"

so it would look something like that :

{
  "dependencies": {
    "com.nukadelic.prefabbaker": "https://github.com/nukadelic/Unity-Lightmap-Prefab-Baker.git",
    "com.unity.collab-proxy": "1.2.16",
    "com.unity.ext.nunit": "1.0.0",
    "com.unity.ide.rider": "1.1.0",
    ...
  }
}

Or pull the project locally and use the Package Manager (Window>Package Manager), adding the package.json file present in the root of the folder with the + button.

Credit

This tools is based on few similar implementations that can be found on this thread:
https://forum.unity.com/threads/problems-with-instantiating-baked-prefabs.324514

footnote: feel free to open an issue if anything seems to be out of place.

More Repositories

1

UnityEditorIcons

Build in unity editor icons
C#
227
star
2

UnityGraphs

Visual graphs tool for unity editor
C#
91
star
3

unity-application-spacewarp

Template unity project preconfigured with ASW for the Oculus Quest 1 & 2 using a custom render pipeline
ShaderLab
58
star
4

GraphicsDraw

Unity Graphics Draw API wrapper for both play and edit mode
C#
18
star
5

Unity-Scene-Picker

Load all project scenes in runtime - useful for testing and prototyping on mobile - single file to rule them all
C#
12
star
6

Sphere-3d-Surface-Packing

Sphere 3d Surface Packing on any mesh in unity
C#
10
star
7

Unity-Procedural-Sound-Generation

Experimenting with procedural sound generation with in Unity3D
C#
8
star
8

ProximityDither

Distance based fader - a unity opaque shader using dither to fake transparency using alpha clipping
C#
7
star
9

UXRU

Unity XR Utilities
C#
6
star
10

SceneShortcutSwapper

Quickly open unity scenes using a keyboard shortcut
C#
6
star
11

raymarching-sandbox

Unity raymarching sandbox shaders in Cg
GLSL
3
star
12

UnityGit

collection of common scripts and shaders for unity
C#
3
star
13

RemoteJsonImageViewer

Unity Remote Json Image Viewer ( PNG + SVG )
ShaderLab
3
star
14

Unity-XR-Controllers

C#
2
star
15

CheatSheet

My public notebooks
C#
2
star
16

MarchingCubesBurst

smooth marching cubes algorithm running on the unity engine with a burst compiler + multi threading
C#
2
star
17

AnimationDataExtractor

Extract Unity Aniamtion Clip curve data to an asset that can be accessed and edited in runtime
C#
2
star
18

UnityCheatSheet

Unity3D Cheat Sheet
C#
1
star
19

mlagents-sdk-0-14-1

unity machine learning sdk - upm package for version 0.14.1
C#
1
star
20

Unity-Cardboard

C#
1
star
21

MLAgentsTemplate

Latest Unity ML-Agents standalone template
C#
1
star
22

blender_bpy_scripting

Collection of blender scripts
Python
1
star