unity3d中实现Hemisphere Lighting
来源:互联网 发布:张学友 陈奕迅 知乎 编辑:程序博客网 时间:2024/06/05 05:13
参考资料:http://www.yaldex.com/open-gl/ch12lev1sec1.html
效果图:
代码:
Shader "Custom/Hemisphere_Lighting" {Properties { _MainTex ("Texture", 2D) = "white" {}_SkyColor("Sky Color",Color)=(1,1,1,1)_GroundColor("Ground Color",Color)=(0,0,0,1)}SubShader { Pass {CGPROGRAM#pragma vertex vert#pragma fragment frag#include "UnityCG.cginc"float4 _SkyColor;float4 _GroundColor;sampler2D _MainTex;struct v2f {float4 pos : SV_POSITION;float2 uv : TEXCOORD0;fixed4 color : COLOR0;};float4 _MainTex_ST;v2f vert (appdata_base v){v2f o;o.pos = mul (UNITY_MATRIX_MVP, v.vertex);o.uv = TRANSFORM_TEX (v.texcoord, _MainTex);fixed3 tnorm=mul(fixed4(v.normal,1),UNITY_MATRIX_MVP);float costheta = dot(tnorm, fixed3(0,1,0));float a = 0.5 + 0.5 * costheta;o.color=_SkyColor*a+(1-a)*_GroundColor;return o;}half4 frag (v2f i) : COLOR{half4 texcol = tex2D (_MainTex, i.uv);texcol.r*=i.color.r;texcol.g*=i.color.g;texcol.b*=i.color.b;return texcol;}ENDCG }}Fallback "VertexLit"}
- unity3d中实现Hemisphere Lighting
- Unity3D说明文档翻译-Lighting Overview
- Unity3D中存档实现
- Lighting
- unity3d中实现双击效果
- unity3d中实现聊天功能
- unity3d 中实现猜拳游戏
- Unity3D中实现帧同步
- Unity3D中实现帧同步
- Unity3d Shader(三) Pass(Color, Material, Lighting )
- Unity3d Shader开发(三)Pass(Color, Material, Lighting )
- GLSL实现简单硬件Anisotrop Lighting
- GLSL实现简单硬件Anisotrop Lighting
- Spherical Harmonics Lighting代码实现(续)
- unity 中Deferred Lighting (延迟光照)
- [Unity3D]在Unity3D中实现简单的碰撞检测
- [Unity3D]在Unity3D中实现简单的碰撞检测
- Unity3D游戏开发之在Unity3D中实现视频播放
- listctrl设置每行的颜色
- errno报错
- 第76章、再识Intent-调用ContentProviderl程序(从零开始学Android)
- 两种缓存Bitmap的方式
- error: cannot execute binary file
- unity3d中实现Hemisphere Lighting
- Web缓存服务器:使用Varnish代替Squid
- 深入浅出 JQuery (一) 浅析JQuery
- 第77章、再识Intent-创建选择器(从零开始学Android)
- 开启Eclipse的自动辅助功能
- c++ 输入些数,统计正负各位几个的算法实现
- 精妙SQL语句,基础,提升,技巧
- locale的设定及其LANG、LC_ALL、LANGUAGE环境变量的区别
- Oracle SQL性能优化的几个关键点