让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 }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端
· AI Agent开发,如何调用三方的API Function,是通过提示词来发起调用的吗