Inconsistant light map between PC and Mobile under Unity3D

Author: http://www.cnblogs.com/open-coder/p/3898159.html

The light mapping effects between PC and Mobile become very incosistant just as following:

Android_Lightmap PC_Lightmap

With the same light maps, the left one is the Android Platform, and the right one is the PC Platform. But the right one is much brigher than the left one.
Why? ????????????
Let check the Unity3D light map decode function:
lightmap_range
The reason is that the light map encode use High dynamic range encode. The range on the PC is [0, 8], but the range on the Mobile will only in [0, 2].
That means the when you switch the platform from PC to Android, the light map color range will clamp to [0, 2] no matter what value it is.
And the best way to keep light map consistant on PC and Android is keep the light map color range in [0, 2].
Sometimes, we would like to multiply the light map color with a factor. I strongly suggest that please make sure this factor larger than 1.0 (Only bright is instead of darker it).

One altive method is also keep RGBM encode for light map on the mobile platform. Bake the light maps on the PC first, then retrieve those PC RGBM lightmaps out of the scene saved them as RGBM texture. Relink the scene light map setting with those RGBM textures.  Since we need a high precision for alpha channel, we need to save the alpha as another texture. That means we need two light maps on mobile device, one for RGB and another with one channel only to keep the M. The shader should be re-write too, Far and Near lightmaps could be keep as those two light map slots. Remember that here you need to keep a much higher precision for light intensity that value may more than 2, so you need to use at least half type variable to hold those immediate values in the shader.

posted @ 2014-08-07 22:06  opencoder  阅读(777)  评论(0编辑  收藏  举报