Search Unity

[Released] Mobile Paint (with multi-touch)

Discussion in 'Assets and Asset Store' started by mgear, Aug 16, 2014.

  1. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    Hi,

    **Update:
    26/10/2018, this package is now free in asset store.
    (due to not having time to update this, last update was few years ago..)

    What:
    Simple multi-touch (mobile) painter.
    *Still work in progress, more new features are to be added later.

    News:
    Going to submit v1.1 update to the store today (includes floodfill, custom brushes etc).
    *NEW: Price will be increased to 15usd in one of the coming updates (2015)

    Asset Store:
    https://www.assetstore.unity3d.com/en/#!/content/19803

    More info: (with images, .apk demo, etc.)
    http://unitycoder.com/blog/2014/07/15/asset-store-mobile-paint/

    Screenshot:
    mobile_paint_custom_brushes_1.jpg
     
    Last edited: Oct 26, 2018
  2. mohhad

    mohhad

    Joined:
    Jul 30, 2014
    Posts:
    7
    Hello,

    Very nice asset and it helped me alot.

    I have a quick question if you can help me please.

    The canvas texture example is great and all and I did my own version where I create a material with a shader of unityCode/TextureCanvas to put a back ground image as a Mask without overlapping its colors. Works great and all.

    But I hit a bump when I tried to apply a texture containing some transparent pixels. It is a 2D app with a full camera size image containing a circle. See attached Image P5-WindowMist.png . When i set that as a texture, the circle pixels spread all over the place Aquired Effect.png . Do you know what shader i can use for this? I tried all shaders and nothing worked (including the ones in the transparent section). I used the same approach, empty gameObject with a mesh renderer and filter etc... and let the code do its work.

    The theme here is that there is a mist (blue circle in the attached image) and I need the user to wipe it (use transparent pixels) Intended Effect.png

    Please let me know if you can help me.
     
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    Hi,

    Ok, it seems to happen when [x] alpha is transparent, is selected from importer settings.
    I'll try to check whats going on.

    At least the image is shown properly,
    if you add this blend line into UnityCoder/CanvasTexture.shader:

    Tags { "RenderType"="Opaque" }
    Blend SrcAlpha OneMinusSrcAlpha


    *if you can email me your sample scene (or the modified shader/material version),
    then I can try to fix it on that. > email address <
     
    Last edited: Sep 17, 2014
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    Ok, i think its working now, added alpha support for brush and few shader modifications..
    i'll send the package by email.

    mist_texture.jpg
     
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    1.2 update is now alive in the store.

    V1.2 whats new:
    – Added: Alpha support for paintcolor (alpha value is now used), “soft / additive painting” works
    – Added: Public variable “BrushAlphaStrengh”, it controls additive brush alpha strength, try 0.1f or 1 or 5 to see the difference
    – Added: Public variable “UseCustomBrushAlpha”, true = take alpha from brush, false = use paintcolor alpha value
    – Added: Public variable “useAdditiveColors”, true = colors adds up slowly, false = one click will instantly set color to brush or paint color value
    – Added: Initial canvas texture is now taken as an “clearing texture” (as an canvas texture) if assigned in the material maintexture in the inspector
    – Added: Public method “ReadClearingImage()”, reads initially set maintexture from canvas (to be used as an clearing image)
    – Added: Public method “DoUndo()”, basic undo system (restores one step only)
    – Added: Alpha value slider in the palette (color picker) dialog
    – Added: Demo scene “scene_MobilePaint_EraseCanvasAlpha”
    – Added: Demo scene “scene_MobilePaint_MaskImage”

    – Fixed: More guard clauses added (check for null mask texture, check if undo enabled before can do undo etc).
    – Fixed: Custom brush now uses brush colors (instead of paintcolor)

    – Changed: Floodfill now uses alpha also to compare fill spread (only RGB was used before)
    – Changed: Public variable “drawMode” is now using DrawMode enum (list is defined at top of MobilePaint.cs)
    – Changed: Renamed public variable “screenSizeAdjust” into “canvasSizeAdjust”
    – Changed: Renamed materials
    – Changed: “maskTex” variable is removed (“maskImage” is used instead, originally maskTex was copied from “maskImage”..)
    – Changed: GUIScaler.cs now runs at Awake() instead of Start()
    – Changed: Sample brushes are now with colors
    – Changed: Renamed original demo scene into “scene_MobilePaint_default”

    – Updated: Documentation for current version

    – Cleaning: Arranged scripts into different folders
    – Cleaning: Started moving helper methods into separate script Library/PaintTools.cs

    mobile_paint_12_ss3.jpg mobile_paint_12_ss2.jpg
     
  6. Leandro_Gado

    Leandro_Gado

    Joined:
    Sep 29, 2013
    Posts:
    14
    I'm interested in this but I have a few questions.

    Can I modify the texture by code (paint brush at x,y)?
    Is it possible to scale and rotate brushes?
    Is it possible to paint over a mesh?
    Will it support layers and blendmodes in the future?

    Thank you.
     
  7. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    hi,

    Right now this is still quite half baked / work in progress,
    so any custom features would need modifying the existing c# code..

    Not without modifications in 1.2, but I can add that to next version.

    There is already public function DrawPoint(int x,int y), but
    bool textureNeedsUpdate would need to be made public also..

    Default circular brush has size adjust, but custom brushes cannot be rotated or scaled,
    I can add it to wish list.

    Not tested..
    Current it creates full screen quad with mesh collider for the drawing plane..
    In theory it could work, but as before, would need modifying the code..
    And i think there are other/better mesh painting tools available..

    Its possible to add those, give more details what/how you would like to use them.
     
  8. Leandro_Gado

    Leandro_Gado

    Joined:
    Sep 29, 2013
    Posts:
    14
    Thank you, I sent you a PM with a better example of what I need.
     
  9. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    719
    nice 1
     
  10. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    Submitted update to store just now:

    v1.3
    - Added: Locking mask painting: Only paint in the area that you first click (determined by floodfill)
    - Added: Demo scene "scene_MobilePaint_PaintAreaLockMask"
    - Added: Option to disable full screen quad creation for canvas (and use existing mesh instead, used in mesh painting)
    - Added: Demo scene "scene_MobilePaint_MeshPaint"
    - Added: Option to disable previous & current brush stroke position connecting (if you paint & move fast, those positions get connected, but it causes problems when painting to custom mesh)

    - Updated: Documentation for current version

    - Cleaning: Code cleaning

    --
    mobile_paint_13_lockmask1.jpg mobile_paint_13_meshpaint1.jpg
     
  11. DeCeOnline

    DeCeOnline

    Joined:
    Mar 12, 2014
    Posts:
    10
    I think the asset is amazing. Thanks for the effort!

    I have some concerns about it though and maybe you can help me. I'm having some issues when I'm trying to set colors. When I pick a color and start to paint with it, it's always a bit softer than the one I choose. For example, if I want to color with red, when I start to paint it's some kind of pink. Which property should I tweak to paint with the color I choose?

    Another issue is about edges. When I paint near edges (in PaintAreaLockMask scene) it's not very accurate. The painting around edges becomes a bit pixelated. I have a custom canvas to paint in. Do I have to do anything special in the import settings or something?

    Talking about edges too and this same scene, when I accidentally start to paint over an edge, it allows me to keep painting over the line. Is there any way to avoid this?

    EDIT: I forgot to mention. It works fine on devices, but I was wondering if is there any way to test the painting in the Unity Editor? I'm using Unity Pro 4.5.4p1.

    Thank you! :)
     
  12. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    Thanks!

    Which scene you are using? Can post a screenshot?

    Yeah, there is no threshold value (yet), so it only matches with exact colors.
    That sample image was set to some 'round to nearest power of two' in the texture import settings, so it gets artifacts in the scaling.. You can set it to "Non Power of 2 - None" and then it looks nicer.

    hmm.. yes, seems to do that, I'll look for some fix into that.
    Basically the problem is: it keeps track of the previous drawing point and puts line between them,
    so just have to move the previous point to current point if going/coming outside the screen or such..

    In the versions below v1.4, you can enable mouse painting from the code.
    Inside Update() loop the mouse paint was disabled by default, so just un-comment it:
    //MousePaint();
    TouchPaint();

    But in the latest version there is toggle button on the inspector for enableMouse/Touch.

    also v1.4 is now in store *Note, its using Unity 4.6 and later updates will start using the new UI only.

    - Added: 4.6 New UI sample scene "scene_MobilePaint_NewUI_Default"
    - Added: Public booleans for enableMouse & enableTouch (previously you had to comment them from code)
    - Fixed: Y offset was broken (bottom right border didn't use the offset value)

    Image: new demo using 4.6 UI
    mobile_paint_new_ui_ss_7.jpg
     
    DeCeOnline likes this.
  13. DeCeOnline

    DeCeOnline

    Joined:
    Mar 12, 2014
    Posts:
    10
    Thank you, mgear.

    About the first issue I mentioned, it was because I was using a custom image as canvas and it was transparent except for the lines. I changed the shader to UnityCoder > CanvasWithAlpha and doing this everything was working fine except for the color issue I said. After some trial/error I stopped using an alpha canvas and started using one with a white background (I changed the shader again to Default) and the color issue went away.

    About the rough edges, I think I will have to wait until the threshold gets implemented. Is it in your TODO list for the next release?

    I really appreciate the effort you're taking with this asset and I already posted a 5* review in the store. Thank you :)
     
  14. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    486
    @mgear ,

    I was looking for something like this and after researching all the available options, I've decided to go with yours. And I'm glad I did, great product and works perfectly (only tested on galaxy tab 7 so far) with our own art assets.

    There are two issues I'll need to take care of, I can probably figure out those myself but figured I should ask first.

    * Is there a way to keep aspect ratio of the mask/lock image. When playing the the demo scenes, my square art asset ended up stretched.
    * Is there way to change the image at runtime? ClearImageWithImage() maybe?

    Thanks in advance...
     
  15. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    @DeCeOnline , thanks! yes, it's added into TODO list (but not sure if in next update, but hopefully the one after that)
    White background probably helps since those artifacs are basically some transparent white color.


    hmm..not possible (yet)..
    So, if screen resolution is for example 1024x512, and mask image is 1024x1024,
    what would be the ideal scaling for that?
    - Cropping anything that doesnt fit (but keeping original size)
    - Scaling with aspect ratio (but leaving empty areas on side/sides)
    - Other solutions..?

    Not directly (yet), but should be able to do this: (not tested)
    - Assign new texture as the material mainTexture
    - Then call ReadClearingImage() // this one reads the texture pixels
    - Then call ClearImageWithImage()
     
  16. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    I'm waiting for a threshold support too even tho it seems it might be easy to add myself if I only care about it near black color (cartoon image lines).

    Is there something on the todo list to have fill tool follow the original image fill regions? like in you example image if I paint 2-3 lines on the sky and then just want to fill the sky with blue and overwrite the lines too as they did not exist in the original. I assume it would only mean that sampling fill area would happen from the original/refence image but filling would happen on the one you are working with.
     
  17. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    Currently this happens:
    - Solid lines do get "filled in", but it wont fill that circle there..
    filltest.png

    Ok, I guess I got what you mean, floodfill would only consider the overlay/mask image lines, not anything from the paint layer. Yeah that would be quite easy to do, i'll try to add some option for that in coming updates. (hopefully the next one).
     
  18. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    486
    I think scaling with aspect ratio would be the best option, at least in my case. Cropping might leave crucial parts out especially considering different screen sizes on Android devices, etc.

    I guess it currently creates a mesh based on device screen res/aspect and maps the texture on it right?

    And thanks for the runtime suggestion, I'll try that...
     
  19. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Yeah exactly this :)
     
  20. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    Paint threshold works:
    It's currently using simple RGB values comparison (it sounds like HSL, CIE would be better, but needs more math so will see about it later..)
    mobile_paint_threshold_1.jpg

    Still better solution is to have good source images, without scaling, compression etc.
     
    DeCeOnline and Ostwind like this.
  21. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    Submitted update to store just now.

    It has the 'check mask only for locking area' and basic adjustable threshold option.

    No scaling options yet, because it got complicated (many possibilities how it could work)
    - Scale, Crop, Padding (define which sides), Resize canvas instead (to match image aspect ratio and then fit to camera view)..
    - Also custom bitmap resizer code is needed, (and founded out Texture2D.Resize didnt give simple image scaling : http://docs.unity3d.com/ScriptReference/Texture2D.Resize.html , there is this though : http://wiki.unity3d.com/index.php/TextureScale )


    whats new:
    v1.5
    - Added: Option "UseMaskOnly" : Locking Mask Paint & Fill using mask layer only
    - Added: Option "UseThreshold" : Instead of matching exact colors only, you can adjust matching threshold
    - Added: Layermask dropdown for painting raycast ("default" layer is enabled in examples). Use this to limit painting raycast hitting other objects.
    - Added: New sample scene "scene_MobilePaint_NewUI_UseOnlyMaskForLocking"

    - Fixed: If you "painted" outside the canvas and then came back, line was drawn between those points, now "wentOutside" bool is checked for that

    - Changed: "enableMouse" is now enabled by default and "enableTouch" is disabled. (for easy testing in editor)
    - Changed: Renamed "useLockMask" to "useLockArea"
    - Changed: Renamed "useMaskOnly" to "useMaskLayerOnly"
    - Changed: Renamed "void LockMaskFill()" to "void LockAreaFill()"
    - Changed: Renamed "void LockMaskFillMaskOnly()" to "void LockAreaFillMaskOnly()"

    - Known issues: Lots of duplicate code in the different mask filling functions, will be cleaned up later

    //
    And feel free to give new ideas / feature requests.
     
    DeCeOnline and Ostwind like this.
  22. DeCeOnline

    DeCeOnline

    Joined:
    Mar 12, 2014
    Posts:
    10
    Hey @mgear, do you know how long does Unity take to approve the update? Can't wait to try that threshold update :)
     
  23. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    Nooo!... I guess had not clicked the submit button inside the new asset store manager page,
    went to check and it was still marked as a draft >< , well now it should be in the queue..
     
  24. DeCeOnline

    DeCeOnline

    Joined:
    Mar 12, 2014
    Posts:
    10
    Oh I see! Thanks, @mgear !

    Btw, I'm playing around with MobilePaint and I wonder if the brush could be a little bit "softer". I mean, when I'm panting, the "colored circle" is a bit rough in its corners:



    Is there any way this could be improved?

    Thanks! :)
     
  25. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    By default the filtermode is Point, setting it to bilinear might help.
    Otherwise could try softbrush scene, or maybe creating custom softer circle brush..
     
    DeCeOnline likes this.
  26. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    btw. v1.5 is in store now
     
  27. DeCeOnline

    DeCeOnline

    Joined:
    Mar 12, 2014
    Posts:
    10
    Thank you @mgear, the update is amazing and the threshold works smoothly :D. You're the man!
     
  28. DeCeOnline

    DeCeOnline

    Joined:
    Mar 12, 2014
    Posts:
    10
    By the way, I've found that if you try to use the fill tool over an already filled area it doesn't work.
     
  29. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    In which scene? (or with which settings)

    I quickly tested on "scene_MobilePaint_NewUI_Default" and "scene_MobilePaint_NewUI_UseOnlyMaskForLocking" seems to work there.. (flood fill with different color to same location)
     
  30. DeCeOnline

    DeCeOnline

    Joined:
    Mar 12, 2014
    Posts:
    10
    Okey, I think it's a memory problem with the canvas. I've been able to reproduce the "OutOfMemoryException" in "scene_MobilePaint_PaintAreaLockMask" doing the following:

    1) Flood fill the background with any color
    2) Change the color to another
    3) Click again in the background

    If the background flood fills fine, do it again. It will eventually throw an exception and paint "squares" instead of painting the background:




    The settings I'm using are:



    I'm almost sure that it has something to do with the new threshold feature, as I've been unable to reproduce it with the option disabled.

    Thank you as always, @mgear! :)
     
  31. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    ^thanks, ill check that.

    Ok, got it happening inside FloodFillWithTreshold(), will do some digging.

    Founded one other problem:
    - Because of the old GUI (when clicking old GUI area, it reports it as went outside paint area, while in the new UI it doesnt, thats why sometimes have to click twice to fill)
    That problem will go away, once all the examples scenes are converted to new UI.
     
    Last edited: Feb 18, 2015
    DeCeOnline likes this.
  32. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    ^ Ahah, that was a funny bug:
    If you paint with Color A and then paint with ColorB (and that color is inside the threshold for ColorA), then infinite loop happens.
    Should be fixed in next update (hopefully submitted within this month).
     
  33. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    v1.55 is now submitted ( to fix that bug^ )

    ** Note: For v1.6 the price will go up by 5usd **
     
    DeCeOnline likes this.
  34. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    v1.6 is now submitted >

    Main change is the new public variable "targetTexture", which this you can use pretty much any shader
    and just set the target texture for that material there. (demos include painting into _BumpMap, _DispTex, _ParallaxMap..).


    v1.6 changes
    - Added: New public variable setting "targetTexture" (Defaults to "_MainTex").
    Can be used for setting the target texture on the current material/shader.
    - Added: Full screen quad now calculates normals & tangents (to allow using normal/height mapped shaders)
    - Added: New material "CanvasWithMaskAndAlpha" with shader "CanvasMaskAndAlpha". Top layer mask and bottom layer with transparency
    - Added: New example scene "scene_MobilePaint_EraseCanvasAlphaWithMask" using the shader above ^
    - Added: New example scene "scene_MobilePaint_NewUI_BumpMap", paints into bumpmap texture. (targetTexture = _BumpMap)
    - Added: New example scene "scene_MobilePaint_NewUI_HeightMap", paints into parallaxmap texture. (targetTexture = _ParallaxMap)
    - Added: New example scene "scene_MobilePaint_NewUI_EraseTopLayer", you can erase toplayer to reveal background image (bottom layer)
    - Added: New example scene for DX11 "scene_MobilePaint_NewUI_Tesselation", you can paint into displacement texture. (targetTexture = _DispTex) *Uses DX11 tesselation shader (must enable DX11 and set buildtarget to webplayer/desktop)

    - Fixed: Brush size slider now takes initial brush size value from canvas settings at Start()

    Image#1: Painting into displacement texture
    paint_into_displacement_texture.jpg

    Image#2: Erasing top layer texture (and reveal background texture) *that ice texture was not included in this package, but just assign any texture into mask layer and set targetTexture = _MaskTex to draw on that.
    paint_erase_texture.jpg

    **Note: "scene_MobilePaint_NewUI_EraseOverlay" scene can be deleted, its duplicate from "scene_MobilePaint_NewUI_BumpMap"
     
    Last edited: Feb 28, 2015
  35. cradiff

    cradiff

    Joined:
    Feb 7, 2015
    Posts:
    58
    I meet another problem about the color mask image since it also color the "black line" too.

    You can check my game is online on google play here: https://play.google.com/store/apps/details?id=com.cradiff.anicolor4kids

    If you try to fill the line or the mistake to fill the lines it will fill all screen or many area. What I want is the area should be separated by black lines of image.

    And here is my settings of mobilepaint object (in attachment).

    Do you have any idea why it happen like that? I see the demo scene happen the same problem too.
     

    Attached Files:

  36. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    Yes, that still happens, I'll fix that in next update.
    (it should be just a matter of checking if you clicked on a black pixel)
     
  37. cradiff

    cradiff

    Joined:
    Feb 7, 2015
    Posts:
    58
    That 's cool. I am very happy and appreciated your works with this new update in next version. Thanks
     
  38. Oriam

    Oriam

    Joined:
    Nov 11, 2012
    Posts:
    23
    Hi mgear,

    We are about to begin a project and I think your product is suitable for our needs. However, I want to ask you if there is a built-in way to know if some percentage of a mask has been painted. For example, let's suppose that I setup a simple scene with a texture of three cubes that the user has to paint on. Do you provide a way to know if the user has painted at least half of a given cube (or mask)?

    We'll probably get your plugin regardless of the answer, but I figured I should at least ask.
    Thanks in advance.
     
  39. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    hi,

    That would need quite a few modifications.. so, there is not easy way to do it in current version.

    Are those separate 3D cubes?
    Maybe you could just do separate script that paints the vertices at the same time (without showing it),
    and then calculate the area from that (when vertex get painted, area++)
     
  40. Oriam

    Oriam

    Joined:
    Nov 11, 2012
    Posts:
    23
    Thank you for your answer,

    Do we get the source code with the purchase of the plugin?
     
  41. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    Yes, source is included (c#), no dll's
    *still somewhat messy, but ask if something unclear
     
  42. Oriam

    Oriam

    Joined:
    Nov 11, 2012
    Posts:
    23
    Ok, thank you very much :) We'll get it soon.
     
  43. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    Submitted v1.7 Update. *Note: price increased to $17

    - Added: Custom brushes now also use "connectBrushStrokes"
    - Added: "scene_RandomPainter.scene", external script used for painting random spots in the canvas. (See RandomPainter.cs)
    - Added: Option"canDrawOnBlack", if disabled, user cannot draw on black pixel in canvas or mask (to avoid painting on black outlines)

    - Fixed: Initialize undo buffer at Awake(), otherwise you get black image when undoing empty image
    - Fixed: Undo now catches ClearImage also

    - Changed: Old demo scenes are now all converted to use new UI. (old scenes are still in the old/ folder, but might not work anymore)
    - Changed: InitializeEverything(), DrawCircle(), textureNeedsUpdate are now public, so external scripts can call them directly

    Screenshot of random painter:
    random_painter_example.jpg
    Screenshot of custom brush connected lines:
    custom_brush_connect_lines.jpg
     
  44. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    ^ v1.7 is live now.

    Coming up in next updates:
    - Paint with custom texture pattern (screenshot below, still needs some fixing and UI for using it)
    pattern_brush.jpg
    - Some more to list here later..

    Some other recent feature requests in the TODO list:
    - "Image effects", like slowly fading paint
    - Procedural brushes (shapes, colors)

    Been thinging about painting with cycling colors also (as in DeluxePaint),
    probably could animate the color cycle using shader, havent researched on that yet..
     
    Last edited: Apr 17, 2015
  45. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    ^ Founded couple bugs when trying to paint with touch on the v1.7 version, working on fix update.

    *V1.71 submitted to store just now

    v1.71
    - Fixed: Floodfill broken with Touch mode enabled
    - Changed: Renamed GetCurrentBrush() to ReadCurrentCustomBrush()
     
    Last edited: Apr 21, 2015
  46. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    Some progress on painting with texture patterns (should be going to store in the next week or 2)
    pattern_painter.jpg
     
  47. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    submitted v1.8:

    Has paint with texture pattern (screenshot above ^) and example scene to save current image.

    notes:
    - Added: painting with texture pattern (see scene "scene_MobilePaint_NewUI_PaintWithPattern")
    - Added: public ReadCurrentCustomPattern(), reads current selected pattern texture pixels
    - Added: public GetCanvasAsTexture(), returns current drawing layer (the pixels array) as Texture2D
    - Added: public GetScreenshot(), returns current scene screenshot (without UI) as Texture2D
    - Added: "scene_SaveScreenshotToFile" example scene to test saving screenshots to file

    - Fixed: Now you can paint all the way to the image borders also

    - Changed: "canDrawOnBlack" is not properly working yet, now disabled on some fill modes
     
  48. c_andrews

    c_andrews

    Joined:
    Jan 26, 2015
    Posts:
    42
    Hi,
    Thanks for Mobile Paint, it works really well!

    I am having some issues with a custom brush tho and wondered if I am doing something wrong of if its not possible. I am using the attached brush which is using some opaque pixels to try and make a crayon effect but it keeps coming out solid (see attached). Are you able to help?

    paint.png settings.png brush_blue.png
     
  49. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,854
    If you set BrushAlphaStrenth to very low value, like: 0.001 or 0.0001
    then its bit softer.

    The problem is that it keeps painting additively even if the brush is not moving (so it goes to full solid bit too fast..)
    But try if adjusting that value works well enough.
     
  50. c_andrews

    c_andrews

    Joined:
    Jan 26, 2015
    Posts:
    42
    Thanks that has improved things but i now get a more 3d looking paint effect. Please see attached. I am using "CanvasWithAlpha" for the material on the Drawing Plane Canvas as i need the user to be able to draw on top of an image. Any ideas?
     

    Attached Files:

unityunity