Search Unity

Copy Lightmap issue

Discussion in 'Global Illumination' started by ShuraK, Jul 18, 2015.

  1. ShuraK

    ShuraK

    Joined:
    Jan 15, 2015
    Posts:
    23
    In our project, we create a copy of baked lightmap into PNG Texture(using Texture.Getpixels and SetPixels).

    So the artists can ajust the texture if he wants.

    we use the copied texture in our game, using LightmapSettings.LightmapData

    This was all fine In unity 4.6. Although the copied texture looks different with the original lightmap, but after decodelightmap() in unitycg.inc, the scene looks the same as with the original lightmap.

    However, in unity 5.0, it's changed. If we apply a copied Texture as lightmap, the scene will look totally different !!

    so, my question is , how to copy a lightmap into texture and use the texture for lightmapping while keeping the scene unchanged ?

    Thanks for your time
     
  2. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    It is probably due to encoding. On some platforms the lightmaps are RGBM encoded and on mobiles they are dLDR encoded. Try setting the texture import properties on your PNG to 'Lightmap'. Also, make sure you are using the correct decode function.