Search Unity

[Deprecated] PaintCraft (Multiplatform coloring book & drawing app constructor)

Discussion in 'Assets and Asset Store' started by nicloay, May 17, 2016.

  1. ErayT

    ErayT

    Joined:
    Dec 13, 2013
    Posts:
    20
    It is alright. I had to do some refactoring inside PaintCraft which I was not willing to do. That is because I do not like changing the code of 3rd parties loosing the coherence.
     
  2. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    No, you don't need to change any core methods. you can access this render texture from anywhere, just use paintcraft camera reference and take this camera.target render texture, then just write the similar method which will blit data from any texture2d. You can also find a demo which change images without scene reloading. you can check which method it use, maybe this will be useful for you as well.
     
    ErayT likes this.
  3. ErayT

    ErayT

    Joined:
    Dec 13, 2013
    Posts:
    20
    You are right. The only thing I should care is that I have to set it after Awake event because LoadFromDiskOrClear clears what I set on Awake event.
     
  4. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Oh.. you right. Maybe in this case you can try to implement your own PageConfig - and use it to load data in to paintcraft?
     
  5. RadiantSilvergun

    RadiantSilvergun

    Joined:
    Dec 27, 2017
    Posts:
    11
    @nicoay Hi Nikolay,

    Just letting you know it works! I tried the BeginLine methods within a standard for loop and was able to generate my complex shapes instantly, I only had to remove velocity to scale from the brush node inspector, obviously to preserve the line thickness, so that worked great, thank you so much for pointing me in the direction of these methods :) I have also solved my previous issue with GL.clear in the latest version of Unity 2018 and Xcode. I just removed OpenGL 3 and Metal (because this was interfering with my dual texture shader on iOS) graphics APIs from the iOS build settings and just left OpenGL 2 remaining. Now all my animations clear correctly and and I can apply multiple transparent textures to a single shader. This has all been achieved without having to downgrade Unity to the previous version.

    Cheers,

    Travis
     
    Last edited: May 20, 2018
    nicloay likes this.
  6. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    @RadiantSilvergun, thanks a lot for update.
    Several peoples ask me about 2018 version so I'll point them to your comment.

    Thanks again.
    //Nikolay
     
  7. ErayT

    ErayT

    Joined:
    Dec 13, 2013
    Posts:
    20
    @nicloay

    I want to encapsulate PaintCraft Canvas inside a frame as seen in the image. It sizes itself with respect to the screen by default as far as I can see.

     
  8. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
  9. ErayT

    ErayT

    Joined:
    Dec 13, 2013
    Posts:
    20
    It is fine right now. Although it works, I get this error message and I do not know why. :S

    Code (CSharp):
    1. Screen position out of view frustum (screen pos 627.712036, 122.880005, 0.000000) (Camera rect 43 43 0 0)
    2. UnityEngine.Camera:ScreenToWorldPoint(Vector3)
    3. PaintCraft.Controllers.ScreenCameraController:GetWorldPosition(Vector2) (at Assets/PaintCraft/Engine/Scripts/Controllers/ScreenCameraController.cs:167)
    4. PaintCraft.Controllers.ScreenCameraController:HandleMouseEvents() (at Assets/PaintCraft/Engine/Scripts/Controllers/ScreenCameraController.cs:146)
    5. PaintCraft.Controllers.ScreenCameraController:Update() (at Assets/PaintCraft/Engine/Scripts/Controllers/ScreenCameraController.cs:76)
     
  10. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    what is your screen rect size?
    Did you use screen space overlay on Unity UI canvas?
     
  11. ErayT

    ErayT

    Joined:
    Dec 13, 2013
    Posts:
    20
    If you mean RectTransform by screen rect size, it is stretched and has 100 margins on left and right.
    Yes, the canvas is set to screen space overlay.

    I have another issue. The doc says
    Code (CSharp):
    1. UIRect must be transparent and no any another ui element must not overlap paintcraft canvas - otherwise you will just not see it, or you will see it partially (which is in some case could be ok by your design)
    How am I supposed to add a background behind that draw canvas? :S
     
  12. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    This rect is only to calculate the screen rect. so you don't need to add any graphic ui elements to this rect and you can use any background in UI as paintcraft will draw itself later on the screen using another camera.

    Can you show me screenshot with your rect please and hierarchy in ui. Plus make screenshot of your UI Canvas.
    It looks like the script are not able to calculate screen rect width properly.

    Also. do you use latest paintcraft version?
     
  13. ErayT

    ErayT

    Joined:
    Dec 13, 2013
    Posts:
    20
    https://ibb.co/dAgZvo
    https://ibb.co/eS1yo8

    I made the gradient background half transparent. Otherwise paintcraft page cannot be seen. I have the version 2.2 (current)
     
  14. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    @ErayT, could you export your drawing scene and send it to support@paintcraft.in, i'll check everything here and let you know how to fix it.

    Thanks.
     
  15. Vegorama

    Vegorama

    Joined:
    Jun 14, 2018
    Posts:
    5
    Hi @nicloay

    First of all, thanks for this great tool. Almost exactly what I needed.

    Was just wondering if you could give me a hand. I want to be able to use the images that are drawn as sprites during runtime. As in, a child draws an image, presses 'finished', and then I can make a little car they have coloured in drive across a road (for instance).

    Is there a way I can export the image to be used as a temporary sprite?

    Thanks again!
     
  16. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
  17. Vegorama

    Vegorama

    Joined:
    Jun 14, 2018
    Posts:
    5
    @nicloay
    Thanks for the quick feedback!
    So I've spent a good bit of time playing around with this, but no joy yet.
    Do you have an example of it working?
    What should I be using as the 'OutlineMaterial'? I have tried a few different default materials as well as creating my own, but I only ever create a grey, square texture.
     
  18. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    @Vegorama, 'OutlineMaterial' Is a material used by outline layer. usually you don't need to touch it. and in the saveimage script it use the same material used by paintcraft at runtime rendering.

    Are you sure that the problem with save image? did you try to save result image to the file system? (please check this page https://docs.unity3d.com/ScriptReference/ImageConversion.EncodeToPNG.html to find how to save texture2d to filesystem)
     
  19. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    I am sorry, you right. CanvasController just have link to the OutlineLayerController and those controller has material on it. but you have to change Material property to public.

    so.
    1. replace OutlineMaterial to OutlineLayerController.material at CanvasController
    2. at OutlineLayerController.cs make material property to public.

    Please let me know if you need further assistance.

    Thanks.
     
    lo2w0 likes this.
  20. Vegorama

    Vegorama

    Joined:
    Jun 14, 2018
    Posts:
    5
    @nicloay Thanks for your help again!
    Sorry I deleted the last comment, was about to reword it but then you answered my question.

    I am getting a new strange issue: when I build Paintcraft to a mobile device, it is only displaying a pink screen rather than any colouring pages. It all works perfectly in unity editor but not at all on mobile.

    Have you ever had this issue? Do you have any suggestions?

    Thanks again for your support so far!
     
  21. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    @Vegorama Did you import the whole project (with project settings)? could you check your layer setup please. Just click any object on scene then open drop down list in top right corner with layers, and make screenshot of that.

    Paintcraft use several layers for itself, if you overwrited them it will lead to issues like this on build.
     
  22. Vegorama

    Vegorama

    Joined:
    Jun 14, 2018
    Posts:
    5
    @nicloay cheers for the response yet again!
    Here's the layers in my scene, though not having the same layers as your project has caused no issues in my unity editor. Do the layers need to be numbered the same as yours, on 9 and 10?
     

    Attached Files:

  23. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    @Vegorama I think this is the problem why it doesn't work.

    As you see Default config is following
    upload_2018-7-2_21-31-17.png
    so if you changed this config. please define new layers with "Brush" and "TempRender" name
    and then adjust paintcraft class controller properly
    upload_2018-7-2_21-33-42.png


    Also. Please open graphic settings (TopMenu->Edit->ProjectSettings->Graphics) and make sure that you didn't remove Unlit/Texture and Unlit/Transparent shaders
    upload_2018-7-2_21-37-6.png
     
    Naderkhn likes this.
  24. Vegorama

    Vegorama

    Joined:
    Jun 14, 2018
    Posts:
    5
    Cheers @nicloay, that helped a lot.
    Inevitably, one more issue I need help with, I'm so close! Middle of an all nighter over here.
    Everything works peachy dandy on IOS and in editor, but on android I've got a really annoying issue where PaintcraftCanvas.ClearCanvas() is not clearing the previous texture properly. Any ideas?
     
  25. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    @Vegorama do you have any error in log ('adb logcat -s Unity' in terminal). Did y you change any code or render texture settings (main questions are your textures has "ARGB32" format (keep in mind that RGBA32 and ARGB32 are different, and as I remember on android just ARGB32 is supported).
     
  26. RadiantSilvergun

    RadiantSilvergun

    Joined:
    Dec 27, 2017
    Posts:
    11
    Hi Nikolay,

    How can I stop the the Undo Manager from saving a snapshot every time the screen is touched? I want to pause this functionality temporarily, then re-enable it when needed.

    Cheers,

    Travis
     
  27. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    @RadiantSilvergun, Sorry there is no built in support for this behaviour. What you can try to do is open InputController.cs and find the way how and where StoreStateBeforeSnapshot() and MakeSnapshot() are used. and then just make the flag which will prevent that methods calls.

    Please let me know if you need further assistance.

    Thanks.
    //Nikolay.
     
  28. RadiantSilvergun

    RadiantSilvergun

    Joined:
    Dec 27, 2017
    Posts:
    11
    Hi Nikolay,

    This is perfect thank you.

    Travis
     
  29. pavel_unity794

    pavel_unity794

    Joined:
    Jul 18, 2018
    Posts:
    1
    Hi Nikolay! We're developers from Russia and we are building a similar project. Can we have your paid consultation via Skype? Please contact me Skype: pavelgubarev or e-mail pavel@gubarev.ru . Thank you!
     
    nicloay likes this.
  30. rizawerx

    rizawerx

    Joined:
    May 30, 2013
    Posts:
    38
    Hi Nikolay,

    I think there's problem in iOS. I tried to use PaintCraft in iOS, spesifically iPad air2 and iOS version 11.4.1. The problem is the images become black, please see attachment files. It works perfectly in Android.
    Thank you
    IMG_0080.PNG IMG_0081.PNG IMG_0082.PNG
     
  31. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    @rizawerx, Which Unity version did you use, did you import project settings?
     
  32. rizawerx

    rizawerx

    Joined:
    May 30, 2013
    Posts:
    38
    Hi Nikolay,

    By import project settings, do you mean importing complete project? if yes, then yes I import whole project at first..clear button also didn't work
    I'm using newest unity2018.2.4f1..
    I just read that you don't officially support until 2018.3? Maybe this is because of that? If yes, what unity version do you recommend?

    Thank you,
     
  33. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    @rizawerx, please use latest 2017.x.x version right now it's a 2017.4.9
     
    rizawerx likes this.
  34. jjtech0622_unity

    jjtech0622_unity

    Joined:
    Jul 23, 2018
    Posts:
    1
    Now, I'm testing 2~3 brush Tool ( Brush, Crayon, Ink) with few color buttons .
    Brush is always work well but , others(Crayon, Ink...) are not work right .
    after if I press the brush button, then they work .
    There's any check point of that ?
    shot.png
     
  35. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    @jjtech0622_unity, So the problem in brush change? not in the behaviour?

    Can you show me please how do you change the brushes.
    also do you have problem just in editor or on mobile or both?

    Also. I remember there was an issue in previous paintcraft version. Can you make sure that you use latest one from asset store.

    Thanks
    //Nikolay.
     
    Last edited: Sep 3, 2018
  36. ActplusDev

    ActplusDev

    Joined:
    Apr 30, 2018
    Posts:
    1
    Hi Nikolay,
    love using your plugin after I bought it. I know that using ios version 11.4.1 and Unity version 2018, the canvas will turn black, but it is a quick fix for using 2018?
     
  37. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    @ActplusDev, Thanks for feedback. Sorry but right now there is no support for 2018. If it's possible please use 2017.x version.

    Thanks.
    //Nikolay.
     
  38. Deleted User

    Deleted User

    Guest

    Just purchased this asset, and it looks great so far! However, I would prefer to use Unity 2018 if possible. Unfortunately, I am running into the black images problem on iOS with the first coloring pages. I noticed that the demo project's color on "Transparent Background" works fine. This makes me think there may be a workaround for the white background. Has anyone figured this out yet?
     
  39. Deleted User

    Deleted User

    Guest

    Is it possible to tweak something in the code or shader to allow painting regions to "touch" (or slightly overlap) each other, rather than having a small gap between them? I would like to have coloring regions without the typical coloring book black outlines.

    Below is an example region image I made. The image after that is what it looks like when all regions are colored black. I would like the behavior in the 2nd image example to be a solid black image rather than having the small white outlines at the edges of regions.

    regions:
    1.png
    image should be all black:
    2.png
     
  40. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    @MooseMouse, Yes it's possible.
    1. Use standard region file
    2. In the import settings make sure that you still use FILTER_MODE=POINT (it's very important)
    3. For background layer which render background in render texture import settings setup FILTER_MODE = BILINEAR

    In this case regions will still calculate properly in shader, but on the screen render (after swatch apply to the background) bilinear filtration will apply to them

    Hope this helps. please let me know if you will have any questions or you need additional details.
     
  41. Deleted User

    Deleted User

    Guest

    HI Nicloay,

    Thank you for the quick reply! Unfortunately, that doesn't seem to remove the gaps. The region file's filterMode is set to Point, and I've set the BackLayer's RenderTexture filterMode to Bilinear in the BackLayerController script. I can see that the gap becomes a little bit fuzzier with the RenderTexture's filterMode set to Bilinear, but it is not enough to close the gap. I even tried it with Square regions so that anti-aliasing would not factor in, but there is even a gap around the square. Is this working for you? It is possible I've misunderstood your directions, but I believe I did what you suggested.
     
  42. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    @MooseMouse
    You also have problem with your region file
    upload_2018-10-11_19-7-47.png
    See. your regions is not adjucent to each other, there is slight bilinear interpolation between them. So in your design software like if you use illustrator. On export you need to explicitly tell that you need an export with filter_mode=point as well.

    p.s. Antialiasing doesn't work in this kind of rendering. As I understand it works only on GL lines and triangles. but in paintcraft there is just one plane. and when you apply a line or any swatches it just blit this texture to texture
     
  43. Deleted User

    Deleted User

    Guest

    I got it working. I made sure there was no interpolation (anti-aliasing) between the regions in Photoshop before I exported. The other change I had to make was to uncheck "Generate Mip Maps". Thanks for the speedy help! 5 stars from me!
     
    nicloay likes this.
  44. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    yeah. sorry forgot about mipmaps. Unity also sometime enable powerOf2 and break regions as well.
     
  45. Deleted User

    Deleted User

    Guest

    I'm trying to set up a brush to act like one in Photoshop which has opacity control. I am tweaking the "Basic Brush" you have made, specifically the "SetFixedAlpha" node. You have it set to 0.05 in the "Basic Brush". When I set it even lower, like 0.01 it doesn't seem to go all the way to the swatch color (black in this case) no matter how many times I paint over it. It just goes to a gray color and no darker. Is there a way to make brush opacity work as it does in Photoshop so that even if the brush has a low opacity, I can paint all the way to (black) if I paint over it enough times?
     
  46. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Everything happens in the shader. so you can try to play with different blend modes. just check which material this tools use and try to adjust blend mode, color mixing etc. there.
     
  47. Deleted User

    Deleted User

    Guest

    Got it working, but I'm not sure why. I ended up switching the BackLayer's RenderTexture's Color Format from ARGB32 to ARGBHalf. So far, the painting works as I have described above, but I'm not sure what other things this may have changed. I had no real reason for trying this.. I was just switching things around to see what happened. If anyone knows why this would do what it did, please feel free to explain.
     
  48. FeynmanRen100

    FeynmanRen100

    Joined:
    Sep 6, 2013
    Posts:
    22
    Hi dev, can you upload this package with unity 2018.2, so I can make sure it runs smoothly on our unity version.
     
  49. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    I'm sorry but 2018.x is not supported yet.
     
  50. Deleted User

    Deleted User

    Guest

    I've taken a screenshot from your demo example "Transparent Background". Is there a way to remove the white fringe from the brush alpha? I've played with blend modes in the shader, but I can't get rid of it. I think it has to do with the way the render texture blends with the background.

    fringe.png