<Shader> 自定义光照模型
来源:互联网 发布:淘宝网免费活动 编辑:程序博客网 时间:2024/06/04 18:55
Shader "Custom/LightingModule"{Properties{_MainColor("Base Color",color) = (1,1,1,1)_AmibentColor("Amient Color",color) = (1,1,1,1)_MySliderValue("This Slider",range(0,10)) = 2.5_RampTex ("Ramp Texture", 2D) = "white"{} }SubShader{Tags { "RenderType" = "Opaque" }LOD 200CGPROGRAM#pragma surface suf BasicDiffusefloat4 _MainColor;float4_AmibentColor;float _MySliderValue;sampler2D _RampTex;struct Input{float2 uv_MainTex;};void suf (Input IN,inout SurfaceOutput o ){float4 c = pow((_MainColor + _AmibentColor),_MySliderValue);o.Albedo = c.rgb;o.Alpha = c.a;}//-------------------基于半兰伯特光照模型---------------------------////自定义光照模型 函数必须要以 Lighting 开头 inline float4 LightingBasicDiffuse(SurfaceOutput s,fixed3 lightDirection,fixed atten){ float difLight = max(0, dot (s.Normal, lightDirection)); // Add this line float hLambert = difLight * 0.5 + 0.5; float3 ramp = tex2D(_RampTex, float2(hLambert,1)).rgb; float4 col; // Modify this line col.rgb = s.Albedo * _LightColor0.rgb * ramp; col.a = s.Alpha; return col;}//-------------------基于兰伯特光照模型---------------------------//// inline float4 LightingBasicDiffuse (SurfaceOutput s, fixed3 lightDir, fixed atten)// {// float difLight = max(0, dot (s.Normal, lightDir));// float4 col;// col.rgb = s.Albedo * _LightColor0.rgb * (difLight * atten * 2);// col.a = s.Alpha;// return col;//}ENDCG}FallBack "Diffuse"}
阅读全文
0 0
- <Shader> 自定义光照模型
- Unity Shader自定义光照模型
- Unity Shader之自定义漫反射光照模型
- Unity3d Shader光照模型
- Unity shader教程-第四课:自定义光照模型(方程)
- Shader学习笔记(三)自定义光照模型,经典光照模型Lambert与HalfLambert
- shader 光照模型,半角向量
- Unity Shader 五 光照模型
- shader中一些光照模型
- Unity shader教程-第五课:自定义光照模型之Half Lambert模型
- 【风宇冲】Unity3D教程宝典之Shader篇:第十六讲自定义光照模型
- unity3D 教程宝典之Shader篇:第十六讲自定义光照模型
- 用Shader实现标准光照模型
- Shader中的空间概念以及光照模型
- Cook-Torrance光照模型附 shader代码
- 常用的光照模型Shader Models
- Unity Shader-Phong光照模型与Specular
- Unity Shader学习-3.光照模型
- 在net和mono中都可用的sqlite数据库连接类
- 什么是多线程?以tomcat处理n个请求为例
- 图的算法floryd
- Laravel程序启动
- ISO8583报文64域
- <Shader> 自定义光照模型
- HTTP错误汇总
- Linux Shell 数据重定向详解
- Spring Security中设置entry-point-ref="第三方登录入口"的作用
- 正则
- 关于transform的应用
- Magento 503 Service Temporarily Unavailable错误
- (114)随机流
- rex 管理定时任务