surface shader

Shader “Custom/sfceshader” {Properties {_Color (“Color”, Color) = (1,1,1,1) _MainTex (” Albedo (RGB)”, 2D) = “white” {} //Main texture_Glossiness (“Smoothness”, Range(0,1)) = 0.5 //High-gloss glass_Metallic (“Metallic”, Range(0,1) )) = 0.0 // Metal material} SubShader {Tags {“RenderType”=”Opaque”} ////Tags {“RenderType”=”Opaque” “queue”=”transparent” Transparent sequence based on LOD 200 Physically CGPROGRAM // Physically based Standard lighting model, and enable shadows on all light types #pragma surface surf Standard fullforwardshadows Old engine Standard is a new engine Add transparent alpha channel Add shadow addshadow // Use shader model 3.0 target, to get nicer looking lighting #pragma target 3.0 sampler2D _MainTex; //Declare the main material type struct Input {float2 uv_MainTex; ////The uv_material must be added to the front to take effect); half _Glossiness; //Floating point type half _Metallic; fixed4 _Color; void 4 _Color; // IN, inout SurfaceOutputStandard o) {// Albedo c omes 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 = ca;} ENDCG} FallBack “Diffuse” // Shadow channel will be added automatically}

Leave a Comment

Your email address will not be published.