Unity技术分享Unity教程合集

环境光插值

2015-12-17  本文已影响31人  Babybus_Unity

Babybus-u3d技术交流-环境光插值

上次写的动态混合光照贴图 [http://10.1.1.12/u3d/?id=72

奇奇不受光照贴图影响,关窗关窗的时候亮度不变很奇怪,所以需要对环境光也做插值。

RenderSettings.ambientLight = Blend2Color(brightAmbientLight, darkAmbientLight, t);

 
private Color Blend2Color(Color from, Color to, float t)
{

   Color blend;

 
    blend.r = from.r * (1 - t) + to.r * t;

    blend.g = from.g * (1 - t) + to.g * t;

    blend.b = from.b * (1 - t) + to.b * t;

    blend.a = from.a * (1 - t) + to.a * t;

 
    return blend;
}
上一篇 下一篇

猜你喜欢

热点阅读