Quantcast
Channel: Answers by "scottharber"
Viewing all articles
Browse latest Browse all 18

Answer by scottharber

$
0
0
More info (and a code fix!): The issue itself lies within the DecodeLightmap function in the shaders. In UnityCG.cgInc, there are two code paths that define what to do with the lighting; one for RGBM, and one that just doubles the brightness of an LDR lightmap. inline half3 DecodeLightmap( fixed4 color ) { #if defined(UNITY_NO_RGBM) return DecodeLightmapDoubleLDR( color ); #else return DecodeLightmapRGBM( color, unity_Lightmap_HDR ); #endif } As far as I can tell, the function presumes RGBM at all times when using baked lightmaps, but mobile re-compresses all lightmaps into double LDR. So if you're using custom shaders, you can avoid changing the "Texture Type" settings on the lightmaps by using this code. #if !UNITY_STANDALONE_WIN DecodedLightMap = 2.0f * UNITY_SAMPLE_TEX2D(unity_Lightmap, IN.uv1.xy); #else DecodedLightMap = DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, IN.uv1.xy)); #endif

Viewing all articles
Browse latest Browse all 18

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>