{"action":"created","issue":{"url":"https://api.github.com/repos/candycat1992/Unity_Shaders_Book/issues/10","repository_url":"https://api.github.com/repos/candycat1992/Unity_Shaders_Book","labels_url":"https://api.github.com/repos/candycat1992/Unity_Shaders_Book/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/candycat1992/Unity_Shaders_Book/issues/10/comments","events_url":"https://api.github.com/repos/candycat1992/Unity_Shaders_Book/issues/10/events","html_url":"https://github.com/candycat1992/Unity_Shaders_Book/issues/10","id":162923436,"number":10,"title":"关于半透明shader","user":{"login":"fenglyu1314","id":20207038,"avatar_url":"https://avatars.githubusercontent.com/u/20207038?v=3","gravatar_id":"","url":"https://api.github.com/users/fenglyu1314","html_url":"https://github.com/fenglyu1314","followers_url":"https://api.github.com/users/fenglyu1314/followers","following_url":"https://api.github.com/users/fenglyu1314/following{/other_user}","gists_url":"https://api.github.com/users/fenglyu1314/gists{/gist_id}","starred_url":"https://api.github.com/users/fenglyu1314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fenglyu1314/subscriptions","organizations_url":"https://api.github.com/users/fenglyu1314/orgs","repos_url":"https://api.github.com/users/fenglyu1314/repos","events_url":"https://api.github.com/users/fenglyu1314/events{/privacy}","received_events_url":"https://api.github.com/users/fenglyu1314/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-29T13:19:36Z","updated_at":"2016-06-29T13:21:22Z","closed_at":null,"body":"我写的半透明shader会出现渲染顺序不对的情况，两个半透明的材质重叠的时候，有时后面的会显示在前面，这个问题困扰了我很久，不知道应该如何解决？"},"comment":{"url":"https://api.github.com/repos/candycat1992/Unity_Shaders_Book/issues/comments/229353525","html_url":"https://github.com/candycat1992/Unity_Shaders_Book/issues/10#issuecomment-229353525","issue_url":"https://api.github.com/repos/candycat1992/Unity_Shaders_Book/issues/10","id":229353525,"user":{"login":"fenglyu1314","id":20207038,"avatar_url":"https://avatars.githubusercontent.com/u/20207038?v=3","gravatar_id":"","url":"https://api.github.com/users/fenglyu1314","html_url":"https://github.com/fenglyu1314","followers_url":"https://api.github.com/users/fenglyu1314/followers","following_url":"https://api.github.com/users/fenglyu1314/following{/other_user}","gists_url":"https://api.github.com/users/fenglyu1314/gists{/gist_id}","starred_url":"https://api.github.com/users/fenglyu1314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fenglyu1314/subscriptions","organizations_url":"https://api.github.com/users/fenglyu1314/orgs","repos_url":"https://api.github.com/users/fenglyu1314/repos","events_url":"https://api.github.com/users/fenglyu1314/events{/privacy}","received_events_url":"https://api.github.com/users/fenglyu1314/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T13:21:22Z","updated_at":"2016-06-29T13:21:22Z","body":"`//描述 : 遮罩透明的suface shader\r\n//作者：CatMya\r\n//时间2016-06-14 16:57:43\r\n\r\n//修改时间：2016-06-17 17:21:52\r\n//修改内容：增加第二张纹理贴图，遮罩贴图使用RGB通道（不需要Alpha通道了），RG控制纹理1和2的遮罩，B通道控制整体的透明\r\n\r\n\r\nShader\"Infinite/terrain/plane_2Texture_mask_alpha\" {\r\n\tProperties {\r\n\t\t_Edge(\"Edge\",Range (0, 1))=0.5\r\n\t\t_Color (\"Main Color\", Color) = (1,1,1,1)\r\n\t\t_Tex1 (\"Texture1 (RGB)\", 2D) = \"white\" {}\r\n\t\t_Tex2 (\"Texture2 (RGB)\", 2D) = \"white\" {}\r\n\t\t_AlphaMask (\"AlphaMask(RGB)\", 2D) = \"white\" {}\r\n\t}\r\n\tSubShader {\r\n\t\tTags {\"Queue\"=\"Transparent\" \"IgnoreProjector\"=\"True\" \"RenderType\"=\"TransparentCutout\"}\r\n\t\tLOD 200\r\n\r\n\t\tCGPROGRAM\r\n\t\t#pragma surface surf Lambert  alpha //noforwardadd\r\n\r\n\t\tfloat _Edge;\r\n\r\n\t\tsampler2D _Tex1;\r\n\t\tsampler2D _Tex2;\r\n\t\tsampler2D _AlphaMask;\r\n\t\tfixed4 _Color;\r\n\r\n\t\tstruct Input {\r\n\t\t\tfloat2 uv_AlphaMask;\r\n\t\t\tfloat2 uv_Tex1;\r\n\t\t\tfloat2 uv_Tex2;\r\n};\r\n\t\t\r\n\r\nvoid surf(Input IN, inout SurfaceOutput o)\r\n{\r\n\t\t\tfixed4 m = tex2D(_AlphaMask, IN.uv_AlphaMask);\r\n\t\t\tfixed4 lay1 = tex2D(_Tex1, IN.uv_Tex1);\r\n\t\t\tfixed3 lay2 = tex2D(_Tex2, IN.uv_Tex2);\r\n\t\t\t//o.Albedo.rgb = (lay1 * m.r + lay2 * m.g) * _Color;\r\n\t\t\to.Alpha = m.b;\r\n\t//o.Alpha = lay1.a;\r\n\tclip(o.Alpha - 0.3);\r\n\r\n\tfloat x = lerp(1, _Edge, smoothstep(0, 0.25, m.r * m.g));\r\n\t\r\n\to.Albedo.rgb = (lay1 * m.r + lay2 * m.g * x) * _Color;\r\n}\r\n\t\tENDCG\r\n\t}\r\n\tFallBack \"Diffuse\"\r\n}\r\n`"}}
{"actor":{"display_login":"fenglyu1314"}}