{"id":2068,"date":"2013-07-16T04:26:48","date_gmt":"2013-07-16T01:26:48","guid":{"rendered":"http:\/\/unitycoder.com\/blog\/?p=2068"},"modified":"2020-04-16T18:23:11","modified_gmt":"2020-04-16T15:23:11","slug":"normal-specular-map-generator-from-texture","status":"publish","type":"post","link":"https:\/\/unitycoder.com\/blog\/2013\/07\/16\/normal-specular-map-generator-from-texture\/","title":{"rendered":"[AssetStore] Normal &#038; Specular Map Generator from Texture"},"content":{"rendered":"<p><a href=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/poormans_normal_specular_map_generator_unity3d_big.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2069\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2013\/07\/16\/normal-specular-map-generator-from-texture\/poormans_normal_specular_map_generator_unity3d\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/poormans_normal_specular_map_generator_unity3d.jpg?fit=680%2C282&amp;ssl=1\" data-orig-size=\"680,282\" 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=\"poormans_normal_specular_map_generator_unity3d\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/poormans_normal_specular_map_generator_unity3d.jpg?fit=680%2C282&amp;ssl=1\" class=\"alignnone size-full wp-image-2069\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/poormans_normal_specular_map_generator_unity3d.jpg?resize=680%2C282\" alt=\"poormans_normal_specular_map_generator_unity3d\" width=\"680\" height=\"282\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/poormans_normal_specular_map_generator_unity3d.jpg?w=680&amp;ssl=1 680w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/poormans_normal_specular_map_generator_unity3d.jpg?resize=300%2C124&amp;ssl=1 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/a><br \/>\nWorking on simple poor man&#8217;s <a title=\"http:\/\/wiki.polycount.com\/NormalMap\/\" href=\"http:\/\/wiki.polycount.com\/NormalMap\/\" target=\"_blank\" rel=\"noopener noreferrer\">normal map<\/a> &amp; <a title=\"http:\/\/www.rastertek.com\/dx10tut21.html\" href=\"http:\/\/www.rastertek.com\/dx10tut21.html\" target=\"_blank\" rel=\"noopener noreferrer\">specular map<\/a> generator editor script.. (click image to view full size)<br \/>\nLeft side = original bitmap, Right side = generated normal map + specular map<\/p>\n<p><strong>*Github:<\/strong> <a href=\"https:\/\/github.com\/unitycoder\/NormalMapFromTexture\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/unitycoder\/NormalMapFromTexture<\/a><\/p>\n<p><strong>Asset Store<\/strong>: <a title=\"http:\/\/u3d.as\/content\/mgear\/normal-map-maker\/5bA\" href=\"http:\/\/u3d.as\/content\/mgear\/normal-map-maker\/5bA\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.assetstore.unity3d.com\/#!\/content\/10388?aid=1101lGti<br \/>\n<\/a><strong>Unity Forum Thread:<\/strong> <a title=\"http:\/\/forum.unity3d.com\/threads\/normal-map-maker.254310\/\" href=\"http:\/\/forum.unity3d.com\/threads\/normal-map-maker.254310\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/forum.unity3d.com\/threads\/normal-map-maker.254310\/<\/a><\/p>\n<p>&#8212;<\/p>\n<p><strong>Features:<\/strong><br \/>\n&#8211; Creates normal (bump) map from texture (works ok, with adjustable strength &amp; optional blur filter)<br \/>\n&#8211; Basic Specular map calculation (on that main image specular map was handmade)<br \/>\n&#8211; If texture is not readable, set it automatically on for reading, then restore it to off<br \/>\n&#8211; User can cancel map generation (median filter can take a while on a big texture..)<\/p>\n<p><strong>Todo:<\/strong><br \/>\n<del>&#8211; Editor GUI<\/del><br \/>\n<del> &#8211; Progress bar with cancel button<\/del><br \/>\n<del> &#8211; Optimize image processing (using setpixel now, setpixels would be faster)<\/del> (For now only in median filter)<br \/>\n<del>&#8211; Try using invoke? then it runs in background in editor(?)<\/del> (not this time..)<br \/>\n<del>&#8211; Documentation<\/del><br \/>\n<del>&#8211; Specular map generator is not good quality..<\/del>maybe in later versions can do better<br \/>\n<del>&#8211; Set created normal map as [x] normal map.. (so that &#8220;fix now&#8221; button wouldnt appear)<\/del><br \/>\n<del>&#8211; Texture leak warning..<\/del> (it was from median filter temporary texture, it wasnt cleared with <a title=\"http:\/\/docs.unity3d.com\/Documentation\/ScriptReference\/Object.DestroyImmediate.html\" href=\"http:\/\/docs.unity3d.com\/Documentation\/ScriptReference\/Object.DestroyImmediate.html\" target=\"_blank\" rel=\"noopener noreferrer\">DestroyImmediate<\/a>)<br \/>\n&#8211; Request: Invert normal button (also invidual X, Y, Z flip)<br \/>\n&#8211; Request: Realtime preview (adding small texture previews first)<br \/>\n&#8211; Bugfix: AssetPostprocessor doesnt always run.. (Temporary fix, comment out line &#8220;if (!NormalMapMaker.running) return;&#8221;<br \/>\n&#8211; Feature: Add maximum texture size inside AssetPostProcessor<\/p>\n<p><strong>Webplayer:<\/strong><br \/>\n<a title=\"http:\/\/unitycoder.com\/upload\/demos\/NormapMapMaker1\/\" href=\"http:\/\/unitycoder.com\/upload\/demos\/NormapMapMaker1\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/unitycoder.com\/upload\/demos\/NormapMapMaker1\/<\/a><\/p>\n<p><strong>Shader used on that image:<\/strong><br \/>\n&#8211; BumpedSpecular\u00a0 With Separate Specular Map : <a title=\"http:\/\/answers.unity3d.com\/questions\/306921\/add-specular-map-to-shader.html\" href=\"http:\/\/answers.unity3d.com\/questions\/306921\/add-specular-map-to-shader.html\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/answers.unity3d.com\/questions\/306921\/add-specular-map-to-shader.html<\/a><br \/>\n&#8211; Added &#8220;#pragma exclude_renderers flash&#8221; to get rid off the shader warning..<\/p>\n<p>Image credits:<br \/>\nMain image: CGTextures.com : <a title=\"http:\/\/www.cgtextures.com\/texview.php?id=43972\" href=\"http:\/\/www.cgtextures.com\/texview.php?id=43972\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.cgtextures.com\/texview.php?id=43972<\/a><\/p>\n<p>&#8212;<\/p>\n<p><strong>Image#2:<\/strong> Ground (\u00a0<a title=\"http:\/\/www.cgtextures.com\/texview.php?id=64716\" href=\"http:\/\/www.cgtextures.com\/texview.php?id=64716\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.cgtextures.com\/texview.php?id=64716<\/a> )<br \/>\n<a href=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_bump_generator_ground_2.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2074\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2013\/07\/16\/normal-specular-map-generator-from-texture\/unity3d_normal_map_bump_generator_ground_2\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_bump_generator_ground_2.jpg?fit=1865%2C848&amp;ssl=1\" data-orig-size=\"1865,848\" 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=\"unity3d_normal_map_bump_generator_ground_2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_bump_generator_ground_2.jpg?fit=1024%2C465&amp;ssl=1\" class=\"alignnone size-medium wp-image-2074\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_bump_generator_ground_2-300x136.jpg?resize=300%2C136\" alt=\"unity3d_normal_map_bump_generator_ground_2\" width=\"300\" height=\"136\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_bump_generator_ground_2.jpg?resize=300%2C136&amp;ssl=1 300w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_bump_generator_ground_2.jpg?resize=1024%2C465&amp;ssl=1 1024w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_bump_generator_ground_2.jpg?w=1865&amp;ssl=1 1865w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>&lt;- Click to view<\/p>\n<p><strong>Image#3:<\/strong> Wood planks (\u00a0<a title=\"http:\/\/www.cgtextures.com\/texview.php?id=36848\" href=\"http:\/\/www.cgtextures.com\/texview.php?id=36848\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.cgtextures.com\/texview.php?id=36848<\/a> )<br \/>\n<a href=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_generator_plugin_wood1.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2075\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2013\/07\/16\/normal-specular-map-generator-from-texture\/unity3d_normal_map_generator_plugin_wood1\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_generator_plugin_wood1.jpg?fit=1905%2C727&amp;ssl=1\" data-orig-size=\"1905,727\" 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=\"unity3d_normal_map_generator_plugin_wood1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_generator_plugin_wood1.jpg?fit=1024%2C390&amp;ssl=1\" class=\"alignnone size-medium wp-image-2075\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_generator_plugin_wood1-300x114.jpg?resize=300%2C114\" alt=\"unity3d_normal_map_generator_plugin_wood1\" width=\"300\" height=\"114\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_generator_plugin_wood1.jpg?resize=300%2C114&amp;ssl=1 300w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_generator_plugin_wood1.jpg?resize=1024%2C390&amp;ssl=1 1024w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/unity3d_normal_map_generator_plugin_wood1.jpg?w=1905&amp;ssl=1 1905w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>&lt;- Click to view<\/p>\n<p><strong>Image#4:<\/strong> Plugin window<br \/>\n<img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2088\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2013\/07\/16\/normal-specular-map-generator-from-texture\/normal_map_maker_plugin\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/normal_map_maker_plugin.jpg?fit=306%2C378&amp;ssl=1\" data-orig-size=\"306,378\" 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=\"normal_map_maker_plugin\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/normal_map_maker_plugin.jpg?fit=306%2C378&amp;ssl=1\" class=\"alignnone size-full wp-image-2088\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/normal_map_maker_plugin.jpg?resize=306%2C378\" alt=\"normal_map_maker_plugin\" width=\"306\" height=\"378\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/normal_map_maker_plugin.jpg?w=306&amp;ssl=1 306w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/normal_map_maker_plugin.jpg?resize=242%2C300&amp;ssl=1 242w\" sizes=\"auto, (max-width: 306px) 100vw, 306px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Working on simple poor man&#8217;s normal map &amp; specular map generator editor script.. (click image to view full size) Left side = original bitmap, Right side = generated normal map + specular map *Github: https:\/\/github.com\/unitycoder\/NormalMapFromTexture Asset Store: https:\/\/www.assetstore.unity3d.com\/#!\/content\/10388?aid=1101lGti Unity Forum Thread: http:\/\/forum.unity3d.com\/threads\/normal-map-maker.254310\/ &#8212; Features: &#8211; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2069,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[485,3],"tags":[402,513,358,223,440,28,512,142],"class_list":["post-2068","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-assets","category-unity3d","tag-asset","tag-bump-map","tag-editor","tag-generator","tag-normal-map","tag-plugin","tag-specular-map","tag-texture"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/07\/poormans_normal_specular_map_generator_unity3d.jpg?fit=680%2C282&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1KTaT-xm","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/2068","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=2068"}],"version-history":[{"count":16,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/2068\/revisions"}],"predecessor-version":[{"id":5244,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/2068\/revisions\/5244"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media\/2069"}],"wp:attachment":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media?parent=2068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/categories?post=2068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/tags?post=2068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}