Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "EMCLICK/TassellationStandard" {
- Properties {
- _Color("Color", Color) = (1,1,1,1)
- _MainTex("Albedo", 2D) = "white" {}
- _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
- _Glossiness("Glossiness", Range(0.0, 1.0)) = 0.5
- [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
- _MetallicGlossMap("Metallic", 2D) = "white" {}
- _EdgeLength ("Edge length", Range(3,50)) = 10
- _Smoothness ("Smoothness", Range(0,1)) = 0.5
- _BumpScale("Scale", Float) = 1.0
- _BumpMap("Normal Map", 2D) = "bump" {}
- _Parallax ("Height Scale", Range (0.005, 0.08)) = 0.02
- _ParallaxMap ("Height Map", 2D) = "black" {}
- _OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
- _OcclusionMap("Occlusion", 2D) = "white" {}
- _EmissionColor("Color", Color) = (0,0,0)
- _EmissionMap("Emission", 2D) = "white" {}
- _DetailMask("Detail Mask", 2D) = "white" {}
- _DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {}
- _DetailNormalMapScale("Scale", Float) = 1.0
- _DetailNormalMap("Normal Map", 2D) = "bump" {}
- [Enum(UV0,0,UV1,1)] _UVSec ("UV Set for secondary textures", Float) = 0
- // Blending state
- [HideInInspector] _Mode ("__mode", Float) = 0.0
- [HideInInspector] _SrcBlend ("__src", Float) = 1.0
- [HideInInspector] _DstBlend ("__dst", Float) = 0.0
- [HideInInspector] _ZWrite ("__zw", Float) = 1.0
- }
- SubShader {
- Tags { "RenderType"="Opaque" }
- LOD 700
- CGPROGRAM
- // Physically based Standard lighting model, and enable shadows on all light types
- #pragma surface surf Standard addshadow vertex:disp tessellate:tessEdge tessphong:_Smoothness
- //#pragma multi_compile_fog
- // Use shader model 3.0 target, to get nicer looking lighting
- #pragma target 5.0
- #include "Tessellation.cginc"
- sampler2D _MainTex;
- sampler2D _MetallicGlossMap;
- sampler2D _BumpMap;
- sampler2D _DetailAlbedoMap;
- sampler2D _DetailNormalMap;
- sampler2D _EmissionMap;
- sampler2D _ParallaxMap;
- sampler2D _OcclusionMap;
- float _BumpScale;
- float _EdgeLength;
- float _Smoothness;
- float _Parallax;
- float _OcclusionStrength;
- half _Glossiness;
- half _Metallic;
- float _DetailNormalMapScale;
- fixed4 _Color;
- fixed4 _EmissionColor;
- float _Mode;
- struct Input {
- float2 uv_MainTex;
- float2 uv_MetallicGlossMap;
- float2 uv_BumpMap;
- float2 uv_DetailAlbedoMap;
- float2 uv_DetailNormalMap;
- float2 uv_EmissionMap;
- float2 uv_OcclusionMap;
- };
- struct appdata {
- float4 vertex : POSITION;
- float4 tangent : TANGENT;
- float3 normal : NORMAL;
- float2 texcoord : TEXCOORD0;
- float2 texcoord1 : TEXCOORD1;
- float2 texcoord2 : TEXCOORD2;
- };
- float4 tessEdge(appdata v0, appdata v1, appdata v2)
- {
- return UnityEdgeLengthBasedTessCull(v0.vertex, v1.vertex, v2.vertex, _EdgeLength, 0.0);
- }
- void disp(inout appdata v)
- {
- float d = tex2Dlod(_ParallaxMap, float4(v.texcoord.xy, 0, 0)).a * _Parallax;
- v.vertex.xyz += v.normal * d;
- }
- /*half alphaStandard()
- {
- if (_Mode == 3)
- return fade();
- }*/
- void surf (Input IN, inout SurfaceOutputStandard o) {
- // Albedo comes from a texture tinted by color
- fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
- fixed4 d = tex2D(_DetailAlbedoMap, IN.uv_DetailAlbedoMap);
- o.Albedo = c.rgb * d.rgb * _Color.rgb;
- o.Occlusion = tex2D(_OcclusionMap, IN.uv_OcclusionMap) * _OcclusionStrength;
- o.Emission = c.rgb * tex2D(_EmissionMap, IN.uv_EmissionMap).a *_EmissionColor.rrr;
- #if defined (UNITY_PASS_META)
- o.Emission *= _EmissionColor.rrr;
- #endif
- o.Metallic = tex2D(_MetallicGlossMap, IN.uv_MetallicGlossMap).a * _Metallic;
- o.Smoothness = tex2D(_MetallicGlossMap, IN.uv_MetallicGlossMap).r * _Glossiness;
- o.Alpha = c.a * d.a * _Color.a;
- fixed4 db = tex2D(_DetailNormalMap, IN.uv_DetailNormalMap);
- o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap) * (db * _DetailNormalMapScale)) * _BumpScale;
- }
- ENDCG
- }
- FallBack "Diffuse"
- CustomEditor "TassellationStandardShaderGUI"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement