I want to animate the “Electric_Liquid” procedural texture found in the “Substances_Free” pack in the Unity asset store.
My script currently looks like this:
renderer.material.shader = Shader.Find("Diffuse");
var flowval:float=0;
function Update () {
var substance : ProceduralMaterial = renderer.sharedMaterial as ProceduralMaterial;
if (substance) {
flowval=flowval+Time.deltaTime;
substance.SetProceduralFloat("Flow",flowval);
substance.RebuildTextures();
}
}
In c#, my code looked similar to yours, except I update flowVal right away in update using:
flowVal = flowVal + (flowSpeed * Time.deltaTime);
It might be that your not changing the flowVal fast enough to see it.
I was able to get Electric Liquid material to animate (dropped script on the object with the material) as a C# script but the animation is jerky (under 10) while the frame rate is well above 200.
I also looked at the Procedural material animation update rate is above 40+.
What am I doing wrong?
Thanks
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);
substance.RebuildTextures();
}
}
I’m having the same problem with animating lava flow.
I’m thinking the key is to find out what they did for the cockroaches in the airstream demo because that is the smoothness I expect to achieve. I’m not sure if it is something you have to do in substance designer or unity. They only include the .sbsar files in the airstream so I couldn’t view the graph for the cockroaches.