8
|
1 Shader "Custom/ImageChanger" {
|
|
2 Properties {
|
|
3 _Color ("Color", Color) = (1,1,1,1)
|
|
4 _MainTex ("Texture", 2D) = "white" {}
|
|
5 _Glossiness ("Smoothness", Range(0,1)) = 0.5
|
|
6 _Metallic ("Metallic", Range(0,1)) = 0.0
|
|
7 }
|
|
8 SubShader {
|
|
9 Tags { "RenderType"="Opaque" }
|
|
10 LOD 200
|
|
11
|
|
12 CGPROGRAM
|
|
13 // Physically based Standard lighting model, and enable shadows on all light types
|
|
14 #pragma surface surf Standard fullforwardshadows
|
|
15
|
|
16 // Use shader model 3.0 target, to get nicer looking lighting
|
|
17 #pragma target 3.0
|
|
18
|
|
19 sampler2D _MainTex;
|
|
20
|
|
21 struct Input {
|
|
22 float2 uv_MainTex;
|
|
23 };
|
|
24
|
|
25 half _Glossiness;
|
|
26 half _Metallic;
|
|
27 fixed4 _Color;
|
|
28
|
|
29 void surf (Input IN, inout SurfaceOutputStandard o) {
|
|
30 // Albedo comes from a texture tinted by color
|
|
31 fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
|
|
32 o.Albedo = c.rgb;
|
|
33 // Metallic and smoothness come from slider variables
|
|
34 o.Metallic = _Metallic;
|
|
35 o.Smoothness = _Glossiness;
|
|
36 o.Alpha = c.a;
|
|
37 }
|
|
38 ENDCG
|
|
39 }
|
|
40 FallBack "Diffuse"
|
|
41 }
|