{"id":291231,"date":"2018-10-23T15:35:02","date_gmt":"2018-10-23T11:35:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=291231"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2018-10-23T11:35:02","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=291231","title":{"rendered":"\u0428\u0435\u0439\u0434\u0435\u0440\u044b \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f \u0438 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0438\u0440\u0430"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<h1>\u0427\u0430\u0441\u0442\u044c 1: \u0448\u0435\u0439\u0434\u0435\u0440 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f<\/h1>\n<p>  <strong>\u0428\u0435\u0439\u0434\u0435\u0440 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f<\/strong> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438 \u043f\u043e\u043d\u044f\u0442\u044c; \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0432 <strong>Unity Shader Graph<\/strong>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043d\u0430 <strong>HLSL<\/strong>.<\/p>\n<p>  \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ce4\/46c\/b99\/ce446cb9949fdee3ed4b29d121aa1c89.gif\"><\/div>\n<h1>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h1>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c <strong>\u0448\u0435\u0439\u0434\u0435\u0440 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f<\/strong> (dissolve shader), \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f <strong>\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c<\/strong> \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <strong>AlphaClipThreshold<\/strong> \u0432 \u0448\u0435\u0439\u0434\u0435\u0440\u0435 \u00abShader Graph\u00bb \u0438\u043b\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 HLSL \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <strong>clip<\/strong>.<\/p>\n<p>  \u041f\u043e \u0441\u0443\u0442\u0438, \u043c\u044b \u043f\u0440\u0438\u043a\u0430\u0436\u0435\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u0443 <strong>\u043d\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u043f\u0438\u043a\u0441\u0435\u043b\u044c<\/strong> \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 <strong>\u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b<\/strong> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e <strong>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/strong>. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: <strong>\u0431\u0435\u043b\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u044f\u044e\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435<\/strong>.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0442\u0430\u043a\u0443\u044e \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1cc\/f52\/1cd\/1ccf521cdd1ba16cdaa45b33ae50fec4.png\"><\/div>\n<p>  \u041c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u2014 \u043f\u0440\u044f\u043c\u044b\u0435, \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438, \u0434\u0430 \u0432\u0441\u0451, \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e! \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e <strong>\u0431\u0435\u043b\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u044f\u044e\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435<\/strong>.<\/p>\n<p>  \u042d\u0442\u0443 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0432 Photoshop, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u043c \u00abClouds\u00bb.<\/p>\n<p>  \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e Shader Graph \u0438 \u0432\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442\u0435 \u043e HLSL, \u0442\u043e \u044f \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u044d\u0442\u0443 \u0447\u0430\u0441\u0442\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u043a\u0430\u043a Unity Shader Graph \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0438.<\/p>\n<hr>\n<p>  <\/p>\n<h1>HLSL<\/h1>\n<p>  \u0412 HLSL \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>clip(x)<\/strong>. \u0424\u0443\u043d\u043a\u0446\u0438\u044f <strong>clip(x)<\/strong> \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 <strong>\u043d\u0443\u043b\u044f<\/strong>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u044b\u0437\u043e\u0432\u0435\u043c <strong>clip(-1)<\/strong>, \u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0448\u0435\u0439\u0434\u0435\u0440 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0438\u043a\u0441\u0435\u043b\u044c. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e <strong>clip <\/strong> \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"https:\/\/docs.microsoft.com\/it-it\/windows\/desktop\/direct3dhlsl\/dx-graphics-hlsl-clip\">Microsoft Docs<\/a>.<\/p>\n<h4>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430<\/h4>\n<p>  \u0428\u0435\u0439\u0434\u0435\u0440\u0443 \u043d\u0443\u0436\u043d\u044b \u0434\u0432\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, <strong>Dissolve Texture<\/strong> \u0438 <strong>Amount<\/strong> (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f). \u041a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0438\u0445 \u043a\u0430\u043a \u0443\u0433\u043e\u0434\u043d\u043e.<\/p>\n<pre><code>Properties {     \/\/Your other properties     \/\/[...]       \/\/Dissolve shader properties     _DissolveTexture(\"Dissolve Texture\", 2D) = \"white\" {}     _Amount(\"Amount\", Range(0,1)) = 0  }<\/code><\/pre>\n<p>  \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435 CGPROGRAM SubShader \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 (\u0438\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435):<\/p>\n<pre><code>sampler2D _DissolveTexture; half _Amount;<\/code><\/pre>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435. \u0447\u0442\u043e \u0438\u0445 \u0438\u043c\u0435\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u0430\u043c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Properties.<\/p>\n<h4>\u0424\u0443\u043d\u043a\u0446\u0438\u044f<\/h4>\n<p>  \u041c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>Surface<\/strong> \u0438\u043b\u0438 <strong>Fragment<\/strong> \u0441 \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <strong>\u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f<\/strong> \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f <strong>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e<\/strong>. P.S. \u041d\u0430\u0448\u0430 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430 \u0432 <strong>\u0433\u0440\u0430\u0434\u0430\u0446\u0438\u044f\u0445 \u0441\u0435\u0440\u043e\u0433\u043e<\/strong>, \u0442\u043e \u0435\u0441\u0442\u044c \u0435\u0451 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <strong>R<\/strong>, <strong>G<\/strong> \u0438 <strong>B<\/strong> \u0440\u0430\u0432\u043d\u044b, \u0438 \u043c\u043e\u0436\u043d\u043e <strong>\u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u0438\u0437 \u043d\u0438\u0445<\/strong>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <strong>\u0431\u0435\u043b\u044b\u0439<\/strong> \u0440\u0430\u0432\u0435\u043d <strong>(1,1,1)<\/strong>, <strong>\u0447\u0451\u0440\u043d\u044b\u0439<\/strong> \u0440\u0430\u0432\u0435\u043d <strong>(0,0,0)<\/strong>.<\/p>\n<p>  \u0412 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440:<\/p>\n<pre><code>void surf (Input IN, inout SurfaceOutputStandard o) {       half dissolve_value = tex2D(_DissolveTexture, IN.uv_MainTex).r; \/\/Get how much we have to dissolve based on our dissolve texture     clip(dissolve_value - _Amount); \/\/Dissolve!       \/\/Your shader body, you can set the Albedo etc.     \/\/[...] }<\/code><\/pre>\n<p>  <strong>\u0418 \u0432\u0441\u0451!<\/strong> \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u0438\u043c\u0435\u044e\u0449\u0435\u043c\u0443\u0441\u044f \u0448\u0435\u0439\u0434\u0435\u0440\u0443 \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 <strong>\u0448\u0435\u0439\u0434\u0435\u0440 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f<\/strong>!<\/p>\n<p>  \u0412\u043e\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 Surface Shader \u0434\u0432\u0438\u0436\u043a\u0430 Unity, \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0451\u043d\u043d\u044b\u0439 \u0432 <strong>\u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439<\/strong> <strong>\u0448\u0435\u0439\u0434\u0435\u0440 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f:<\/strong><\/p>\n<pre><code>Shader \"Custom\/DissolveSurface\" {  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    \/\/Dissolve properties  _DissolveTexture(\"Dissolve Texutre\", 2D) = \"white\" {}   _Amount(\"Amount\", Range(0,1)) = 0  }    SubShader {  Tags { \"RenderType\"=\"Opaque\" }  LOD 200  Cull Off \/\/Fast way to turn your material double-sided    CGPROGRAM  #pragma surface surf Standard fullforwardshadows    #pragma target 3.0    sampler2D _MainTex;    struct Input {  float2 uv_MainTex;  };    half _Glossiness;  half _Metallic;  fixed4 _Color;    \/\/Dissolve properties  sampler2D _DissolveTexture;  half _Amount;    void surf (Input IN, inout SurfaceOutputStandard o) {    \/\/Dissolve function  half dissolve_value = tex2D(_DissolveTexture, IN.uv_MainTex).r;  clip(dissolve_value - _Amount);    \/\/Basic shader function  fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;     o.Albedo = c.rgb;  o.Metallic = _Metallic;  o.Smoothness = _Glossiness;  o.Alpha = c.a;  }  ENDCG  }  FallBack \"Diffuse\" }<\/code><\/pre>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h1>Shader Graph<\/h1>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u044d\u0444\u0444\u0435\u043a\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Unity <strong>Shader Graph<\/strong>, \u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <strong>AlphaClipThreshold<\/strong> (\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u043d\u0430\u0447\u0435, \u0447\u0435\u043c <strong>clip(x)<\/strong> \u0438\u0437 HLSL). \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f \u0441\u043e\u0437\u0434\u0430\u043b PBR-\u0448\u0435\u0439\u0434\u0435\u0440.<\/p>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f <strong>AlphaClipThreshold<\/strong> \u043f\u0440\u0438\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0448\u0435\u0439\u0434\u0435\u0440\u0443 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0438, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0435\u043d\u044c\u0448\u0435 \u0435\u0451 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <strong>Alpha<\/strong>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u0440\u0430\u0432\u043d\u043e <strong>0.3f<\/strong>, \u0430 \u043d\u0430\u0448\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u043b\u044c\u0444\u044b \u0440\u0430\u0432\u043d\u043e <strong>0.2f<\/strong>, \u0442\u043e \u0448\u0435\u0439\u0434\u0435\u0440 <strong>\u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c<\/strong> \u044d\u0442\u043e\u0442 \u043f\u0438\u043a\u0441\u0435\u043b\u044c. \u041e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <strong>AlphaClipThreshold<\/strong> \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <strong>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Unity<\/strong>: <a href=\"https:\/\/github.com\/Unity-Technologies\/ShaderGraph\/wiki\/PBR-Master-Node\">PBR Master Node<\/a> \u0438 <a href=\"https:\/\/github.com\/Unity-Technologies\/ShaderGraph\/wiki\/Unlit-Master-Node\"> Unlit Master Node<\/a>.<\/p>\n<p>  \u0412\u043e\u0442 \u043d\u0430\u0448 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1b9\/368\/ede\/1b9368ede92dad1544f3ca702a2924ad.png\"><\/div>\n<p>  \u041c\u044b \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u0443\u0435\u043c <strong>\u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f<\/strong> \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c <strong>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e<\/strong>, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e <strong>Amount<\/strong> (\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0435 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0435) \u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u043a <strong>AlphaClipThreshold<\/strong>. <strong>\u0413\u043e\u0442\u043e\u0432\u043e!<\/strong><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u0438\u043c\u0435\u044e\u0449\u0435\u043c\u0443\u0441\u044f \u0448\u0435\u0439\u0434\u0435\u0440\u0443, \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e <strong>\u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435<\/strong> <strong>\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u043e\u0434\u043e\u0432<\/strong> \u0432 <strong>AlphaClipThreshold<\/strong> (\u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430!). \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e <strong>\u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c<\/strong> \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0449\u0451 \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442!<\/p>\n<hr>\n<p>  <\/p>\n<h1>\u0428\u0435\u0439\u0434\u0435\u0440 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f \u0441 \u043a\u043e\u043d\u0442\u0443\u0440\u0430\u043c\u0438<\/h1>\n<p>  \u0410 \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043d\u0435\u043c\u0443 <strong>\u043a\u043e\u043d\u0442\u0443\u0440\u044b<\/strong>? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u043c!<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c59\/0db\/e64\/c590dbe64e954bdc6c7ce1154726e80b.gif\"><\/div>\n<p>  \u041c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0443\u0436\u0435 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0438\u0432\u0448\u0438\u043c\u0438\u0441\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u043c\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0438\u0445 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u044f <em>\u043e\u043d\u0438 \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u043d\u0430\u0432\u0441\u0435\u0433\u0434\u0430<\/em>. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u00ab\u043f\u043e\u0447\u0442\u0438 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0438\u0432\u0448\u0438\u043c\u0438\u0441\u044f\u00bb \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438!<\/p>\n<p>  \u0412 <strong>HLSL<\/strong> \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 <strong>clip<\/strong>:<\/p>\n<pre><code>void surf (Input IN, inout SurfaceOutputStandard o) {  \/\/[...]  \/\/After our clip calculations  if (dissolve_value - _Amount &lt; .05f) \/\/outline width = .05f  o.Emission = fixed3(1, 1, 1); \/\/emits white color    \/\/Your shader body, you can set the Albedo etc.   \/\/[...]  }<\/code><\/pre>\n<p>  <strong>\u0413\u043e\u0442\u043e\u0432\u043e!<\/strong><\/p>\n<p>  \u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 <strong>Shader Graph<\/strong> \u043b\u043e\u0433\u0438\u043a\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f. \u0412\u043e\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e26\/288\/1ef\/e262881ef6ad042856b345ba2d9f2765.png\"><\/div>\n<p>  <\/p>\n<hr>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c <strong>\u043a\u0440\u0443\u0442\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b<\/strong> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e <strong>\u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f<\/strong>; \u043c\u043e\u0436\u043d\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 <strong>\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0430\u043c\u0438<\/strong> \u0438 <strong>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438<\/strong>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0435\u0449\u0451!<\/p>\n<h1>\u0427\u0430\u0441\u0442\u044c 2: \u0448\u0435\u0439\u0434\u0435\u0440 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0438\u0440\u0430<\/h1>\n<p>  \u0428\u0435\u0439\u0434\u0435\u0440 <strong>\u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0438\u0440\u0430<\/strong> (\u0438\u043b\u0438 &#171;<strong>\u0448\u0435\u0439\u0434\u0435\u0440 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f \u043c\u0438\u0440\u0430<\/strong>&#171;, \u0438\u043b\u0438 <strong>\u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0435<\/strong>&#171;) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0441\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u0446\u0435\u043d\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u0445 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u0438; \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0448\u0435\u0439\u0434\u0435\u0440 \u0432 <strong>Unity Shader Graph<\/strong> \u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0435\u0433\u043e \u043d\u0430 <strong>HLSL<\/strong>.<\/p>\n<p>  \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/228\/7bb\/169\/2287bb1692d36eae92224f36359648a3.gif\"><\/div>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h2>\u0420\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440<\/h2>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e <strong>\u0440\u0430\u0441\u0442\u0432\u043e\u0440\u044f\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442<\/strong> \u0432 \u0441\u0446\u0435\u043d\u0435, \u0435\u0441\u043b\u0438 \u043e\u043d <strong>\u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u0430\u043b\u0435\u043a\u043e \u043e\u0442 \u0438\u0433\u0440\u043e\u043a\u0430<\/strong>. \u041c\u044b \u0443\u0436\u0435 \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <strong>_Amount<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0438\u0441\u0447\u0435\u0437\u0430\u043d\u0438\u044f\/\u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043c\u0435\u0436\u0434\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u0438 \u0438\u0433\u0440\u043e\u043a\u043e\u043c.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 <strong>Player<\/strong> \u0438 <strong>Object<\/strong>.<\/p>\n<h3>\u041f\u043e\u0437\u0438\u0446\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430<\/h3>\n<p>  <strong>\u041f\u0440\u043e\u0446\u0435\u0441\u0441<\/strong> \u0431\u0443\u0434\u0435\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0438 \u0434\u043b\u044f <strong>Unity Shader Graph<\/strong>, \u0438 \u0434\u043b\u044f <strong>HLSL<\/strong>: \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u0434\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<pre><code>private void Update() {     \/\/Updates the _PlayerPos variable in all the shaders     \/\/Be aware that the parameter name has to match the one in your shaders or it wont' work     Shader.SetGlobalVector(\"_PlayerPos\", transform.position); \/\/\"transform\" is the transform of the Player }<\/code><\/pre>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h2>Shader Graph<\/h2>\n<p>  <\/p>\n<h4>\u041f\u043e\u0437\u0438\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e \u043d\u0435\u0433\u043e<\/h4>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Shader Graph \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0434\u044b Position \u0438 Distance.<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/Unity-Technologies\/ShaderGraph\/wiki\/Position-Node\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043f\u043e \u043d\u043e\u0434\u0443 Position<\/a>.<\/li>\n<li><a href=\"https:\/\/github.com\/Unity-Technologies\/ShaderGraph\/wiki\/Distance-Node\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e \u043d\u043e\u0434\u0443 Distance<\/a>.<\/li>\n<\/ul>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7b1\/cdb\/078\/7b1cdb078a844a10451317e40a14df7c.png\"><\/div>\n<p>  P.S. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u0441\u043e Sprite Renderers, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e _MainTex, \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0441 albedo. \u041c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043c\u043e\u0439 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b <a href=\"https:\/\/www.febucci.com\/tutorials\/shaders\/sprite-diffuse-shader\/\">Sprites diffuse shader<\/a> (\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f shader graph).<\/p>\n<hr>\n<p>  <\/p>\n<h2>HLSL (\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c)<\/h2>\n<p>  <\/p>\n<h4>\u041f\u043e\u0437\u0438\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430<\/h4>\n<p>  \u0412 HLSL \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0448\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <strong>Input<\/strong> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <strong>worldPos<\/strong> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0432\u0435\u0440\u0448\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<pre><code>struct Input  {  float2 uv_MainTex;  float3 worldPos; \/\/add this and Unity will set it automatically };<\/code><\/pre>\n<p>  \u041d\u0430 <a href=\"https:\/\/docs.unity3d.com\/Manual\/SL-SurfaceShaders.html\">\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Unity<\/a> \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 Input.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435<\/h4>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0438 \u0438\u0433\u0440\u043e\u043a\u043e\u043c \u043a\u0430\u043a \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>distance<\/strong> (<a href=\"https:\/\/docs.microsoft.com\/it-it\/windows\/desktop\/direct3dhlsl\/dx-graphics-hlsl-distance\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f Microsoft<\/a>).<\/p>\n<pre><code>void surf (Input IN, inout SurfaceOutputStandard o) {  half dissolve_value = tex2D(_DissolveTexture, IN.uv_MainTex).x;    float dist = distance(_PlayerPos, IN.worldPos);    clip(dissolve_value - dist\/ 6f); \/\/\"6\" is the maximum distance where your object will start showing    \/\/Set albedo, alpha, smoothness etc[...] }<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (3D)<\/h3>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/868\/f5c\/2e8\/868f5c2e803708138c71f84c95e3390c.gif\"><\/div>\n<p>  <\/p>\n<h3>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (2D)<\/h3>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/289\/380\/e2b\/289380e2ba53cbe569621821affc7009.gif\"><\/div>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u044f\u044e\u0442\u0441\u044f \u00ab\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u00bb, \u0443 \u043d\u0430\u0441 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u00ab\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f\u00bb \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b, \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e UV \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. (\u0412 2D \u044d\u0442\u043e \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u043c\u0435\u0442\u043d\u043e).<\/p>\n<hr>\n<p>  <\/p>\n<h3>\u0422\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u044b\u0439 LocalUV Dissolve Shader \u043d\u0430 HLSL<\/h3>\n<p>  <\/p>\n<pre><code>Shader \"Custom\/GlobalDissolveSurface\" {  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    _DissolveTexture(\"Dissolve texture\", 2D) = \"white\" {}  _Radius(\"Distance\", Float) = 1 \/\/distance where we start to reveal the objects  }  SubShader{  Tags { \"RenderType\" = \"Opaque\" }  LOD 200  Cull off \/\/material is two sided    CGPROGRAM    #pragma surface surf Standard fullforwardshadows    #pragma target 3.0    sampler2D _MainTex;  sampler2D _DissolveTexture; \/\/texture where we get the dissolve value    struct Input  {  float2 uv_MainTex;  float3 worldPos; \/\/Built-in world position  };    half _Glossiness;  half _Metallic;  fixed4 _Color;    float3 _PlayerPos; \/\/\"Global Shader Variable\", contains the Player Position  float _Radius;     void surf (Input IN, inout SurfaceOutputStandard o) {    half dissolve_value = tex2D(_DissolveTexture, IN.uv_MainTex).x;    float dist = distance(_PlayerPos, IN.worldPos);    clip(dissolve_value - dist\/ _Radius);    fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;  o.Albedo = c.rgb;  o.Metallic = _Metallic;  o.Smoothness = _Glossiness;  o.Alpha = c.a;  }    ENDCG  }  FallBack \"Diffuse\" }<\/code><\/pre>\n<p>  <\/p>\n<h3>Sprites Diffuse \u2013 LocalUV Dissolve Shader \u043d\u0430 HLSL<\/h3>\n<p>  <\/p>\n<pre><code>Shader \"Custom\/GlobalDissolveSprites\" {  Properties  {  [PerRendererData] _MainTex(\"Sprite Texture\", 2D) = \"white\" {}  _Color(\"Tint\", Color) = (1,1,1,1)  [MaterialToggle] PixelSnap(\"Pixel snap\", Float) = 0  [HideInInspector] _RendererColor(\"RendererColor\", Color) = (1,1,1,1)  [HideInInspector] _Flip(\"Flip\", Vector) = (1,1,1,1)  [PerRendererData] _AlphaTex(\"External Alpha\", 2D) = \"white\" {}  [PerRendererData] _EnableExternalAlpha(\"Enable External Alpha\", Float) = 0      _DissolveTexture(\"Dissolve texture\", 2D) = \"white\" {}  _Radius(\"Distance\", Float) = 1 \/\/distance where we start to reveal the objects  }    SubShader  {  Tags  {  \"Queue\" = \"Transparent\"  \"IgnoreProjector\" = \"True\"  \"RenderType\" = \"Transparent\"  \"PreviewType\" = \"Plane\"  \"CanUseSpriteAtlas\" = \"True\"  }    Cull Off  Lighting Off  ZWrite Off  Blend One OneMinusSrcAlpha    CGPROGRAM  #pragma surface surf Lambert vertex:vert nofog nolightmap nodynlightmap keepalpha noinstancing  #pragma multi_compile _ PIXELSNAP_ON  #pragma multi_compile _ ETC1_EXTERNAL_ALPHA  #include \"UnitySprites.cginc\"    struct Input  {  float2 uv_MainTex;  fixed4 color;  float3 worldPos; \/\/Built-in world position  };    sampler2D _DissolveTexture; \/\/texture where we get the dissolve value  float3 _PlayerPos; \/\/\"Global Shader Variable\", contains the Player Position  float _Radius;    void vert(inout appdata_full v, out Input o)  {  v.vertex = UnityFlipSprite(v.vertex, _Flip);    #if defined(PIXELSNAP_ON)  v.vertex = UnityPixelSnap(v.vertex);  #endif    UNITY_INITIALIZE_OUTPUT(Input, o);  o.color = v.color * _Color * _RendererColor;  }    void surf(Input IN, inout SurfaceOutput o)  {  half dissolve_value = tex2D(_DissolveTexture, IN.uv_MainTex).x;  float dist = distance(_PlayerPos, IN.worldPos);  clip(dissolve_value - dist \/ _Radius);    fixed4 c = SampleSpriteTexture(IN.uv_MainTex) * IN.color;  o.Albedo = c.rgb * c.a;  o.Alpha = c.a;  }    ENDCG  }    Fallback \"Transparent\/VertexLit\" }<\/code><\/pre>\n<p>  P.S. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u044f \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440 Unity Sprites-Diffuse \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0447\u0430\u0441\u0442\u044c \u0441 \u00ab\u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0435\u043c\u00bb, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438. \u0412\u0441\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0448\u0435\u0439\u0434\u0435\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/unity3d.com\/get-unity\/download\/archive\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<hr>\n<p>  <\/p>\n<h2>\u0414\u0435\u043b\u0430\u0435\u043c \u044d\u0444\u0444\u0435\u043a\u0442 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u043c<\/h2>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 UV-\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b (\u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0432 \u043c\u0438\u0440\u0435). \u0422\u0430\u043a\u0436\u0435 \u0432\u0430\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f <strong>Wrap = Repeat<\/strong>, \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443, \u043d\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u044f \u044d\u0442\u043e\u0433\u043e (\u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0430 \u0431\u0435\u0441\u0448\u043e\u0432\u043d\u0430 \u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f!)<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7db\/b9f\/e0e\/7dbb9fe0e582bf7a63b2dccfb43a9b9b.png\"><\/div>\n<p>  <\/p>\n<h4>HLSL (\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c)<\/h4>\n<p>  <\/p>\n<pre><code>half dissolve_value = tex2D(_DissolveTexture, IN.worldPos \/ 4).x; \/\/I modified the worldPos to reduce the texture size<\/code><\/pre>\n<p>  <\/p>\n<h4>Shader Graph<\/h4>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/787\/167\/9c6\/7871679c66cab1c842fe02c5ce523884.png\"><\/div>\n<p>  <\/p>\n<h3>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (2D)<\/h3>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/428\/b34\/425\/428b344254f3e80ef68b63ba8754dfa2.gif\"><\/div>\n<p>  \u042d\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0430 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043c\u0438\u0440\u0430.<\/p>\n<p>  \u042d\u0442\u043e\u0442 \u0448\u0435\u0439\u0434\u0435\u0440 \u0443\u0436\u0435 <strong>\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f 2D-\u0438\u0433\u0440<\/strong>, \u043d\u043e \u0434\u043b\u044f <strong>3D-\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/strong> \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e <strong>\u0443\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c<\/strong>.<\/p>\n<h3>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 3D-\u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438<\/h3>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/231\/1f4\/09b\/2311f409be1ca990c276895eb8e49695.png\"><\/div>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0448\u0435\u0439\u0434\u0435\u0440 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u00ab\u043d\u0435\u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445\u00bb \u0433\u0440\u0430\u043d\u0435\u0439, \u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u0438\u0441\u043a\u0430\u0436\u0430\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443. \u0422\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043c\u0443. \u0447\u0442\u043e UV-\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 float2, \u0430 \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c worldPos, \u0442\u043e \u043e\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e X \u0438 Y.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0432 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b \u043d\u0430 \u0432\u0441\u0435\u0445 \u0433\u0440\u0430\u043d\u044f\u0445, \u0442\u043e \u043c\u044b \u043f\u0440\u0438\u0434\u0451\u043c \u043a \u043d\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435: \u043f\u0440\u0438 \u0437\u0430\u0442\u0435\u043c\u043d\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c, \u0430 \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0443\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u043c\u0438.<\/p>\n<p>  \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u044c \u043d\u043e\u0432\u0438\u0447\u043a\u0430\u043c: \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043c\u0438\u0440\u0435 \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u044b\u0439 \u0448\u0443\u043c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u00ab\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f\u00bb \u0438\u0437 \u043d\u0435\u0433\u043e. \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e 3D-\u0448\u0443\u043c\u0430, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043a\u0443\u0447\u0443 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0439!<\/p>\n<p>  \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u0448\u0443\u043c\u0430: <a href=\"https:\/\/github.com\/keijiro\/NoiseShader\">https:\/\/github.com\/keijiro\/NoiseShader<\/a>. \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0448\u0443\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/thebookofshaders.com\/11\/\">https:\/\/thebookofshaders.com\/11\/<\/a> \u0438 \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/catlikecoding.com\/unity\/tutorials\/noise\/\">https:\/\/catlikecoding.com\/unity\/tutorials\/noise\/<\/a><\/p>\n<p>  \u042f \u0437\u0430\u0434\u0430\u043c \u0441\u0432\u043e\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (\u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044f, \u0447\u0442\u043e \u0432\u044b \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0447\u0430\u0441\u0442\u044c \u0441 \u0448\u0443\u043c\u043e\u043c):<\/p>\n<pre><code>void surf (Input IN, inout SurfaceOutputStandard o) {    float dist = distance(_PlayerPos, IN.worldPos);    \/\/\"abs\" because you have to make sure that the noise is between the range [0,1]  \/\/you can remove \"abs\" if your noise function returns a value between [0,1]         \/\/also, replace \"NOISE_FUNCTION_HERE\" with your 3D noise function.  half dissolve_value = abs(NOISE_FUNCTION_HERE(IN.worldPos));    if (dist &gt; _Radius) {  float clip_value = dissolve_value - ((dist - _Radius) \/ _Radius);  clip(clip_value);    if (clip_value &lt; 0.05f)  o.Emission = float3(1, 1, 1);  }      fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;  o.Albedo = c.rgb;  o.Metallic = _Metallic;  o.Smoothness = _Glossiness;  o.Alpha = c.a; }<\/code><\/pre>\n<p>  \u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435 \u043e HLSL: \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\/\u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0435\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c\/\u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c.<\/p>\n<p>  P.S. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0448\u0435\u0439\u0434\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Unity Shader Graph, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Custom Nodes (\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0448\u0443\u043c, \u043d\u0430\u043f\u0438\u0441\u0430\u0432 \u0432 \u043d\u0438\u0445 \u043a\u043e\u0434 \u043d\u0430 HLSL). \u041e Custom Nodes \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435.<\/p>\n<h3>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (3D)<\/h3>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ce6\/a89\/ad3\/ce6a89ad324ff4a03d4bfabf1a694024.gif\"><\/div>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0443\u0440\u043e\u0432<\/h2>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0443\u0440\u044b, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/228\/7bb\/169\/2287bb1692d36eae92224f36359648a3.gif\"><\/div>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h2>\u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442<\/h2>\n<p>  \u0410 \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u044d\u0444\u0444\u0435\u043a\u0442? (\u041e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u0447\u0435\u0437\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0440\u044f\u0434\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0433\u0440\u043e\u043a)<\/p>\n<p>  \u041d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443: <\/p>\n<pre><code>float dist = _Radius - distance(_PlayerPos, IN.worldPos);<\/code><\/pre>\n<p>  (\u0422\u043e\u0442 \u0436\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a Shader Graph).<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/579\/86c\/1f9\/57986c1f96a56f1ec478b64c89be3eba.gif\"><\/div>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/427401\/\"> https:\/\/habr.com\/post\/427401\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<h1>\u0427\u0430\u0441\u0442\u044c 1: \u0448\u0435\u0439\u0434\u0435\u0440 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f<\/h1>\n<p>  <strong>\u0428\u0435\u0439\u0434\u0435\u0440 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f<\/strong> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438 \u043f\u043e\u043d\u044f\u0442\u044c; \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0432 <strong>Unity Shader Graph<\/strong>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043d\u0430 <strong>HLSL<\/strong>.<\/p>\n<p>  \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ce4\/46c\/b99\/ce446cb9949fdee3ed4b29d121aa1c89.gif\"><\/div>\n<h1>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h1>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c <strong>\u0448\u0435\u0439\u0434\u0435\u0440 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f<\/strong> (dissolve shader), \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f <strong>\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c<\/strong> \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <strong>AlphaClipThreshold<\/strong> \u0432 \u0448\u0435\u0439\u0434\u0435\u0440\u0435 \u00abShader Graph\u00bb \u0438\u043b\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 HLSL \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <strong>clip<\/strong>.<\/p>\n<p>  \u041f\u043e \u0441\u0443\u0442\u0438, \u043c\u044b \u043f\u0440\u0438\u043a\u0430\u0436\u0435\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u0443 <strong>\u043d\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u043f\u0438\u043a\u0441\u0435\u043b\u044c<\/strong> \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 <strong>\u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b<\/strong> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e <strong>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/strong>. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: <strong>\u0431\u0435\u043b\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u044f\u044e\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435<\/strong>.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-291231","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=291231"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291231\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=291231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=291231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=291231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}