当前位置: 首页 > news >正文

自己做的网站无法访问网站建设的投资预算怎么写

自己做的网站无法访问,网站建设的投资预算怎么写,wordpress 删除插件,简单的网站建设合同书unity5中引入了基于物理着色(PBS)的Standard shader。由于这种着色器通过调节参数和贴图可逼真模拟各种硬质表面#xff0c;所以不必再像unity4时代那样需要对各种质感材质单独编写着色器#xff0c;而且能得到更好的效果(参考#xff1a;http://docs.unity3d.com/Manual/sh…unity5中引入了基于物理着色(PBS)的Standard shader。由于这种着色器通过调节参数和贴图可逼真模拟各种硬质表面所以不必再像unity4时代那样需要对各种质感材质单独编写着色器而且能得到更好的效果(参考http://docs.unity3d.com/Manual/shader-StandardShader.html)。这种“万能着色器”仿佛给人一种不再需要自己编写着色器的假象但做游戏跟做虚拟现实不一样除了真实性还要追求趣味性和艺术夸张。所以老古语不过时没有使用自定义着色器的游戏不是好游戏。 但自己实现PBS是很困难的如果我们想既继承Standard shader的PBS特性又加入自己的定制效果最好我们的自定义shader能在Standard shader的基础上进行编写即实现自定义PBS着色器custom PBS shader。 由于是新东西资料不全google了一整天也没能找到现成方法unity官方文档中对此完全没有作说明在surface shader自定义光照模型 部分只给了不带PBS的例子unity论坛里有多个帖子问到类似问题但都没有满意解答。最后在下面两个连接里找到了一点儿线索 http://forum.unity3d.com/threads/for-those-in-u5-beta-is-pbr-really-that-good.283867/page-3#post-1886525 http://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/ 文章下面 MIG 的提问 此线索是“   from the release notes for beta 12: Shaders: Surface shaders can use physically based shading now; the same as Standard shader uses. Use Standard lighting function, and SurfaceOutputStandard output structure.Do an #include UnityPBSLighting.cginc in your shader to get it.Default options require shader model 3.0, so add a #pragma target 3.0 too. ” 然后又结合了UnityPBSLighting.cginc中的源代码注1当然只是从UnityPBSLighting.cginc中拷贝一些代码出来而不是修改它最后终于把custom PBS shader试验成功了。 注1UnityPBSLighting.cginc这个文件在哪儿有三个途径获得 1在 http://docs.unity3d.com/Manual/SL-SurfaceShaderLighting.html 中写道“file inside Unity ({unity install path}/Data/CGIncludes/ on Windows, /Applications/Unity/Unity.app/Contents/CGIncludes/ on Mac)”需要注意的是/Applications/Unity/Unity.app/Contents/CGIncludes/这个路径是在Unity.app的“包内容”里所以这就是为什么在Mac上虽然UnityPBSLighting.cginc已经随unity一起安装了但确不能通过文件搜素找到。 2通过网址http://docs.unity3d.com/Manual/StandardShaderMakeYourOwn.html进入在线的Make your own页面下载builtin_shaders的最新版本也包括历史版本。因为我的unity是最新的所以通过此途径下载到的最新版的builtin_shaders与途径(1)中的是一致的但如果你的unity不是最新的一定要根据你的unity版本号下载相应版本的builtin_shaders否则你拷贝其中的代码用到自定义shader中可能报错。 3在浏览器地址栏输入file:///Applications/Unity/Unity.app/Contents/Documentation/en/Manual/StandardShaderMakeYourOwn.html进入离线的Make your own页面从地址上你可以看出这个页面实际上保存在你的电脑中下载builtin_shaders但要注意通过这个离线文档下载的builtin_shaders可能不是最新的我今天就被此坑了一回通过此途径下载的UnityPBSLighting.cginc文件中的代码拷贝到自定义shader中报错搞了半天没找到原因直到我又通过途径(1)重新获得UnityPBSLighting.cginc。。。 综上途径(1)是最好的。 下图第一个球用的是Standard shader第二个球用的是“将法线当作颜色值”的自定义shader不带PBS第三个球是今天的试验成果在Standard shader的PBS基础上添加了“将法线当作颜色值”效果的杂交shader。 第一个球的shader用的是unity(version 5.0.1f1 Personal)里新建shader时生成的默认shader: Shader Custom/NewShader {    Properties {        _Color (Color, Color)  (1,1,1,1)        _MainTex (Albedo (RGB), 2D)  white {}        _Glossiness (Smoothness, Range(0,1))  0.5        _Metallic (Metallic, Range(0,1))  0.0    }    SubShader {        Tags { RenderTypeOpaque }        LOD 200                CGPROGRAM        // Physically based Standard lighting model, and enable shadows on all light types        #pragma surface surf Standard fullforwardshadows        // Use shader model 3.0 target, to get nicer looking lighting        #pragma target 3.0        sampler2D _MainTex;        struct Input {            float2 uv_MainTex;        };        half _Glossiness;        half _Metallic;        fixed4 _Color;        void surf (Input IN, inout SurfaceOutputStandard o) {            // Albedo comes from a texture tinted by color            fixed4 c  tex2D (_MainTex, IN.uv_MainTex) * _Color;            o.Albedo  c.rgb;            // Metallic and smoothness come from slider variables            o.Metallic  _Metallic;            o.Smoothness  _Glossiness;            o.Alpha  c.a;        }        ENDCG    }     FallBack Diffuse} 在此基础上参照UnityPBSLighting.cginc中的源代码将光照模型以自定义光照模型的形式暴露出来得到下面等价shader: 这里需要注意的是一般自定义光照模型只要实现一个 Lightning自定义光照模型名称 的函数即可但是对于PBS shader来说要实现自定义光照模型还要多写一个 Lightning自定义光照模型名称_GI 的函数。 Shader Custom/customPBS {      Properties {        _Color (Color, Color)  (1,1,1,1)        _MainTex (Albedo (RGB), 2D)  white {}        _Glossiness (Smoothness, Range(0,1))  0.5        _Metallic (Metallic, Range(0,1))  0.0    }    SubShader {        Tags { RenderTypeOpaque MyReplaceTagOther}        LOD 200                CGPROGRAM            // Physically based Standard lighting model, and enable shadows on all light types        #pragma surface surf MyCustomStandard fullforwardshadows        // Use shader model 3.0 target, to get nicer looking lighting        #pragma target 3.0        #include UnityPBSLighting.cginc        inline void LightingMyCustomStandard_GI (            SurfaceOutputStandard s,            UnityGIInput data,            inout UnityGI gi)        {            gi  UnityGlobalIllumination (data, s.Occlusion, s.Smoothness, s.Normal);        }        inline half4 LightingMyCustomStandard (SurfaceOutputStandard s, half3 viewDir, UnityGI gi)        {            s.Normal  normalize(s.Normal);            half oneMinusReflectivity;            half3 specColor;            s.Albedo  DiffuseAndSpecularFromMetallic (s.Albedo, s.Metallic, /*out*/ specColor, /*out*/ oneMinusReflectivity);            // shader relies on pre-multiply alpha-blend (_SrcBlend  One, _DstBlend  OneMinusSrcAlpha)            // this is necessary to handle transparency in physically correct way - only diffuse component gets affected by alpha            half outputAlpha;            s.Albedo  PreMultiplyAlpha (s.Albedo, s.Alpha, oneMinusReflectivity, /*out*/ outputAlpha);            half4 c  UNITY_BRDF_PBS (s.Albedo, specColor, oneMinusReflectivity, s.Smoothness, s.Normal, viewDir, gi.light, gi.indirect);            c.rgb  UNITY_BRDF_GI (s.Albedo, specColor, oneMinusReflectivity, s.Smoothness, s.Normal, viewDir, s.Occlusion, gi);            c.a  outputAlpha;                        return c;        }        sampler2D _MainTex;        struct Input {            float2 uv_MainTex;        };        half _Glossiness;        half _Metallic;        fixed4 _Color;        void surf (Input IN, inout SurfaceOutputStandard o) {            // Albedo comes from a texture tinted by color            fixed4 c  tex2D (_MainTex, IN.uv_MainTex) * _Color;            o.Albedo  c.rgb;            // Metallic and smoothness come from slider variables            o.Metallic  _Metallic;            o.Smoothness  _Glossiness;            o.Alpha  c.a;        }                        ENDCG    }     FallBack Diffuse}   上面shader和默认shader效果完全一样但是由于暴露出来光照模型即上面的LightingMyCustomStandard函数便使得我们可以在光照模型层次上对其进行修改实现出自己的变种shader效果。 例如下面shader就是在LightingMyCustomStandard中插入一行代码实现前面图中第三个球的效果 Shader Custom/customPBSAndShowNormalAsColor {    Properties {        _Color (Color, Color)  (1,1,1,1)        _MainTex (Albedo (RGB), 2D)  white {}        _Glossiness (Smoothness, Range(0,1))  0.5        _Metallic (Metallic, Range(0,1))  0.0    }    SubShader {        Tags { RenderTypeOpaque }        LOD 200                CGPROGRAM            // Physically based Standard lighting model, and enable shadows on all light types        #pragma surface surf MyCustomStandard fullforwardshadows        // Use shader model 3.0 target, to get nicer looking lighting        #pragma target 3.0        #include UnityPBSLighting.cginc        inline void LightingMyCustomStandard_GI (            SurfaceOutputStandard s,            UnityGIInput data,            inout UnityGI gi)        {            gi  UnityGlobalIllumination (data, s.Occlusion, s.Smoothness, s.Normal);        }        inline half4 LightingMyCustomStandard (SurfaceOutputStandard s, half3 viewDir, UnityGI gi)        {            s.Normal  normalize(s.Normal);            half oneMinusReflectivity;            half3 specColor;            s.Albedo  DiffuseAndSpecularFromMetallic (s.Albedo, s.Metallic, /*out*/ specColor, /*out*/ oneMinusReflectivity);            // shader relies on pre-multiply alpha-blend (_SrcBlend  One, _DstBlend  OneMinusSrcAlpha)            // this is necessary to handle transparency in physically correct way - only diffuse component gets affected by alpha            half outputAlpha;            s.Albedo  PreMultiplyAlpha (s.Albedo, s.Alpha, oneMinusReflectivity, /*out*/ outputAlpha);            half4 c  UNITY_BRDF_PBS (s.Albedo, specColor, oneMinusReflectivity, s.Smoothness, s.Normal, viewDir, gi.light, gi.indirect);            c.rgb  UNITY_BRDF_GI (s.Albedo, specColor, oneMinusReflectivity, s.Smoothness, s.Normal, viewDir, s.Occlusion, gi);            c.a  outputAlpha;                        c.rgb*s.Normal *1.5;//added by wantnon             return c;        }         sampler2D _MainTex;        struct Input {            float2 uv_MainTex;        };        half _Glossiness;        half _Metallic;        fixed4 _Color;        void surf (Input IN, inout SurfaceOutputStandard o) {            // Albedo comes from a texture tinted by color            fixed4 c  tex2D (_MainTex, IN.uv_MainTex) * _Color;            o.Albedo  c.rgb;            // Metallic and smoothness come from slider variables            o.Metallic  _Metallic;            o.Smoothness  _Glossiness;            o.Alpha  c.a;        }                        ENDCG    }     FallBack Diffuse}  当然如果不需要在光照模型的层次上对unity自带的PBS shader进行定制是没有必要这么麻烦的。 比如就拿上面这个customPBSShowNormalAsColor来说其实没必要深入到光照模型层次上去实现下面shader就可以实现基本相同的效果 (其中蓝字是在前面Custom/NewShader基础上新增的语句) Shader Custom/NewShaderAndShowNormalAsColor {    Properties {        _Color (Color, Color)  (1,1,1,1)        _MainTex (Albedo (RGB), 2D)  white {}        _Glossiness (Smoothness, Range(0,1))  0.5        _Metallic (Metallic, Range(0,1))  0.0    }    SubShader {        Tags { RenderTypeOpaque }        LOD 200                CGPROGRAM        // Physically based Standard lighting model, and enable shadows on all light types        #pragma surface surf Standard fullforwardshadows        // Use shader model 3.0 target, to get nicer looking lighting        #pragma target 3.0        sampler2D _MainTex;        struct Input {            float2 uv_MainTex;     float3 worldNormal;//ref: http://wiki.unity3d.com/index.php?titleShader_Code        };        half _Glossiness;        half _Metallic;        fixed4 _Color;        void surf (Input IN, inout SurfaceOutputStandard o) {            // Albedo comes from a texture tinted by color            fixed4 c  tex2D (_MainTex, IN.uv_MainTex) * _Color;       c.rgb*IN.worldNormal;            o.Albedo  c.rgb;            // Metallic and smoothness come from slider variables            o.Metallic  _Metallic;            o.Smoothness  _Glossiness;            o.Alpha  c.a;        }        ENDCG    }     FallBack Diffuse}转载于:https://www.cnblogs.com/wantnon/p/4395286.html
http://www.yutouwan.com/news/487470/

