Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Lightmapping and iOS Shaders Guidelines

Discussion in 'Shaders' started by BigToe, Oct 7, 2014.

  1. BigToe

    BigToe

    Joined:
    Nov 1, 2010
    Posts:
    204
    I am able to successfully create light maps, but still feel uneasy with how the light map is actually applied and which shaders I should be using for mobile/iOS development.

    When lightmapping for mobile, should I still be using specific mobile shaders to set up the bake, or can I use standard diffuse and other shaders?

    Does the light map get applied on top of the currently used shaders, or does it replace them completely with some magical Beast shader? (In the Angry bots demo, I noticed that the light-maps contained color info and my current maps currently seem just to contain greyscale values, so this was adding to some of my confusion.)

    Are there any guidelines for how big the lightmaps should be for mobile? Are they handled the same as regular textures in regard to memory, or are they optimized in someway?

    Thanks in advance!
     
  2. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    Almost all Unity shaders (including the mobile ones) include light map support. Bake with the shaders you intend to ship with. Under the hood, the shaders are all compiled into versions which support light maps, and versions which don't use them.

    Coloured light maps are usually the result of coloured lights.

    Light maps are just textures. You can see how many are being used in a scene by looking in the Lightmap pane in the editor. As always, profile your game on the worst hardware you intend to support.
     
    BigToe likes this.
  3. BigToe

    BigToe

    Joined:
    Nov 1, 2010
    Posts:
    204
    Thanks for the helpful info Daniel. One more clarification if you don't mind.You say the lightmaps are just textures, does that mean the textures from the lightmap replace the existing textures on the materials, or is the shading from the lightmap applied in some sort of a transfer mode on top of the current shaders/textures, effectively combining the two shaders/textures?

    Thanks!

     
  4. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    A shader that supports light maps will add the light them to the lighting result (which takes dynamic lights and ambient light into account) before multiplying the lighting result with the base texture.
     
    BigToe likes this.
  5. BigToe

    BigToe

    Joined:
    Nov 1, 2010
    Posts:
    204
    Thanks!! Clears it up for me what is going on, which allows me to move forward and work with them more confidently. Much appreciated.