让Surface Shader不受光照的明暗影响

直接上码

 1 Shader "Custom/3DVideo" {
 2     Properties {
 3         _Color ("Color", Color) = (1,1,1,1)
 4         _MainTex ("Albedo (RGB)", 2D) = "white" {}
 5         _Glossiness ("Smoothness", Range(0,1)) = 0.5
 6         _Metallic ("Metallic", Range(0,1)) = 0.0
 7         _x("x", Range(0.1, 1)) = 1
 8         _y("y", Range(0.1, 1)) = 1
 9     }
10     SubShader {
11         Tags { "RenderType"="Opaque" }
12         LOD 200
13         Cull Front 
14         Lighting Off
15 
16         CGPROGRAM
17         // Physically based Standard lighting model, and enable shadows on all light types
18         // #pragma surface surf Standard fullforwardshadows
19         #pragma surface surf Unlit noambient
20 
21         // Use shader model 3.0 target, to get nicer looking lighting
22         #pragma target 3.0
23 
24         half4 LightingUnlit (SurfaceOutput s, half3 lightDir, half atten) {
25            return fixed4(s.Albedo, s.Alpha);
26         }
27 
28         sampler2D _MainTex;
29         float _x;
30         float _y;
31 
32         struct Input {
33             float2 uv_MainTex;
34         };
35 
36         half _Glossiness;
37         half _Metallic;
38         fixed4 _Color;
39 
40         // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
41         // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
42         // #pragma instancing_options assumeuniformscaling
43         UNITY_INSTANCING_BUFFER_START(Props)
44             // put more per-instance properties here
45         UNITY_INSTANCING_BUFFER_END(Props)
46 
47         // void surf (Input IN, inout SurfaceOutputStandard o) {
48         void surf (Input IN, inout SurfaceOutput o) {
49             float2 uv_XY = IN.uv_MainTex;
50             float2 uv_MainTex2 = float2(uv_XY.x * _x, uv_XY.y * _y);
51             // Albedo comes from a texture tinted by color
52             fixed4 c = tex2D (_MainTex, uv_MainTex2) * _Color;
53             o.Albedo = c.rgb;
54             // Metallic and smoothness come from slider variables
55             // o.Metallic = _Metallic;
56             // o.Smoothness = _Glossiness;
57             o.Alpha = c.a;
58         }
59         ENDCG
60     }
61     FallBack "Diffuse"
62 }

 

转载于:https://www.cnblogs.com/linxmouse/p/9762049.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值