[SOLVED] Obtaining Light scale inside Shaders

Background
I’m attempting to do realtime fake spherical area lights. In order to do that, I need to pass into my shaders a parameter for the light’s size. Since light inputs are limited to what Unity already passes in, I need to re-purpose a channel for my own use. It appears that in Unity, the light transform scale isn’t currently used for anything, so it seems like the best candidate right now.

Question
Is there any way to obtain a Point/Spot light game object’s transform scale inside a surface shader and a deferred prepass override shader?

What is “light scale”, color vector magnitude? Anyway seems you may use “_LightColor0.a”.

_LightPos.w ???

For anyone who is curious, here is the answer. The approach is different depending on where you are trying to obtain it. For example:

Forward shader passes
http://forum.unity3d.com/threads/ge…ight-in-forward-add-mode.213430/#post-1433291

Please note, it may not be super expensive but it certainly isn’t free. To alleviate that, I strongly recommend doing this calculation in your vertex shaders and transferring the result to the pixel shader via interpolators.

Deferred override shader
range = rsqrt(_LightPos.w);

This works since the constant “_LightPos” stores “1 / (range * range)” in its “.w” channel.