Git Product home page Git Product logo

unity-lightmap-prefab-baker's Introduction

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.

unity-lightmap-prefab-baker's People

Contributors

nukadelic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.