Unity Tools Lightmapper

From BallisticNG Wiki
Jump to: navigation, search

This article is a stub. You can help BallisticNG Wiki by expanding it.

  • This page covers the "Vertex Lightmapper", which is about calculating & saving lighting values.
  • Unity lighting is a separate concept & is covered in Unity Lighting.
  • Lightmaps are outside the scope of this documentation (see Wikipedia's explanation).

"Vertex lightmapper"?[edit | edit source]

Simple explanation: A button that "saves" lighting for a track.

Technical explanation: It's a custom written library for baking lighting and the version built into BallisticNG is a specialized version.

If you would like to use this lightmapper for general purposes, you can purchase it for cheap here.

Baking light[edit | edit source]

Your Unity scene already comes with light, so we can jump straight into calculating & "saving" this lighting.

Click "BallisticNG > Vertex Lightmapper"

Vertex Lightmapper menu item

And click "Bake".

Vertex Lightmapper window

Remarks[edit | edit source]

  • Ships will appear black in-game until you bake lighting.
  • "Adding light sources" means positioning & configuring lights in the 3D world, whereas "baking lighting" means calculating the actual light values & saving them into a track file.
  • BallisticNG only uses light values calculated from the Vertex Lightmapper.
  • BallisticNG does not use light values calculated from the traditional Unity light process.
  • Remember to save your Unity scene after baking

Did it work?[edit | edit source]

After clicking "Bake", you may not receive any visual feedback indicating that it ran successfully.

This is because the lightmapper code is extremely fast, & your Unity scene is very simple.

In complex Unity scenes, clicking the button actually shows a progress bar.

The lightmapping progress window

In simpler Unity scenes, as long as:

  • You are sure you clicked the "Bake" button
  • The progress window is not shown (& therefore has closed)

Then it is safe to assume it ran SUCCESSFULLY & that the track now has lighting.

Skydomes[edit | edit source]

Make sure your sky mesh has a "Lightmapping Options script" attached, with it set to:

  • Ignore the lightmapper
  • All shadow options turned off

Lightmapping options script settings

Troubleshooting[edit | edit source]

If the progress window becomes stuck & doesn't close, it means the lightmapper got stuck.

This can happen if you:

  • Remove scenery objects between bakes
  • Accidentally add the "track floor" Ballistic Mesh Collider script to a scenery object
  • Add prefabs from the Unity Asset store, which have very complex geometry

Restart Unity and see if you can re-bake again. If you still can't bake:

  • Close unity, backup your Unity project folder, re-open the project & start removing objects from your Unity scene 1-by-1, until you can bake lighting again
  • Open the Unity Console & read the error message to determine the root cause