I was trying to rotate the texture by setting the matrix, the shader that I used was the diffuse shader with a pass that sets the matrix.
I’m not familiar with shader at all so the I just edited as less as I could
Shader "Diffuse" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Pass{
SetTexture[_MainTex]
{
Matrix[_Matrix]
}
}
Fallback "VertexLit"
}
and I used the below code for rotation
AccumulatedTime += Time.deltaTime * Speed;
Matrix4x4 matrix = Matrix4x4.TRS(Vector2.zero, Quaternion.Euler(0, 0,AccumulatedTime), tiling);
renderer.material.SetTextureOffset("_MainTex", Offset);
renderer.material.SetMatrix("_Matrix1", matrix);
But the problem is that first: the shader then kills all lighting.
Second problem is it only rotates the texture based on a corner probably (0,0), I wanted to rotate the texture from the center, so I thought maybe changing the UV would work…
Any ideas? Sorry for being such a noob about shaders.