Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[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:
    9,350
    hmm.. yes, that combination seems to "break the alpha" (its limitation/bug in the additive painting, i'll try to improve it in coming updates).

    in the meanwhile,
    Can you test this scene: "scene_MobilePaint_NewUI_EraseTopLayer"
    [x] Use Additive colors
    Set brush alpha strenth to: 0.001 (optional)
    Set clear color to : 128,128,128,0
    Add your custom brush there
    [x] Use custom brush alpha

    And modify 1 line of code to have 'nicer additive alpha (check your PM for the snippet)
     
  2. c_andrews

    c_andrews

    Joined:
    Jan 26, 2015
    Posts:
    106
    Thats amazing thank you so much!
    It works a treat.

    Thanks for the support!
     
  3. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    Hi!

    How to improve the "White Lines" on the borders?

    I played with Threshold and I noticed a slight improvement but still needs work.

    From my understanding, since they the painting is on same layer as the drawing, the paint "respect" the border and the aliasing transparency makes the white border. Would be possible for the painting inside the shapes be on layer below but still be contained inside the shape while painting? Or the lines use a "multiply" shader effect so the aliasing gets blended (black) in the color inside?
     

    Attached Files:

  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Hi,

    Threshold should help, try high values like 200, 240 even. (255 is max)
    or if you can send me your image I can test it also.
     
  5. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    Tested it with all values and it improved a bit, but still far from perfect.

    The original file is attached here.

    We want to create something similar to this game, there you does not see any white border lines at all.



    Thanks for the support!
     

    Attached Files:

  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Some notes:
    - Usually power of two image sizes work best (for example your image could be cropped to 1024x512)
    - Setting image max size to something where unity doesnt resize the image helps sometimes too
    - Changing brush Filter mode to "bilinear" smoothens it a little bit, but doesnt get rid of all edges
    - Changing mask texture filter mode to "Point" in the texture import settings also helps (but then it looks jagged)

    But got one small script fix for that, it makes the mask smoother (based on mask alpha).
    if you can email me (or pm your email address) i'll send you the updated file for testing.
    monster_before_after.png
     
  7. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    @mgear

    Is it possible to get painted percentage of an area or to check if its fully (100%) painted? For example blue area of the above sample...
     
  8. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Not at the moment, but i'll take a look how/if it could work.
     
  9. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    Ah that would be great, thank you!
     
  10. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Got basic version working, it just calculates the pixels on that "locking" area:
    get_area_fill_size.jpg

    What kind of features would be useful to have there?

    I'm thinking at least it could fire event when 100% is filled, and maybe return center coordinate to the filled area..(so can place effects there if needed)..
     
  11. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    Wow, that was fast and seems to be working exactly I've imagined. :)

    Simply returning the current percentage of the area should be enough for my needs but also returning the centre coordinate is a great idea, can be very very useful...

    Btw, event at 100% would be great but how accurate can it be? I mean there can be few pixels left out (due to aliasing, or few pixel left out in a corner of some part of the drawing, etc.) so maybe checking for something like 99% would be better? Also will it take multiple attempts in count? I mean getting to 100% might need few separate paint attempts.

    Great work!
     
  12. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Yes, currently it calculates each invidual pixel and wont return 100% unless all pixels are painted
    (well it does get rounded to 100% if using integer though).

    Getting exact pixel count can be actually useful to identity which area was filled,
    for example you have 3 shapes to fill, you can then detect which object was filled by the unique pixel count value.

    It still needs some work, but if you need "early access" to test it, pm me around next week.
    Most likely next asset store update is still some weeks away, because need to finish few other features also.
     
  13. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    in the meanwhile, also tested one request about drawing lines:
    gif anim: http://pasteboard.co/1WhiuJh7.gif

    Its separate drawing mode, will look into snapping next (while drawing it would snap to close by lines)
     
  14. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    Will do, thank you. :)
     
  15. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    Well... I tested the default examples on a iPad2!

    The speed seems to be good, but there is some strange lags. Especially when I try to paint with textures. But overall is already very good! I put my 3 years daughter to test it, and besides the lags she liked it a lot! =P

    I will create an empty project with my own interface and make some more testing.

    Do you think there is some room for speed improvements?
     
  16. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Can you post or email me screenshot of the MobilePaint inspector settings?

    *edit: Also what is your custom texture resolution?

    And yes, theres plenty of things to improve and quite many things on the "todo" list,
    going through them based on user feedback so do keep reporting anything that you see.
     
    Last edited: Jul 21, 2015
  17. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Emailed the test package just now.
     
  18. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Hi mgear,

    I'm really interested in the package! What I would like to know, does it fully work on Unity 5.0?

    Thx!
     
  19. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Next update will be uploaded with unity5.1,
    still the current version works fine also (just let unity do that automatic script update).
     
  20. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Cool thx i'll buy it then :)
     
  21. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    I just checked the "Toonia Colorbook" data folder, and instead of using PNG for the "Art", it does uses SVG files.

    We have two greate SVG importer for Unity, did you think it would be possible to "Mobile Paint" becomes compatible with them?

    I was thinking here, do you think it renders the SVG on starting (making an texture of it) and uses your technique for paint or does it paints on the SVG imported itself?
     
  22. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    If the converter returns texture, then it should work just by assigning that texture to the canvas,
    and only after that initialize mobilepaint (so that it reads the new texture).

    Or did you mean, could assign the SVG to mobilepaint, and it would handle/call the converter?
     
  23. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    It definitely creates textures, I checked the save folder here and there is a .png file for each layer of the drawing! Strange, it seems to use a different technique to lock the painting inside the lines than MobilePaint.

    I think I can use RageTools and convert the SVG to a Texture in Runtime and then use MobilePaint to Paint It.

    How does MobilePaint handles saving? Can I save a drawing to continue painting it later?
     
  24. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    SVG support would be actually quite amazing, (outline) images would then look nice at any resolution device. I'll look into it.

    There is one example scene to save image into file, but that image is flattened, so it wouldnt work if want to continue drawing on it.. but you can access paint canvas layer from the material, so its just a matter of saving to disk (and loading back if need to continue).
     
  25. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Hi mgear,

    I bought your asset and everything is working fine! Really happy with it. I do have a question though about our setup (see screenshot).


    I would like to know if it's possible to only use the dark grey area as a canvas. I want to know the size of the canvas at all times even when the canvas scales to different resolutions on tablets. Is it possible to set the drawingcanvas to a Panel?
     
  26. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    There is option to give offset from full screen borders, but might have to modify it to allow spacing on both sides..

    I havent tested putting canvas inside UI panel, that would be quite useful.. Will test it soon.
     
  27. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Hi mgear,

    Did you get the chance to check drawing inside a UI panel? It would be really nice to have this function, i've tried to modify some stuff to get it to work, but i didn't get it working at the moment.

    thx!
     
  28. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    It should work so that inside CreateFullScreenQuad(),
    set those "go_Mesh.vertices" - positions to match the panel corners.

    Almost got it working earlier, converting UI element positions to screenspace, then to worldspace, and use as quad vertex positions.

    Will be included in the next update. (i can send you it earlier for testing once it works properly with different resolutions).
     
  29. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    if you can pm your email, i can send the current version for testing,
    there is now option to use canvas size from panel.

    canvas_from_panelsize.jpg canvas_from_panelsize_2.jpg
     
    Last edited: Aug 5, 2015
  30. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Great thx man! I'll pm you my email adres!
     
  31. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Hello!

    After importing my prototype to the actual project this error pops up:
    Assets/MobilePaint/Scripts/NewUI/BrushSizeUI.cs(21,32): error CS1061: Type `Slider' does not contain a definition for `onValueChanged' and no extension method `onValueChanged' of type `Slider' could be found (are you missing a using directive or an assembly reference?)

    This error only appears after project was imported, but project works fine otherwise in prototype.

    Another thing. Is there a way to smooth out the edges of the strokes? I haven't exported project to any testing device yet, but so far when drawing in the Unity Editor edges get pixelated.


    Thanks!
    German
     
  32. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Maybe auto updater fixed that script, since its not showing again..(current store version is uploaded with 4.6, next one is with 5.1)

    You can set FilterMode to Bilinear (Mobilepaint inspector), then its bit softer, can also try with [x] Use Additive Colors.

    Or do you mean the default brush, or custom brush paints looks pixelated?
     
  33. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    So do I need to update Mobile Paint? I made some retrofitting to a couple of MP scripts and was hoping to not do that.

    Good thing I guess is that I only added a couple of lines to MobilePaint.cs. Most of the work was done in the inspector. But hopefully I don't have to update to solve my problem.

    As far as the quality, I am using the default brush, which on the edges it looks pixelated.


    Thanks
     
  34. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    No need to update to next version, if current version works for you.
    (next version has some new features, but not required)

    Did you try that Bilinear filter?
    Can you post / email screenshot?
     
  35. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Thanks for your super quick response!

    I can't test the draw quality of the brush using the bilinear filter since I can't run the project due to the "`onValueChanged' and no extension method `onValueChanged' of type `Slider' could be found"

    Where is the auto updater you mentioned above? How could I fix that problem?


    Thanks
     
  36. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Oh ok the error didnt go away, which unity version you have?
     
  37. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    I have 4.6.7f1

    Everything works fine when running MP from an empty project > importing MP > working on my scene from there.

    Problem began after exporting this scene and importing it into my actual project and that's when I get that error.


    Thanks
     
    Last edited: Aug 11, 2015
  38. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Do you have any script/class called Slider in your project? Or are there any other warning messages in console?
     
  39. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    There aren't any other warnings, just this one.

    Shoot. I do have one script called Slider.cs in my main menu which manages the main volume of the app.

    I am at work and can check my project at night. Is it a simple fix to solve it from MP's point of view? I am planning on redoing the way that scene, main menu, but not in the short term.


    Thanks!
     
  40. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
  41. cesarpo

    cesarpo

    Joined:
    Jun 8, 2013
    Posts:
    97
    Hi, isn't working for me, every test scene I try to run throws the following error:

    Code (CSharp):
    1. Fatal error: Current shader doesn't have a property: '5f4d61696e546578'
    2. UnityEngine.Debug:LogError(Object)
    3. unitycoder_MobilePaint.MobilePaint:InitializeEverything() (at Assets/MobilePaint/Scripts/MobilePaint.cs:234)
    4. unitycoder_MobilePaint.MobilePaint:Awake() (at Assets/MobilePaint/Scripts/MobilePaint.cs:162)
    5.  
    I'm on unity 5.1.2f1
     
  42. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Check targetTexture field in inspector, it should contain some proper target that the current material(shader) has.

    as in, "_MainTex" or "_MaskTex" or others:

    Properties {
    _MainTex ("Canvas (RGBA)", 2D) = "white" {}
    _MaskTex ("Mask (RGBA)", 2D) = "white" {}
    }
     
  43. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Hey, it's me again.

    Check out the screenshot.

    I set Filter Mode to Bilinear and still looks pixelated. Left line.

    Check the line on the right when checking Use Additive Colors the line on the right.


    Thanks
     

    Attached Files:

  44. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    Hi!

    I got this response from SVG Importer :

    Maybe Mobile Paint is compatible with this behavior?
     
  45. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    With next update its easier to get smoother lines,
    In the current version you could try making custom smooth brush texture and use that,
    or if you pm your email address i can send the current v1.9 version (which should be in store within 2 weeks)
     

    Attached Files:

  46. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Yes, it should work..(but unable to test currently)
    - use SVG importer to load SVG, save/grab it as a texture2D, assign that texture to mobilepaint canvas, call InitializeEverything() *Next or next-next update has easier way to assign new textures on the fly.
     
  47. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Just tried this svg importer,
    https://github.com/MrJoy/UnitySVG
    It directly converts svg into texture, so just need to feed the texture into mobilepaint, i'll write tutorial for it later.
     
  48. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    If I am not using any custom brush texture (only the default one) how could I set up a new custom smooth brush texture and use it as default?

    Thanks
     
  49. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    What would you recommend to keep a modified MP updated?

    I'd like to update your asset and not worry about the changes I've made. For instance I've made considerable changes to ColorUIManager and one of the toggles. I've added about 5-10 to MobilePaint.cs.

    Thanks
     
  50. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    What kind of modifications you usually need in MobilePaint.cs?

    The other scripts are quite scene specific at the moment..so probably rather make new script which makes the calls, so if any demo scene+script gets updated, your script is still fine.