Shader "Custom/RockShader"
{
Properties
{
_MainTex ("Main Texture", 2D) = "white" {}
_MainTex2 ("Main Texture", 2D) = "white" {}
_Metallic ("Metallic", Range(0,1)) = 1
_Smoothness ("Smoothness", Range(0,1)) = 1
_BumpMap ("NBumpMap", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
CGPROGRAM
#pragma surface surf Standard
//#pragma target 3.0
sampler2D _MainTex;
sampler2D _MainTex2;
sampler2D _BumpMap;
float _Metallic;
float _Smoothness;
struct Input
{
float4 color:COLOR;
float2 uv_MainTex;
float2 uv_MainTex2;
float2 uv_BumpMap;
};
void surf (Input IN, inout SurfaceOutputStandard o)
{
float4 bump = tex2D(_BumpMap, IN.uv_BumpMap);
float4 c = tex2D(_MainTex, IN.uv_MainTex);
float4 d = tex2D(_MainTex2, IN.uv_MainTex2);
float3 e = lerp(c.rgb, d.rgb, IN.color.r);
o.Normal = UnpackNormal(bump);
o.Albedo = e.rgb;
o.Metallic = _Metallic; //0 ~1
o.Smoothness = _Smoothness; //0 ~1
}
ENDCG
}
FallBack "Diffuse"
}
Shader "Custom/Axe"
{
Properties
{
_MainTexture ("Main Texture", 2D) = "white" {}
_Metallic ("Metallic", Range(0, 1)) = 1
_Smoothness ("Smoothness", Range(0, 1)) = 1
_BumpMap ("BumpMap", 2D) = "bump" {}
_OccTexture ("OccTexture", 2D) = "white" {}
_Occlusion ("Occlusion", Range(-2, 2)) = 0
}
SubShader
{
Tags { "RenderType"="Opaque" }
CGPROGRAM
#pragma surface surf Standard
#pragma target 3.0
sampler2D _MainTexture;
sampler2D _BumpMap;
sampler2D _OccTexture;
float _Metallic;
float _Smoothness;
float _Occlusion;
struct Input
{
float2 uv_MainTexture;
float4 color:COLOR;
float2 uv_BumpMap;
};
void surf (Input IN, inout SurfaceOutputStandard o)
{
float3 occ = tex2D(_OccTexture, IN.uv_MainTexture);
o.Albedo = tex2D(_MainTexture, IN.uv_MainTexture).rgb;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
//o.Emission = IN.color.rgb;
o.Metallic = IN.color.r * _Metallic;
o.Smoothness = IN.color.r * _Smoothness;
o.Occlusion = occ.r + _Occlusion;
}
ENDCG
}
FallBack "Diffuse"
}
Shader "Custom/Acc"
{
Properties
{
_MainTex ("MainTex", 2D) = "white" {}
_Smoothness ("Smoothness", Range(0,1)) = 1
_Metallic ("Metallic", Range(0,1)) = 1
_BumpMap ("BumpMap", 2D) = "bump" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
CGPROGRAM
#pragma surface surf Standard
#pragma target 3.0
sampler2D _MainTex;
sampler2D _Bumpmap;
float _Smoothness;
float _Metallic;
struct Input
{
float2 uv_MainTex;
float2 uv_BumpMap;
float4 color:COLOR;
};
void surf (Input IN, inout SurfaceOutputStandard o)
{
float3 c = tex2D(_MainTex, IN.uv_MainTex);
o.Normal = UnpackNormal(tex2D(_Bumpmap, IN.uv_BumpMap));
//o.Emission = IN.color.rgb;
//o.Albedo = lerp(c.rgb, 0, IN.color.r);
o.Albedo = c.rgb;
o.Metallic = IN.color.r * _Metallic;
o.Smoothness = IN.color.r * _Smoothness;
}
ENDCG
}
FallBack "Diffuse"
}
'유니티 > 수업 내용' 카테고리의 다른 글
[shader] 반짝거리기 (0) | 2022.01.18 |
---|---|
[Shader] BlinnPhong - Specular (0) | 2022.01.18 |
[Shader] Texture polybrush (0) | 2022.01.18 |
[Shader] Texture_Fire (0) | 2022.01.18 |
Shader Warning (0) | 2022.01.18 |