Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jite

Pages: [1]
1
NGUI 3 Support / Re: [Solution] Using NGUI in linear lighting
« on: March 23, 2015, 10:16:28 AM »
Accidentally found it today in Unity 4.6.0. :) Don't know about older versions. Before I used this solution with power bigger than 2.2.

2
NGUI 3 Support / Re: [Solution] Using NGUI in linear lighting
« on: March 23, 2015, 07:59:10 AM »
May be better use that?
Without checking "Bypass sRGB Sampling" in texture.
In UIBasicSprite:
  1. Color32 drawingColor
  2.     {
  3.         get
  4.         {
  5.             Color colF = color;
  6.             colF.a = finalAlpha;
  7.             if (premultipliedAlpha) colF = NGUITools.ApplyPMA(colF);
  8.  
  9.             if (QualitySettings.activeColorSpace == ColorSpace.Linear)
  10.             {
  11.                 colF.r = Mathf.GammaToLinearSpace(colF.r);
  12.                 colF.g = Mathf.GammaToLinearSpace(colF.g);
  13.                 colF.b = Mathf.GammaToLinearSpace(colF.b);
  14.             }
  15.             return colF;
  16.         }
  17.     }
  18.  

It used variable power. For example, values from tests:
RGBA(0.216, 0.216, 0.216, 1.000) => RGBA(0.038, 0.038, 0.038, 1.000)   PowerRGB(2.128869, 2.128869, 2.128869)
RGBA(0.235, 0.843, 0.784, 1.000) => RGBA(0.045, 0.680, 0.578, 1.000)   PowerRGB(2.140385, 2.26423, 2.259379)
RGBA(0.902, 0.255, 0.235, 1.000) => RGBA(0.791, 0.053, 0.045, 1.000)   PowerRGB(2.268569, 2.15096, 2.140385)
RGBA(0.051, 0.157, 0.180, 1.000) => RGBA(0.004, 0.021, 0.027, 1.000)   PowerRGB(1.853064, 2.079946, 2.1021)

where PowerRGB from condition: correctedColor.r = Mathf.Pow(originalColor.r, PowerRGB.r); //same for g, b

Mathf.GammaToLinearSpace() graphics

4
UICheckboxControlledComponent not work if on this object UICheckbox.eventReceiver setted (any object)

I understand why is this happening - by default eventReceiver is self, and UICheckboxControlledComponent receive messages. After setting another eventReceiver link break up.

May be better to make the transmission of messages for UICheckboxControlledComponent independent of the eventReceiver variable. I.e. always send OnAction message to self?

Pages: [1]