Updating Color temp at runtime?

I have a project using the Standard Renderer - forward rendering since its a VR project. Using 2019.1.12f1.

I have a 2 realtime lights that effect a dynamic object in the scene. Both have color temperature turned on and tuned to a specific temp (2700 and 6500). I have a small interactive dial that the user can turn that adjust the color temperature. I can see the value changing in the inspector but the color does not actually change until I move the object either via VR controller or via the inspector. I’ve spent the last 4 hours trying to figure out WHY this is happening and have confirmed there are NO other scripts running against the lights or the gameobject itself.

Anyone run into anything like this?

Does the same issue reproduce when trying to modify the light color as opposed to the color temperature during runtime? If it does not, then please submit a bug using Unity’s in-built bug reporter and paste the case ID here. A minimal repro project attached to the case would help as well. Thanks.

Changing color at runtime works fine. Just color temp. However, I solved this in a very unexpected way. Changing the lights to mixed mode from realtime they now work properly. I’m not using indirect lighting so for this project it isn’t an issue.

Thanks!

1 Like

@kristijonas_unity - Issue has returned despite no updates or any major changes to the project. I tried to reproduce in a new project but I can’t seem to expose the color temp field anymore.

This was an issue when the lights were set to realtime and the object they are attached to are not moving. If the object is not moving and the color temp changes no visual change happens until the object moves again. The lights are on a special layer and set to only effect that layer (which the objects are also on).

Code is pretty straight forward -
void Start()
{
GraphicsSettings.lightsUseLinearIntensity = true;
GraphicsSettings.lightsUseColorTemperature = true;
dial = GetComponent<VRTK_ArtificialRotator>();
dial.ValueChanged += new VRTK.Controllables.ControllableEventHandler(SetColorTemp);
}
private void SetColorTemp(object sender, ControllableEventArgs e)
{
GraphicsSettings.lightsUseLinearIntensity = true;
GraphicsSettings.lightsUseColorTemperature = true;
//calculate value to color temp (range 2700 - 6500)
float colorVal = Mathf.Lerp(2700, 6500, e.value / 100);
//set both lights color temp value to new value
if(lamps.Length > 0)
{
for(int i = 0; i < lamps.Length; i++)
{
lamps*.colorTemperature = colorVal;*
}
}
}
Any ideas?