Author: http://www.cnblogs.com/open-coder/p/3898159.html
The light mapping effects between PC and Mobile become very incosistant just as following:
![]() | ![]() |
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:
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.
本文探讨了在Unity3D中,PC与移动平台(如Android)上光照贴图效果不一致的问题。主要原因在于光照贴图编码时使用的高动态范围不同,导致亮度差异。文章提出了解决方案,包括保持光照贴图颜色范围在[0,2]内,以及使用RGBM编码在移动端保持光照贴图的一致性。


1万+

被折叠的 条评论
为什么被折叠?



