渐变纹理模拟光照
2016-10-12 10:37
211 查看
Shader "Custom/Toon" { Properties { _MainTex ("Main Tex", 2D) = "white" {} _RampTex("Ramp Tex",2D)=""{} } SubShader { Tags { "Queue"="Transparent" "IngnoreProjector"="True" "RenderType"="Transparent" } LOD 200 CGPROGRAM // Physically based Standard lighting model, and enable shadows on all light types #pragma surface surf Toon alpha:fade nolighting // Use shader model 3.0 target, to get nicer looking lighting #pragma target 3.0 sampler2D _MainTex; sampler2D _RampTex; struct Input { float2 uv_MainTex; }; fixed4 LightingToon(SurfaceOutput s,fixed3 lightDir,fixed atten) { half NdotL = dot(s.Normal,lightDir); fixed4 col = tex2D(_RampTex,fixed2(NdotL,0.5)); fixed4 c; c.rgb = s.Albedo*_LightColor0.rgb*col*atten; c.a = s.Alpha; return c; } void surf (Input IN, inout SurfaceOutput o) { fixed4 c = tex2D(_MainTex,IN.uv_MainTex); o.Albedo = c.rgb; o.Alpha = c.a; } ENDCG } FallBack "Diffuse" }
相关文章推荐
- 模拟光照中的凹凸纹理原理和应用
- Unity Shaders and Effects Cookbook (1-5)使用2D渐变纹理模拟BRDF(双向反射分布函数)
- Shader中贴图知识汇总: 漫反射贴图、凹凸贴图、高光贴图、 AO贴图、环境贴图、 光照纹理及细节贴图
- 【Unity Shader实战】利用凹凸纹理和边缘光模拟全息投影的效果
- matlab图像光照效果模拟
- unity shader 固定管线实例(二) 光照 颜色和纹理
- opengles绘制圆柱体(光照+纹理)
- NeHe OpenGL教程 07 纹理过滤、应用光照
- 【转】光照、材质、纹理的关系
- Shader中贴图知识汇总: 漫反射贴图、凹凸贴图、高光贴图、 AO贴图、环境贴图、 光照纹理及细节贴图
- C# 模拟光照运算以及背面剔除
- DirectX 3D_基础之光照 材质 顶点法线 光源 纹理映射 纹理坐标 多级纹理 纹理过滤
- [OPENGL]纹理,材质,光照
- Unity Shader学习笔记:渐变纹理
- opengl纹理,光照,glColor4f(),混合
- OpenGL_Qt学习笔记之_06(纹理滤波、光照和色彩融合)
- Shader学习 基于vert/frag顶点片段级的纹理采样 光照贴图实现
- openGL绘制正方体分别实现简单颜色绘制、纹理绘制、光照绘制
- OpenGL3D图形、旋转、纹理、键盘移动、光照、滤波、透明(完整)
- 一个有趣的模拟光照的shader(类似法线贴图)