Unity 不受光照影响shader 仿Unlit/Texture
2016-05-10 15:35
1491 查看
Unity 不受光照影响 shader ,类似 “Unlit/Texture” shader
一:
下面是我用surf shader 实现的
二 :
相关链接:http://ykxingquan.blog.163.com/blog/static/13428052013052420979/
一:
Shader "Custom/MyShader" { Properties { _Color ("Main Color", Color) = (1,1,1,1)//Tint Color _MainTex ("Base (RGB)", 2D) = "white" {} } SubShader { Tags { "RenderType"="Opaque" } LOD 100 Pass { cull front Lighting Off SetTexture [_MainTex] { combine texture } SetTexture [_MainTex] { ConstantColor [_Color] Combine Previous * Constant } } } }
下面是我用surf shader 实现的
二 :
Shader "Custom/SurfTexture" { Properties { _Color ("Main Color", Color) = (1,1,1,1) _MainTex ("Base (RGB)", 2D) = "white" {} } SubShader { Tags { "RenderType"="Opaque" } LOD 200 CGPROGRAM #pragma surface surf myLightModel //命名规则:Lighting接#pragma suface之后起的名字 //lightDir :点到光源的单位向量 viewDir:点到摄像机的单位向量 atten:衰减系数 float4 LightingmyLightModel(SurfaceOutput s, float3 lightDir,half3 viewDir, half atten) { float4 c ; c.rgb = s.Albedo; c.a = s.Alpha; return c; } sampler2D _MainTex; float4 _Color; struct Input { float2 uv_MainTex; float4 _Color; }; void surf (Input IN, inout SurfaceOutput o) { half4 c = tex2D (_MainTex, IN.uv_MainTex)*_Color; o.Albedo = c.rgb; o.Alpha = c.a; } ENDCG } FallBack "Diffuse" }
相关链接:http://ykxingquan.blog.163.com/blog/static/13428052013052420979/
相关文章推荐
- Unity3D 摄像机(Camera)属性详解
- 利用MVC、Unity将Service实现Restful
- Unity 内置Shader变量、辅助函数等
- unity3d 5 InputField 非法路径文件名字符 输入过滤
- unity5.3 VR开发
- Unity开发者的C#内存管理(上篇)
- Mark Shuttleworth:我们不会在 Unity 8 上犯同样错误
- Unity中LayerMask的学习手记
- Unity3D控制人物移动跳跃,处理CharacterController的isGrounded总是返回false问题
- Unity5.3官方VR教程重磅登场-系列6 VR真机测试和产品发布
- Unity5.3官方VR教程重磅登场-系列5 VR中的运动
- Unity5.3官方VR教程重磅登场-系列4 VR中的用户界面
- 不知道怎么开发VR游戏?Unity5.3官方VR教程重磅登场-系列3 VR中的交互方式
- Color Grading with Unity and the Asset Store
- Unity5.3官方VR教程重磅登场-系列1
- Unity研究院之多余的MeshCollider和Animation组件
- 深入理解Unity5中的StandardShader屏幕像素化特效的实现
- 【Unity技巧】开发技巧(技巧篇)
- Unity3D Shader 入门
- 不知道怎么开发VR游戏?Unity5.3官方VR教程重磅登场-系列8 VR开发的更多资料