Animating Emission Intensity on a material on an object no worky

This is using Unity 2020.2.5f1, using HDRP.

I am trying to use timeline to animate the emission intensity on a material. I can see the emission intensity numeric value changing when I move the time during preview. The value is changing from 0 to 50000 on a curve and I can see the emission intensity value box is red to indicate it is animated, and the value changes when I change the time. However, the actual material rendering in either the editor scene window or the game window does not change at all.

If it makes any difference, this material is on 4 objects in the game. None of them changes visually during the timeline animation.

Please help.

Update - I just tried to animate the base color and it worked! The base color is animating. The emission intensity still does not animate. Why does emission intensity animation not work?

Ok… playing around with it some more - it seems like animating material emission does not work when “Use Emission Intensity” is checked. If you leave it unchecked and animate Emissive Color instead, it works. Sigh.

1 Like

@ Thoughts?

Yes I would like some clarification as well. I've spent hours chasing my tail on this issue, and it seems to have been fundamentally broken for many years (when searching for answers) without any kind of input from the Unity team.

The workaround listed at bottom of the page here by DavidDreamer was very helpful.

https://discussions.unity.com/t/755446/14

That works well enough to work around the bug and adjust intensity via code, but I cannot get it to then also work with an animation clip. Driving me completely insane.

Emission_Intensity seems to be absolutely and fundamentally broken, and I'd really like to see someone say they are working on fixing it.

I am not sure if I understood the issue correctly, but if what you are lookin for is to be able to change the emission intensity purely via animation clip, have you tried enabling the keyframe recording mode and changing the emission intensity directly from the inspector? At least, that’s how I solved my problem with animating the intensity.

I had a similar problem and had to create a script to get the material and enable the emission to work around it:

using UnityEngine;

//[ExecuteInEditMode]
public class EnableMaterialEmission : MonoBehaviour
{
    private Material mat;

    private void Awake()
    {
        mat = GetComponent<MeshRenderer>().sharedMaterial;
        mat.EnableKeyword("_EMISSION");
    }
}

Or you can create your own shader, I only had this problem with the default shaders.

I was running into this today in HDRP, and found this page (HDRP-specific) that may explain why this property seems to be broken with respect to animation:

https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@12.0/manual/adjusting-emissive-intensity-at-runtime.html

The gist is, _EmissiveIntensity isn’t used at runtime. It’s only used to serialize the emission color. So, it’s confusing that this property can’t be adjusted at runtime, but it’s not a bug, it’s by design. I’m not sure if this is exactly the same using SRP or URP.

In any case, the guidance on that page is probably the same for all render pipelines: You can’t animation the _EmissionIntensity. Instead, you need to multiply the color by the intensity manually via code. Probably the best option is to animation some property on a script and have the script constantly update the color via mat.SetColor().

I worked around it by creating a custom shader in Shadergraph that uses a vector4 node with a multiply node to control the intensity. This way I can animate the axis values on the exposed vector4 to increase RGBA intensity and or colour in realtime in the editor or via a slider or anim clips etc. It ended up having several benefits to the other workarounds for me.

But thanks for the link.

1 Like