顶点Blinn-Phong.Shader
来源:互联网 发布:数据库系统原理自考 编辑:程序博客网 时间:2024/05/21 05:43
Blinn-Phong:高光的一种,高光范围更大,更亮
Shader "Custom/Light/BlinnPhongLight"{ Properties{ _Diffuse("Diffuse", Color) = (1, 1, 1, 1) _Specular("Specular", Color) = (1, 1, 1, 1) _Gloss("Gloss", Range(1.0, 255)) = 20 } SubShader{ Pass{ Tags{ "LightMode" = "ForwardBase" } CGPROGRAM #include "Lighting.cginc" #pragma vertex vert #pragma fragment frag fixed4 _Diffuse; fixed4 _Specular; float _Gloss; struct a2v{ float4 pos : POSITION; float4 normal : NORMAL; }; struct v2f{ float4 pos : SV_POSITION; fixed3 color : COLOR; }; v2f vert(a2v v){ v2f o; o.pos = mul(UNITY_MATRIX_MVP, v.pos); fixed3 worldNormal = normalize(mul(v.normal, (float3x3)_World2Object)); fixed3 worldLightDir = normalize(_WorldSpaceLightPos0.xyz); fixed3 diffuse = _LightColor0.rgb * _Diffuse.rgb * max(0, dot(worldNormal, worldLightDir)); fixed3 viewDir = normalize(_WorldSpaceCameraPos.xyz - mul(_Object2World, v.pos).xyz); fixed3 specular = _LightColor0.rgb * _Specular.rgb * pow(max(0, dot(normalize(viewDir + worldLightDir), worldNormal)), _Gloss); o.color = UNITY_LIGHTMODEL_AMBIENT.xyz + diffuse + specular; return o; } fixed4 frag(v2f i) : SV_Target{ return fixed4(i.color, 1.0); } ENDCG } } Fallback "Specular"}
话说片段好麻烦呀。。不想写��
0 0
- 顶点Blinn-Phong.Shader
- Shader基于顶点编程的Lambert光照,Phong光照和Blinn-Phong光照
- <Shader>phong 光照模型和 blinn phong 模式
- Shader基于片段编程的Lambert光照,Phong光照和Blinn-Phong光照
- Blinn-Phong 光照
- Blinn–Phong Shading Model
- OpenGL学习脚印:Blinn-Phong光照模型
- Phong光照模型、Blinn-phong光照模型归纳
- 常用光照模型汇总:Lambert/Phong/Blinn-Phong光照模型
- Spherical Gaussian approximation for Blinn-Phong, Phong and Fresnel
- GPU实现“Blinn-Phong 光照模型”(Cg语言)
- 高光反射-逐像素光照(Blinn-Phong)
- 简单光照模型(Phong模型(镜面反射)与 Blinn-Phong光照模型(修正镜面光) )
- 光照模型的计算方式总结(1.Diffuse分量2.Specular分量 Phong model和Blinn-Phong model (Or Blinn))
- [sig12][PhysicalBasedRender]Beyond a simple Physically Based Blinn-phong model in real time
- 关于Unity3D内置Blinn Phong光照模型计算在移动设备上的曝光问题
- Unity Shader-Phong光照模型与Specular
- Unity Shader-Phong光照模型与Specular
- 5-53 两个有序序列的中位数 (25分)
- jq checkbox全选
- java设计模式进阶_observer
- Android 自定义屏幕中间Toast的不延时弹出
- 【Android 】TextView 局部文字变色
- 顶点Blinn-Phong.Shader
- AsyncQueryHandle
- MVC设计模式总结
- 使用MDK5建立STM32F407IG工程中遇到的问题
- maven项目java.lang.NoSuchMethodError,java.lang.NoClassDefFoundError
- Executors 四种线程池newCachedThreadPool,newFixedThreadPool,newScheduledThreadPool,newSingleThreadExecutor
- Ehcache 整合Spring 使用页面、对象缓存
- Qt阻塞延时和非阻塞延时
- matlab文件操作