Question by
jni97 · Jan 18, 2016 at 01:18 PM ·
shadertexture2dshader programmingshaderlab
Shaderlab copy a texture value
Hi, I don't have much experience with shaders. Now I want to copy the value of _MainTex to _MainTex2... How is that possible?
Shader "Custom/Stein" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
[HideInInspector] _MainTex2 ("Base (RGB)", 2D) = "white" {}
[HideInInspector] _MainTex3 ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0
sampler2D _MainTex;
_MainTex2 = _MainTex {};//This is the line there I need your help(I want to copy the _MainTex)
struct Input {
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
Comment