{"id":1529,"date":"2016-07-11T13:15:07","date_gmt":"2016-07-11T05:15:07","guid":{"rendered":"http:\/\/www.clonefactor.com\/wordpress\/?p=1529"},"modified":"2016-07-11T13:16:38","modified_gmt":"2016-07-11T05:16:38","slug":"cheap-wall-vision-shape-shader","status":"publish","type":"post","link":"https:\/\/www.clonefactor.com\/wordpress\/program\/unity3d\/1529\/","title":{"rendered":"cheap wall vision shape shader."},"content":{"rendered":"<p>\u65b9\u4fbf\u7c21\u55ae\u7684\u6575\u4eba\u8eab\u5f71\u906e\u63a9\u8eab\u5f62\u63d0\u793a&#8230;.\u597d\u7f77\u5176\u5be6\u6211\u4e0d\u660e\u767d\u81ea\u5df1\u525b\u525b\u8aaa\u4e86\u5565.<br \/>\n\u5927\u6982\u5c31\u662f\u9019\u4e00\u7a2e shader<\/p>\n<p>\u60c5\u6cc1:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1531\" src=\"http:\/\/www.clonefactor.com\/wordpress\/wp-content\/uploads\/2016\/07\/wall-vision-shader.gif\" alt=\"wall-vision-shader\" width=\"201\" height=\"201\" \/><br \/>\nRef:\u00a0<a href=\"http:\/\/www.danielkiedrowski.com\/2012\/07\/wall-vision-outline-image-effect-unity-asset-store\/\">http:\/\/www.danielkiedrowski.com\/2012\/07\/wall-vision-outline-image-effect-unity-asset-store\/<\/a><br \/>\n<img decoding=\"async\" src=\"http:\/\/www.danielkiedrowski.com\/wp-content\/uploads\/2012\/07\/wall-vision-outline-effect-title.jpg\" \/><\/p>\n<p>Ref:\u00a0<a href=\"https:\/\/www.assetstore.unity3d.com\/en\/#!\/content\/24707\">https:\/\/www.assetstore.unity3d.com\/en\/#!\/content\/24707<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/d2ujflorbtfzji.cloudfront.net\/package-screenshot\/a76d596c-abee-4df1-adb6-94a7a25a5d1a_scaled.jpg\" width=\"640\" height=\"480\" \/><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/www.assetstore.unity3d.com\/en\/#!\/content\/24707\"><br \/>\n<\/a>\u9019\u4e9b\u5176\u5be6\u53ef\u4ee5\u5229\u7528 SetPass \u7684\u7279\u6027\u4f86\u7c21\u55ae\u5be6\u73fe.<\/p>\n<pre class=\"brush:js\">Properties{\r\n\t\t\/\/ step 1, the color you wanted.\r\n\t\t_OcclusionColor(\"OcclusionColor\", Color) = (0.2426471,0.07530426,0,1)\r\n\t}\r\n\t\r\nSubShader{\r\n\tTags{\r\n\t\t\/\/ step 2, Geometry make the vision display ontop of the others. e.g. building, walls.\r\n\t\t\"Queue\" = \"Geometry+1\" \"RenderType\" = \"Opaque\"\r\n\t}\r\n\tLOD 100\r\n\r\n\tPass{\r\n\t\tZWrite Off\r\n\t\tZTest Greater\r\n\t\tBlend One Zero\r\n\t\t\/\/ step 3, Geometry make the vision display ontop of the others. e.g. building, walls.\r\n\t\tColor[_OcclusionColor]\r\n\t}\r\n\t\r\n\t\/\/ step 4, write a normal drawing shader here.\r\n\t\/\/ because it's ZWrite On and it's called after pervious, therefore it can override the 1st Pass result\r\n\t\/\/ if camera can really saw it on screen.\r\n\tPass{\r\n\t\tName \"FORWARD\"\r\n\t\tTags{\r\n\t\t\t\"LightMode\" = \"ForwardBase\"\r\n\t\t}\r\n\t......\r\n\t}\r\n\t.....\r\n}<\/pre>\n<p>\u7c21\u55ae\u7684\u56db\u500b\u6b65\u9a5f<\/p>\n<ol>\n<li>\u984f\u8272<\/li>\n<li>Geometry \u5730\u5f62+1.. \u7e3d\u4e4b\u6bd4\u5176\u4ed6\u5efa\u7bc9\u7269\u6216\u7246\u7b49\u7b49\u4f7f\u7528\u7684 shader \u7d1a\u5225\u9ad8, +1,+2,+3 \u5982\u6b64\u985e\u63a8.<\/li>\n<li>\u7b2c\u4e00\u500b Pass, Zwrite off, Color[xxx] \u5c31\u662f\u70ba\u4e86\u76f4\u63a5\u628a\u984f\u8272\u8f38\u51fa\u5230 surf.<\/li>\n<li>\u6b63\u5e38\u986f\u793a\u7684 shader<\/li>\n<\/ol>\n<p>\u56e0\u70ba #4 \u7684 Pass \u5728\u4e00\u822c\u80fd\u770b\u898b\u7684\u60c5\u6cc1\u4e0b, \u662f\u5f8c\u7e6a\u7684\u95dc\u4fc2, \u6240\u4ee5\u7b2c\u4e00\u5c64\u7684 Pass \u5c31\u88ab\u53d6\u4ee3, \u6240\u4ee5\u756b\u9762\u7d50\u679c\u6c92\u6709\u986f\u793a\u51fa\u4f86.<br \/>\n\u4f46\u662f\u7576\u4eba\u7269\u88ab\u666e\u901a\u7684\u5efa\u7bc9\u6216\u7246\u906e\u84cb\u7684\u6642\u5019, \u56e0\u70ba ZDepth \u7684\u95dc\u4fc2, \u7b2c\u4e8c\u5c64\u7684 Pass \u4e0d\u6703\u7e6a\u756b.\u00a0\u800c\u7b2c\u4e00\u5c64\u7684\u7d14\u984f\u8272 Pass \u5c31\u986f\u793a\u51fa\u4f86.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65b9\u4fbf\u7c21\u55ae\u7684\u6575\u4eba\u8eab\u5f71\u906e\u63a9\u8eab\u5f62\u63d0\u793a&#8230;.\u597d\u7f77\u5176\u5be6\u6211\u4e0d\u660e\u767d\u81ea\u5df1\u525b\u525b\u8aaa\u4e86\u5565. \u5927\u6982\u5c31\u662f\u9019\u4e00\u7a2e sh &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88,11],"tags":[],"class_list":["post-1529","post","type-post","status-publish","format-standard","hentry","category-shader","category-unity3d"],"_links":{"self":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/1529","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1529"}],"version-history":[{"count":0,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/1529\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}