{"id":776,"date":"2012-03-18T22:49:08","date_gmt":"2012-03-18T19:49:08","guid":{"rendered":"http:\/\/unitycoder.com\/blog\/?p=776"},"modified":"2012-11-08T22:34:02","modified_gmt":"2012-11-08T19:34:02","slug":"texture-paint-with-soft-brush","status":"publish","type":"post","link":"https:\/\/unitycoder.com\/blog\/2012\/03\/18\/texture-paint-with-soft-brush\/","title":{"rendered":"Texture Paint with Soft Brush"},"content":{"rendered":"<p><a title=\"start webplayer demo\" href=\"http:\/\/unitycoder.com\/upload\/demos\/TexturePaintSoftBrush1\/\" target=\"_blank\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"777\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2012\/03\/18\/texture-paint-with-soft-brush\/texturepaint_soft_brush1\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/texturepaint_soft_brush1.jpg?fit=680%2C490&amp;ssl=1\" data-orig-size=\"680,490\" 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=\"texturepaint_soft_brush1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/texturepaint_soft_brush1.jpg?fit=680%2C490&amp;ssl=1\" class=\"alignnone size-full wp-image-777\" title=\"texturepaint_soft_brush1\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/texturepaint_soft_brush1.jpg?resize=680%2C490\" alt=\"\" width=\"680\" height=\"490\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/texturepaint_soft_brush1.jpg?w=680&amp;ssl=1 680w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/texturepaint_soft_brush1.jpg?resize=300%2C216&amp;ssl=1 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/a><\/p>\n<p>Now that the Android Basic is free, trying to make a simple multi-finger painter program as a test..<\/p>\n<p><strong>Current features:<\/strong><br \/>\n&#8211; Orthographic camera, with full view sized drawing plane (see forum: <a title=\"http:\/\/forum.unity3d.com\/threads\/105716-Creating-plane-of-dynamic-sizes\" href=\"http:\/\/forum.unity3d.com\/threads\/105716-Creating-plane-of-dynamic-sizes\" target=\"_blank\">Creating plane of dynamic sizes<\/a>)<br \/>\n&#8211; Special shader that uses that drawing texture as emission.. (might work with just diffuse also..)<br \/>\n&#8211; Didnt find any code for drawing soft brush circles using for..loops.., tested <a title=\"http:\/\/en.wikipedia.org\/wiki\/Midpoint_circle_algorithm\" href=\"http:\/\/en.wikipedia.org\/wiki\/Midpoint_circle_algorithm\" target=\"_blank\">MidPoint Circle Algorithm<\/a> but it gives hard edges..(could blur it?)<br \/>\n&#8211; Now its using &#8220;decal splatting&#8221;, it takes 1 soft texture brush (see image#2 below), splats that into the drawing texture.<br \/>\n&#8211; Problem: alpha is not additive..so if you paint and dont move, it gives bad results (hmm..disable painting, if not moving?)<\/p>\n<p><strong>Todo \/ ideas:<\/strong><br \/>\n&#8211; How to fix fast moving?<br \/>\n&#8211; Use input.touches + raycast? (or no need raycast?)<br \/>\n&#8211; Add some GUI (clear button..or actually use the shake gesture?)<br \/>\n&#8211; Add effects? (sliding image, from gyro?)<\/p>\n<p><strong>Webplayer:<\/strong><br \/>\n<a title=\"start webplayer demo\" href=\"http:\/\/unitycoder.com\/upload\/demos\/TexturePaintSoftBrush1\/\" target=\"_blank\">http:\/\/unitycoder.com\/upload\/demos\/TexturePaintSoftBrush1\/<\/a><\/p>\n<p><strong>Download source:<\/strong><br \/>\ncoming later..<\/p>\n<p>&#8212;<\/p>\n<p><strong>Image#2<\/strong>: soft brush texture, 64&#215;64 (alpha values are used for painting)<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"778\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2012\/03\/18\/texture-paint-with-soft-brush\/soft_brush\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/soft_brush.jpg?fit=130%2C130&amp;ssl=1\" data-orig-size=\"130,130\" 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=\"soft_brush\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/soft_brush.jpg?fit=130%2C130&amp;ssl=1\" class=\"alignnone size-full wp-image-778\" title=\"soft_brush\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/soft_brush.jpg?resize=130%2C130\" alt=\"\" width=\"130\" height=\"130\" \/><\/p>\n<p>&#8212;<\/p>\n<p><strong>Image#3:<\/strong> Profiler statistics for current version (8.11.2012)<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/fingerpaint_profiler_unity.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1414\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2012\/03\/18\/texture-paint-with-soft-brush\/fingerpaint_profiler_unity\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/fingerpaint_profiler_unity.jpg?fit=1104%2C556&amp;ssl=1\" data-orig-size=\"1104,556\" 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=\"fingerpaint_profiler_unity\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/fingerpaint_profiler_unity.jpg?fit=1024%2C515&amp;ssl=1\" class=\"alignnone size-thumbnail wp-image-1414\" title=\"fingerpaint_profiler_unity\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/fingerpaint_profiler_unity-150x150.jpg?resize=150%2C150\" alt=\"\" width=\"150\" height=\"150\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/fingerpaint_profiler_unity.jpg?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/fingerpaint_profiler_unity.jpg?zoom=2&amp;resize=150%2C150&amp;ssl=1 300w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/fingerpaint_profiler_unity.jpg?zoom=3&amp;resize=150%2C150&amp;ssl=1 450w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><em> &lt;- click to view full size)<\/em><\/p>\n<p>&#8212;<\/p>\n<p><strong>Image#4:<\/strong> Quick test with particles, its quite fast 30-45fps on old android galaxy s plus<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1420\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2012\/03\/18\/texture-paint-with-soft-brush\/fingerpaint_v2\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/fingerpaint_v2.jpg?fit=680%2C520&amp;ssl=1\" data-orig-size=\"680,520\" 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=\"fingerpaint_v2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/fingerpaint_v2.jpg?fit=680%2C520&amp;ssl=1\" class=\"alignnone size-full wp-image-1420\" title=\"fingerpaint_v2\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/fingerpaint_v2.jpg?resize=680%2C520\" alt=\"\" width=\"680\" height=\"520\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/fingerpaint_v2.jpg?w=680&amp;ssl=1 680w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/fingerpaint_v2.jpg?resize=300%2C229&amp;ssl=1 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now that the Android Basic is free, trying to make a simple multi-finger painter program as a test.. Current features: &#8211; Orthographic camera, with full view sized drawing plane (see forum: Creating plane of dynamic sizes) &#8211; Special shader that uses that drawing texture as [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":777,"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":[4,3],"tags":[197,211,209,34,210,208,207,364],"class_list":["post-776","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-demos","category-unity3d","tag-android","tag-decal","tag-finger","tag-paint","tag-smooth-brush","tag-soft-brush","tag-texture-paint","tag-touch"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2012\/03\/texturepaint_soft_brush1.jpg?fit=680%2C490&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1KTaT-cw","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/776","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=776"}],"version-history":[{"count":3,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/776\/revisions"}],"predecessor-version":[{"id":1421,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/776\/revisions\/1421"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media\/777"}],"wp:attachment":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media?parent=776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/categories?post=776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/tags?post=776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}