Jerky Procedural Material Animation

I am trying to animate a procedural material “Electric Liquid”. I was able get the material animated but the animation is jerky (looks like a “framerate” of under 10) while the frame rate in the stats window shows well above 200.

I also looked at the Procedural material animation update rate, and even that was above 40+.

I know the animation can be smooth as silk and beautiful, but how do i get it there? What am I doing wrong?

There are very few objects in the scene.


using UnityEngine;
using System.Collections;

public class liquidEnergyAnimC : MonoBehaviour {

    public ProceduralMaterial substance;
    public float flow = 1;

    void Start()
       substance = renderer.sharedMaterial as ProceduralMaterial ;     

    void LateUpdate()
       flow = flow + (2 * Time.smoothDeltaTime); 
       substance.SetProceduralFloat("Flow", flow);

We figured this out, for everyone interested. The reason that the animation was jerky (for us any way) was that the value that we were exposing and using (via the .SetProceduralFloat(…)) was in the beginning of our node graph in substance designer. So what happened was that we would increase/decrease the value for that float in code, then the substance generator would have to push it all the way down the render pipe, performing all the math and calculations that come with that. So, we had our artists get creative and figure out a way to move it towards the output node in substance designer. So now, that float variable is one of the last nodes to be calculated by the substance, before it outputs, making it so that most of the work is done before hand! Therefore, the texture generation is significantly faster and the animation plays very, very smooth. I’m the programmer, not the artist, so I’m not sure what kind of tricks were used in order to perform the operation later on in the graph, but that is what solved the problem. The farther a node is from the output, the more things need to be performed on this node, making it longer to generate the texture (and when moved in code, appear jerky). Hope this helps!!

Try using RebuildTexturesImmediately function instead of RebuildTextures.