- Home /
How do I animate procedural textures?
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();
}
}
A screenshot is here: Inspector screenie
So what else do I need to do?
EDIT: it has a "Flow" value, but how do I change it?
Answer by dethskull · Feb 26, 2012 at 12:02 AM
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.
Answer by I9ball · Aug 27, 2012 at 07:13 PM
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();
}
}
Answer by KevinDamore · Sep 07, 2012 at 03:53 PM
Bump
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.
Answer by jasondwild · Nov 06, 2015 at 01:46 PM
Try using RebuildTexuresImmediately instead of just RebuildTextures.
Your answer
Follow this Question
Related Questions
is there a way to make a gradient material, white to black, in Unity3D? 2 Answers
How to create an procedural texture in shader graph for many objects, and save it? 0 Answers
Mapping a texture to a meshes normals? 0 Answers
Merging, Transitioning, or Blending from one texture to the other based upon Height Maps 0 Answers
Substance Dynamic Texture Size 2 Answers