{"id":42,"date":"2011-08-09T02:14:41","date_gmt":"2011-08-08T23:14:41","guid":{"rendered":"http:\/\/unitycoder.com\/blog\/?p=42"},"modified":"2011-08-09T03:38:04","modified_gmt":"2011-08-09T00:38:04","slug":"black-light-shader-fake-shadow","status":"publish","type":"post","link":"https:\/\/unitycoder.com\/blog\/2011\/08\/09\/black-light-shader-fake-shadow\/","title":{"rendered":"Black light shader (fake shadow)"},"content":{"rendered":"<p><a href=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2011\/08\/black_shader1.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"47\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2011\/08\/09\/black-light-shader-fake-shadow\/black_shader1\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2011\/08\/black_shader1.jpg?fit=580%2C351&amp;ssl=1\" data-orig-size=\"580,351\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"black_shader1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2011\/08\/black_shader1.jpg?fit=580%2C351&amp;ssl=1\" class=\"alignnone size-full wp-image-47\" title=\"black_shader1\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2011\/08\/black_shader1.jpg?resize=580%2C351\" alt=\"\" width=\"580\" height=\"351\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2011\/08\/black_shader1.jpg?w=580&amp;ssl=1 580w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2011\/08\/black_shader1.jpg?resize=300%2C181&amp;ssl=1 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p>My first shader test. I know there is already blob shadow, using &#8220;projector&#8221;, but wanted to try editing some shader examples. You set this shader to the object you want to receive black light from the spotlight.<\/p>\n<p><strong>Instructions:<\/strong><\/p>\n<p>Get the original code for the shader: <strong>Simple Specular<\/strong><br \/>\n<a href=\"http:\/\/unity3d.com\/support\/documentation\/Components\/SL-SurfaceShaderLightingExamples.html\" target=\"_blank\">http:\/\/unity3d.com\/support\/documentation\/Components\/SL-SurfaceShaderLightingExamples.html<\/a><\/p>\n<p>Then modify just 1 line,<br \/>\nfind:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec) * (atten * 2);<\/pre>\n<p>Replace (or edit the line) with this:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">c.rgb = (s.Albedo * _LightColor0.rgb) * ((1-atten*(_LightColor0.a*2)*1.5));<\/pre>\n<p>What it does: Attenuation is reversed &#8220;<em>1-atten<\/em>&#8221; and the black color strength is taken from &#8220;<em>_LightColor0.a&#8221;, <\/em>ie. spotlight Alpha setting.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My first shader test. I know there is already blob shadow, using &#8220;projector&#8221;, but wanted to try editing some shader examples. You set this shader to the object you want to receive black light from the spotlight. Instructions: Get the original code for the shader: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":47,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[13,3],"tags":[14],"class_list":["post-42","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-shaders","category-unity3d","tag-shader"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2011\/08\/black_shader1.jpg?fit=580%2C351&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1KTaT-G","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":6,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"predecessor-version":[{"id":45,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/42\/revisions\/45"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media\/47"}],"wp:attachment":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}