I am trying to use a projector to create cloud shadows in my scene and have them slowly move across the scene. I have the projector in there and the texture on there and its working but I can not get the animated offset to work.
This is my offset code C#
float offsetSpeed = 10F;
Projector proj; // projector game object
void Start ()
{
proj = GetComponent();
}
void Update ()
{
float offset = Time.time * offsetSpeed; // speed controlled by offestSpeed
proj.material.SetTextureOffset ("_ShadowTex", new Vector2(offset,offset)); //offsets the texture
}
Now this code does work it, it sets the offset numbers in the shadow material into a Tizzy but nothing actually moves besides those numbers. I suspect that there is something wrong in the shader that is either clamping the UVs or just nothing there to tell it to move.
This is the shader code, I’m stuck on this one and I am having trouble finding information on the shaders or this specific problem
Shader “Projector/Multiply” {
Properties {
_ShadowTex (“Cookie”, 2D) = “gray” { TexGen ObjectLinear }
_FalloffTex (“FallOff”, 2D) = “white” { TexGen ObjectLinear }
}
Subshader {
Tags { “RenderType”=“Transparent-1” }
Pass {
ZWrite Off
Fog { Color (1, 1, 1) }
AlphaTest Greater 0
ColorMask RGB
Blend DstColor Zero
Offset -1, -1
SetTexture [_ShadowTex] {
combine texture, ONE - texture
Matrix [_Projector]
}
SetTexture [_FalloffTex] {
constantColor (1,1,1,0)
combine previous lerp (texture) constant
Matrix [_ProjectorClip]
}
}
}
}
Any help on this would be greatly appreciated or a direction of where to look for more information.
Thank you