How to change this Shader lit to unlit?
hello guys, I have found this awesome shader to rotate the matrix on the material, but I cant figured out how to get this thing in unshade way. what I need to replace or add? I need that the black hole have a rotate texture but in unshade way. here is the shader:
Shader "Custom/RotateUVs" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_Color ("Alpha", Color) = (1,1,1,1)
_RotationSpeed ("Rotation Speed", Float) = 2.0
}
SubShader {
Tags { "RenderType"="Transparent" "Queue" = "Transparent" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert vertex:vert
sampler2D _MainTex;
float4 _Color;
struct Input {
float2 uv_MainTex;
};
float _RotationSpeed;
void vert (inout appdata_full v) {
v.texcoord.xy -=0.5;
float s = sin ( _RotationSpeed * _Time );
float c = cos ( _RotationSpeed * _Time );
float2x2 rotationMatrix = float2x2( c, -s, s, c);
rotationMatrix *=0.5;
rotationMatrix +=0.5;
rotationMatrix = rotationMatrix * 2-1;
v.texcoord.xy = mul ( v.texcoord.xy, rotationMatrix );
v.texcoord.xy += 0.5;
}
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb * 1;
o.Albedo *= _Color.rgb;
o.Alpha = _Color.a;
}
ENDCG
}
FallBack "Diffuse"
}
thanks in advance guys.
go to unity archive. Download Unity default shader. They have unlit-lit shader in those folder.
All you have to do is compare both of these shader code. And figure the that 1 line of code make your shader become unlit.
I know it is related to #pragma surface surf Lambert vertex:vert
. But I am not sure what is unlit surface.
yeah, I have tried that, but I cant get it works, I tested with :
#pragma surface surf NoLighting
and:
fixed4 LightingNoLighting(SurfaceOutput s, fixed3 lightDir, fixed atten)
{
fixed4 c;
c.rgb = s.Albedo;
c.a = s.Alpha;
return c;
}
but I lose the rotation of the shader.
i am sorry it was not about surface. I just skim through unity unlit tutorial.
https://unity3d.com/learn/tutorials/topics/graphics/anatomy-unlit-shader
Try to add their frag and vert function
Answer by joan_stark · Feb 18, 2021 at 11:06 PM
I don't really know, but where did you find this shader?
Your answer
Follow this Question
Related Questions
Unlit shader not showing color in main preview 0 Answers
How to Change the Shader Color? 0 Answers
A problem with a shader to make a window transparent 0 Answers
Getting Color Generated from Shader to Script to Shader 0 Answers
Volumetric Light with VR in URP have a weird clipping... Any ideas? 0 Answers