相关文章:

  • 网站建设销售好做么龙岩kk网首页
  • 做网站的公司风险大不大做游戏下载网站赚钱
  • 到哪里做网站网站 短链接怎么做
  • 成都教育网站建设微信开发服务商
  • 关键词做网站标题是什么意思品牌建站
  • 周口公司做网站漳州建设局网站
  • 免费免费网站模板下载网站百度商桥代码安装在哪里wordpress
  • 宿州网站建设工作室wordpress页面咋恢复
  • 网站建设的规划和流程外贸会计做账流程
  • 带后台管理的网站模板wordpress用了cdn和缓存插件
  • 网站开发工作 岗位怎么称呼百度投放平台
  • 前端个人介绍网站模板下载东莞网站建设流程图
  • 垂直网站做益智类问答网站方案策划怎么写
  • 网站排名优化培训电话seo入门到精通
  • 贵阳网站建设功能做网站正规公司
  • 网站运营策略如何做建设工程法律网站
  • 织梦网站首页模板更换的推网站模板
  • 上海设计网站大全北京建设高端网站的
  • 安阳网站建设商祺国外网站有备案吗
  • 茶叶市场网站建设方案佛山企业网站开发
  • 建一个网站买完域名后应该怎么做网站经营性备案
  • 南通网站建设培训asp.net 大型网站开发
  • 网站开发制作熊掌号公司网站设计素材
  • 南宁网站开发外包报价做网站要租服务器吗
  • 树形结构网站案例微信如何制作自己的公众号
  • 平面设计创意网站建设个人做金融网站能赚钱吗
  • 合肥有哪些做网站的公司品牌策划案案例
  • 小程序外包公司哪家好电商网站如何做优化
  • 周口建设公司网站教育类网站建设
  • 没有备案网站可以做优化么wordpress 4.7.5