I'm not that good at shaders and this is the shader i've done so far: Code (CSharp): Shader "DecoSim/Display" { Properties { _Blend ( "Blend", Range ( 0, 1 ) ) = 0.5 _MainTex ( "Texture 1", 2D ) = "white" {} _Texture2 ( "Texture 2", 2D ) = "" } SubShader { Tags { "RenderType" = "Transparent" "Queue" = "Transparent"} LOD 200 Cull Off ZWrite Off Blend SrcAlpha OneMinusSrcAlpha ColorMask RGB Pass { SetTexture[_MainTex] SetTexture[_Texture2] { ConstantColor ( 0, 0, 0, [_Blend] ) Combine texture Lerp( constant ) previous } } CGPROGRAM #pragma surface surf Lambert alpha sampler2D _MainTex; sampler2D _Texture2; float _Blend; struct Input { float2 uv_MainTex; float2 uv_Texture2; }; void surf ( Input IN, inout SurfaceOutput o ) { fixed4 t1 = tex2D( _MainTex, IN.uv_MainTex); fixed4 t2 = tex2D( _Texture2, IN.uv_Texture2); o.Albedo = lerp( t1, t2, _Blend ); } ENDCG } FallBack Off } I'm trying to add a rotation value for both _MainTex and _Texture2 that rotate around the center or an offset. I've tried some matrix-rotation shaders i found online, But each method i've implemented only works for one of the textures or the texture rotates along the bottom right. I'd be super glad if anyone could help me with this.
Is there any reason you need to have different UVs for each texture? It looks like you're just fading between two textures, so presumably they're both sharing the same UVs. If you plan on having them match, remove uv_Texture2 from the surface shader Input struct and use IN.uv_MainTex for both tex2D function calls. For rotating the texture there are several threads on the forums on this, and if they're not working it means there may be something different about your setup that you're not explaining here. However short version to rotate around an offset is to subtract that offset, apply the rotation, then add the offset back. Most examples use 0.5 as that's the middle of the 0.0 to 1.0 range UVs use for a whole texture. For surface shaders you can do that with a custom vertex function: https://forum.unity.com/threads/rotating-a-single-texture-and-not-the-whole-uv.359526/#post-2328017 One thing is your shader is using a fixed function pass and a surface shader. What's the purpose of having both? You cannot rotate textures within a fixed function shader, so if you want to use that you have to modify the base mesh's UVs. However support for fixed function shaders is actually deprecated in Unity and they get converted into vertex fragment shaders anyway.
The textures definetly need to have separate UVs or at least be able to scale and offset them separately. The same would apply to rotation too, independent rotation for both textures. I've had only little succes so far and i have no clue what i'm doing.
So the question I would have is around what point do you want the textures to rotate? Do you want this rotation to be done before or after the scale and offset? If you want it before, the custom vertex function example in my previous post is 90% of the code you need. Copy texcoord to texcoord1 and apply different rotation matrices to each. I use a constant offset of 0.5 for that example, replace that with a two float2 values (or a Vector property and use the xy and zw components for each texture's rotation offset) Then in the Input struct use uv2_ for the second texture instead of uv_ which will cause it to use the newly overridden texcoord1. (Yes, uv2_ == texcoord1 and uv_ == texcoord.) If you want it to be rotated after, then you can do the rotation in the surf function.
I'm trying to set the rotation in after offsetting. I'm currently trying your method posted above, Where would i put uv_== texcoord to?