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

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

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

  1. Kalyyta

    Kalyyta

    Joined:
    Feb 12, 2016
    Posts:
    13
    Can you please tell the correct blending mode?
     
  2. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    I hope at the end of this week or max on the next one (I've already submitted new version to asset store)

    If you urgently need this feature just drop me email with your invoice id and i'll send you private build.

    >> Can you please tell the correct blending mode?

    premultiplied alpha
     
    Last edited: May 3, 2017
  3. Kalyyta

    Kalyyta

    Joined:
    Feb 12, 2016
    Posts:
    13
    Thanks! But with Blend One OneMinusSrcAlpha mode I'm getting different blend artifacts:
     

    Attached Files:

    • 1.png
      1.png
      File size:
      27.7 KB
      Views:
      972
  4. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    did you premultiplied color in pixel shader like this?

    color.rgb*=color.a;

    I've updated webgl build as well so you can find that stamps works good here http://paintcraft.in/player/essential/
     
  5. unitynosf

    unitynosf

    Joined:
    Jun 9, 2014
    Posts:
    23
    Hello;

    very cool asset. One question - what would be the quickest way to get zoom/move picture with brush (bucket/fill) at same time? Simply to enable users to swipe around and then tap to fill colour. Is that something that can be set in package already or should one modify code? (I tried brush creator - few options - none worked).

    Thanks and keep up the good work.
     
  6. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Thanks for feedback unitynosf. (will be really great if you will left something on store page as well ;))
    Sorry original it was designed for multitouch drawing.
    For you case i think quickest way will be to change Inputcontroller script (which read input from the screen and forward them to the paint craft) and if it's a single touch - just live everything as is. if 2 touches force replace tool to the move zoom tool. and then change tool back when input is over.

    Probably in next releases i have to include these behavior by default.
     
  7. AyreGuitar

    AyreGuitar

    Joined:
    Oct 12, 2013
    Posts:
    35
    Thanks for the Stamp shader fix, works great on my iPad 2 running iOS 8.4.1 and iPod touch running iOS 9.2.1 (although won't place a Stamp in regions that are pure black RGB(0,0,0))

    BUT there's problems on some devices, e.g. iPad Pro and iPhone 6 Plus running iOS 10.3.1 - the stamp doesn't work in some regions - see attached screenshot of fox:
    body & tail & head RGB(112,112,112)
    back leg foreground RGB(28,28,28)
    ground RGB(43,43,43))

    PaintCraftStickerBug.PNG

    Perhaps it's the version of OpenGL that is being used is not fully compatible with the shader code?
    Works fine with the older SwatchRegionShader.shader in any region.
    Any help to fix this is much appreciated!
     
  8. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    AyreGuitar
    Could you check please that problem regions doesn't have AlphaChannel = 0 (i mean totally transparency on that pixel). many people asked me to make this feature (some regions exclude from drawing) so I did that.
     
  9. AyreGuitar

    AyreGuitar

    Joined:
    Oct 12, 2013
    Posts:
    35
    I've noticed that RGB(0,0,0) which translates to AlphaChannel=0 will be excluded - I gave the RGB values for the problem regions, so they should translate to these AlphaChannels:
    AlphaChannel=112
    AlphaChannel=28
    AlphaChannel=43
    Unless I'm missing something? The picture's from your PaintCraft Demo scene (fox) in v1.08 so you should be able to check at your end - I just made it an iOS build. Using Unity 5.6.0f3 in case it makes a difference - Thanks!
     
  10. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Right now you don't need to work with grayscale you can use RGB just make sure that compressing is turned off.and you have filter=Point.
     
  11. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Finally after more than 2 week Pro version has been accepted.

    You can find it here
    SVG + simple 3D support.

    facebook_2.jpg
     
    AlphaGTR likes this.
  12. AyreGuitar

    AyreGuitar

    Joined:
    Oct 12, 2013
    Posts:
    35
    Thanks - Won't be able to check using RGB for regions and stamp problem on iPad Pro until next week.

    In the meantime, I'm struggling to make a Fill region tool that uses RenderSwatchPointMaterial (eg for patterned fill) instead of RenderSwatch (which is marked as obsolete in the .cs file).

    I've tried simply substituting RenderSwatch for RenderSwatchPointMaterial, but then it ignores the regions and comes out Magenta (I assume due to some material not being set).

    I've also tried adding a FloodFillFilter to the start of the PatternBrushRegionSupport in the Advanced section of the Brush Pack, but this gives the error:
    NullReferenceException: Object reference not set to an instance of an object
    PaintCraft.Tools.Filters.MaterialFilter.SetMaterial.FilterBody (PaintCraft.Tools.BrushContext brushLineContext) (at Assets/PaintCraft/Engine/Scripts/Tools/Filters/Material/SetMaterial.cs:22)
    PaintCraft.Tools.FilterWithNextNode.Apply (PaintCraft.Tools.BrushContext brushLineContext) (at Assets/PaintCraft/Engine/Scripts/Tools/Filters/FilterWithNextNode.cs:15)
    PaintCraft.Tools.FilterWithNextNode.RunNextFilter (PaintCraft.Tools.BrushContext brushContext) (at Assets/PaintCraft/Engine/Scripts/Tools/Filters/FilterWithNextNode.cs:46)
    PaintCraft.Tools.FilterWithNextNode.Apply (PaintCraft.Tools.BrushContext brushLineContext) (at Assets/PaintCraft/Engine/Scripts/Tools/Filters/FilterWithNextNode.cs:18)
    PaintCraft.Tools.FilterWithNextNode.RunNextFilter (PaintCraft.Tools.BrushContext brushContext) (at Assets/PaintCraft/Engine/Scripts/Tools/Filters/FilterWithNextNode.cs:46)
    PaintCraft.Tools.FilterWithNextNode.Apply (PaintCraft.Tools.BrushContext brushLineContext) (at Assets/PaintCraft/Engine/Scripts/Tools/Filters/FilterWithNextNode.cs:18)
    PaintCraft.Tools.FilterWithNextNode.RunNextFilter (PaintCraft.Tools.BrushContext brushContext) (at Assets/PaintCraft/Engine/Scripts/Tools/Filters/FilterWithNextNode.cs:46)
    PaintCraft.Tools.FilterWithNextNode.Apply (PaintCraft.Tools.BrushContext brushLineContext) (at Assets/PaintCraft/Engine/Scripts/Tools/Filters/FilterWithNextNode.cs:18)
    PaintCraft.Tools.FilterWithNextNode.RunNextFilter (PaintCraft.Tools.BrushContext brushContext) (at Assets/PaintCraft/Engine/Scripts/Tools/Filters/FilterWithNextNode.cs:46)
    PaintCraft.Tools.FilterWithNextNode.Apply (PaintCraft.Tools.BrushContext brushLineContext) (at Assets/PaintCraft/Engine/Scripts/Tools/Filters/FilterWithNextNode.cs:18)
    PaintCraft.Tools.BrushContext.ApplyFilters (Boolean lastPoint) (at Assets/PaintCraft/Engine/Scripts/Tools/BrushContext.cs:185)
    PaintCraft.Controllers.ScreenCameraController.EndLine (Int32 lineId, Vector2 touchScreenPosition) (at Assets/PaintCraft/Engine/Scripts/Controllers/ScreenCameraController.cs:187)
    PaintCraft.Controllers.ScreenCameraController.HandleMouseEvents () (at Assets/PaintCraft/Engine/Scripts/Controllers/ScreenCameraController.cs:163)
    PaintCraft.Controllers.ScreenCameraController.Update () (at Assets/PaintCraft/Engine/Scripts/Controllers/ScreenCameraController.cs:73)

    More examples and/or documentation would be appreciated - Thanks!
     
  13. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    You can continue use previous flood fill implementation. the difference between advanced tools and previous one is that in advanced tools it's possible to use several materials at once (like a line with different material on head and tail). For flood fill it doesn't matter. so just use previous one.
     
  14. AyreGuitar

    AyreGuitar

    Joined:
    Oct 12, 2013
    Posts:
    35
    The stamp bug still happens when I use RGB24 image for the regions. Like I said, it's happening with your PaintCraft Demo colouring book when run on iPad Pro and iPhone 6 Plus running iOS 10.3.1. Just need a fix or workaround - Thanks!
     
  15. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    just to confirm you didn't enable compression. right?
     
  16. AyreGuitar

    AyreGuitar

    Joined:
    Oct 12, 2013
    Posts:
    35
    No, compression is off.
     
  17. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    just paint problem region in to another color. like Red or Blue, it will solve the problem. Starting from 1.4 version it's possible to use any RGB combination in region file.

    Thanks.
    Nikolay.
     
  18. AyreGuitar

    AyreGuitar

    Joined:
    Oct 12, 2013
    Posts:
    35
    Ideally I don't want to have to keep finding 'magic' colours that work with the stamp tool, could be very time consuming. Also not so great for other people using your plugin that have lots of different regions.

    I've narrowed it down to the shader: If I use the SwatchRegionShader.shader from v1.07 of PaintCraft it stamps OK in all regions (although get aliasing bug on stamp), but failed with v1.08 shader. This is for iPad Pro and iPhone 6 Plus running iOS 10.3.1 - Hope that helps you fix it. Thanks!
     
  19. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    I understand and agree with you. and thanks a lot for info. especially your email with screenshots and additional data - very helpful.

    upd1:
    Solution is following (while new version 1.09 is not accepted).
    In every shader which has Region word in name
    change following line
    Code (csharp):
    1. color *= tmp.r * tmp.g * tmp.b * tmp.a == 1;
    to
    Code (csharp):
    1. color *= tmp.r + (tmp.g*10) + (tmp.b*100) + (tmp.a * 1000) == 1111;
     
    Last edited: May 23, 2017
  20. aliak

    aliak

    Joined:
    Jan 2, 2017
    Posts:
    12
    Hi,
    is it possible to make a preview for svg importer config ?
     
  21. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Hello aliak. It is possible but i don't think that I will implement this in near feature. Can you just start the app with your config and check it in play mode? You know that you can just open your ColoringBook scene and select page config at CanvasController so when you will start this scene you will immediately see result for selected page config.
     
  22. AyreGuitar

    AyreGuitar

    Joined:
    Oct 12, 2013
    Posts:
    35
    Tried your fix for the stamp bug on iPad Pro:
    Code (CSharp):
    1. color *= tmp.r + (tmp.g*10) + (tmp.b*100) + (tmp.a * 1000) == 1111;
    Whilst it was better, still was not working on some regions, so I've to changed it to this which works fine:
    Code (CSharp):
    1.         color *= tmp.r ==1;
    2.         color *= tmp.g ==1;
    3.         color *= tmp.b ==1;
    NB doesn't work if I also have this line:
    Code (CSharp):
    1.  color *= tmp.a ==1;
    But don't need alpha, which should be 1 for whole image.
    Just thought you might like to know!
     
    Last edited: Jun 7, 2017
  23. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Thank you. But it's a bit strange as i use previous shader approach on my new coloring book and it doesn't have any problem (some of them have thousands of regions and there is no any issues there) you can check it here https://paintcraft.in/coop/v6/ maybe it's related to stamps somehow.
     
  24. AyreGuitar

    AyreGuitar

    Joined:
    Oct 12, 2013
    Posts:
    35
    Probably related to Stamps, since Bucket fill works OK (but then that uses a different shader!). Tried that link on iPad Pro (iOS 10.3.1), but gets stuck showing the choice of pictures to choose from (they all just have busy icons)
     
  25. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    sorry it's a webgl only build works in PC browsers only.
     
  26. aliak

    aliak

    Joined:
    Jan 2, 2017
    Posts:
    12
    Nicloay, do you plan to add
    Ok, thanks for answering.
    Do you plan to add this cool flood fill feature from webGL build to new package version? Or is there any way to get the code snippet? It really looks great
     
  27. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Not in a near future. I rewrite to much in that project. so not sure that margin to current paintcraft package will be easy.
     
  28. Kalyyta

    Kalyyta

    Joined:
    Feb 12, 2016
    Posts:
    13
    Hi! There are a memory leak bug. Mesh seems to be not garbage collectable, so the only way to clean mesh from memory is to call Resources.UnloadUnusedAssets ();. I call it at if (brushLineContext.IsLastPointInLine) in RenderSwatch.
    Also meshPool not working as it цas conceived. Fixed it by FlushUsedMeshes() remove, and adding simple
    while (usedMeshes.Count > 0)
    {
    meshPool.Enqueue(usedMeshes.Dequeue());
    }

    before
    if (brushLineContext.IsLastPointInLine)
     
    nicloay likes this.
  29. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540

    Thanks a lot for info, I'll check it and include fix in to the next update
     
    Kalyyta likes this.
  30. Kalyyta

    Kalyyta

    Joined:
    Feb 12, 2016
    Posts:
    13
    Update of my previous comment.
    After include of my changes there are some weird bugs on android. Seems like at begin of brush painting, if I begin paint at the edge of region, my mesh doest cutted by other region, but at continuous painting regions working fine. This problem have a place only if meshes are reusable.
     
    AlphaGTR likes this.
  31. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    2017-06-26_16-43-23.gif Here is what I'm working right now. And what I want to include in to the next release.
    Many people ask, so doing my best to make it works =)
     

    Attached Files:

  32. madmoredie

    madmoredie

    Joined:
    Jan 18, 2013
    Posts:
    7
    Hi @nicloay
    I need a brush toggle to trigger game object to appear on Value change (Boolean) / on user click.
    Your script is save user last pick brush on PlayerPrefs, so if the last pick is any brush, the game object will appear immedietly at scene started without user click on it, so I need the system not to save that prefs.
    So I made a little change on "ChangeBrushOnClickController" script.
    It is ok for me to change that? or it will make any issue on the others (anything)?
    or maybe you have any solution for this issue?
    *I need toogle not button so user can know where he is on brush or not
    Thx.
     

    Attached Files:

  33. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Yes it's totally ok to change any of UI scripts. they are there only just to show how to work with paintcraft core. But it would be better to copy/paste the whole script to your own so on update it won't overwrite your changes.
     
  34. Kalyyta

    Kalyyta

    Joined:
    Feb 12, 2016
    Posts:
    13
    Hi! I have a question about NormalRegion shader. Can I change it's blend mode to make my brush meshes not multiply their alpha channels? I want to get an effect of one big mesh and not multiple meshes laying one upon other.
    Thx.
     
  35. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Yes. you can change any shaders it won't affect any critical core features. May I ask you which blend mode are you going to use? as premultiplied alpha is a critical stuff to render transparent sprites on top of another sprites (e.g. the similar premultiplied alpha used in standard unity sprites)
     
  36. Kalyyta

    Kalyyta

    Joined:
    Feb 12, 2016
    Posts:
    13
    Thanks for reply!
    I'm using stancil buffer for now, it is pretty close to wanted result.
    in subshader i passed this:
    Stencil
    {
    Ref 1 // The reference value to test
    Comp Greater // Is the Ref greater than the value in the buffer for this pixel?
    Pass IncrSat // If so, then increment the value in the buffer
    }

    and in frag:

    half4 frag (v2f i) : COLOR
    {
    fixed4 color = i.color;

    color.a *= tex2D (_MainTex, i.uv).a;

    if(color.a < 0.4)
    {
    clip(color.a - 0.5);
    }
    ...............
    }

    Next problem is that to calculate visibility of pixel it needs drawn meshes of line. All of them at once. But during draw part of meshes is already drawn on renderTexture, so no one effect can be applied on them
     
  37. Kalyyta

    Kalyyta

    Joined:
    Feb 12, 2016
    Posts:
    13
    The thing i thought, is change argorithm of brush painting. Draw meshes to temp render target with alpha 1, after that apply alpha to needed value and just then draw with camera. But this is my backup plan.)
     
  38. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    I'm not sure but in this case you need to draw the whole line at once, not segment by segment as it works right now. So you could face FPS downgrade especially when your line will be long.

    Or you want to keep render target until line finished and render points as usual there and only at the last point use another render to merge result in to back layer?
     
  39. Kalyyta

    Kalyyta

    Joined:
    Feb 12, 2016
    Posts:
    13
    In this case I can just add few dots to render texture, adjust color and alfa to whole texture and draw mesh with this texture. At next update I can add next few dots
     
  40. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    In the Paintcraft PRO package there is a script which auto paint all regions in unique color (after svg image render is done). So in one coloring book I reused this script, but with a little hack.

    As input I used black/white images which also required In auto painting, so i took that script and a little adjusted it. As you understand if you will use simple iterator (1,2,3..n) all colors would be similar and it will be hard to recognize is auto painting is ok or not. so what i did is utilized System.Security.Cryptography package. and each number just encrypted so in the end i got a sequence of unique colors in pseudo random order.

    Here you can see result (combined outline layer with region files). I also want to include this script in next PRO release.
    abstract_11.jpg
    random_11.jpg plant_8.jpg pattern_10.jpg animal_3.jpg
     
  41. Kalyyta

    Kalyyta

    Joined:
    Feb 12, 2016
    Posts:
    13
    Code (CSharp):
    1. using UnityEngine;
    2. using PaintCraft.Tools;
    3. using System.Collections.Generic;
    4. using System;
    5. using PaintCraft.Utils;
    6. using NodeInspector;
    7. using UnityEngine.Rendering;
    8.  
    9.  
    10. namespace PaintCraft.Tools.Filters{
    11.  
    12.  
    13.     [NodeMenuItem("Renderer/RenderBrushSwatch")]
    14.     public class RenderBrushSwatch : FilterWithNextNode {
    15.         public Material RegionMaterial;
    16.         public Texture2D BrushTexture;
    17.  
    18.         [NonSerialized]
    19.         bool isInitialized = false;
    20.  
    21.         [NonSerialized]
    22.         bool isClearNeeded = true;
    23.  
    24.         public RenderTexture brushRenderTexture;
    25.  
    26.         Mesh renderTextureMesh;
    27.         Material renderTextureMaterial;
    28.  
    29.         public void Init(BrushContext brushLineContext, Point point)
    30.         {
    31.             renderTextureMesh = GetRenderTextureMesh(brushLineContext, point);
    32.             renderTextureMaterial = GetRenderMaterial (brushLineContext, RegionMaterial, brushLineContext.Canvas.RegionTexture);//, brushRenderTexture);
    33.  
    34.             isInitialized = true;
    35.         }
    36.  
    37.         #region implemented abstract members of FilterWithNextNode
    38.         public override bool FilterBody (BrushContext brushLineContext)
    39.         {
    40.             LinkedListNode<Point> point = null;
    41.  
    42.  
    43.             point = brushLineContext.Points.Last;
    44.  
    45.             RenderTexture temp = RenderTexture.active;
    46.             RenderTexture.active = brushRenderTexture;
    47.  
    48.             if (!isInitialized)
    49.             {
    50.                 Init (brushLineContext, point.Value);
    51.             }
    52.  
    53.             if (isClearNeeded)
    54.             {
    55.                 GL.Clear(true, true, Color.clear);
    56.                 isClearNeeded = false;
    57.             }
    58.  
    59.             GL.PushMatrix();
    60.             GL.LoadPixelMatrix(0, brushLineContext.Canvas.Width, 0, brushLineContext.Canvas.Height);
    61.  
    62.             Vector3 pointPosition;
    63.             while (point != null )
    64.             {
    65.                 if (!point.Value.IsBasePoint)
    66.                 {
    67.                     pointPosition = point.Value.Position;
    68.                     pointPosition.z = brushLineContext.Canvas.BrushOffset;//brushLineContext.Canvas.transform.position.z +
    69.  
    70.                     if (point.Value.Status == PointStatus.ReadyToApply || point.Value.Status == PointStatus.Temporary)
    71.                     {
    72.                         //GL.MultMatrix(Matrix4x4.TRS ( Vector3.zero, Quaternion.Euler (0, 0, 45), Vector3.one ));
    73.  
    74.                         Graphics.DrawTexture
    75.                         (
    76.                             new Rect
    77.                             (
    78.                                 brushLineContext.Canvas.Width / 2 + pointPosition.x - point.Value.Size.x * point.Value.Scale / 2,
    79.                                 brushLineContext.Canvas.Height / 2 + pointPosition.y - point.Value.Size.y * point.Value.Scale / 2,
    80.                                 point.Value.Size.x * point.Value.Scale,
    81.                                 point.Value.Size.y * point.Value.Scale
    82.                             ),
    83.                             BrushTexture
    84.                         );
    85.  
    86.                         if(point.Value.Status == PointStatus.ReadyToApply) point.Value.Status = PointStatus.CopiedToCanvas;
    87.                     }
    88.  
    89.                 }
    90.                 point = point.Previous;
    91.  
    92.             }
    93.  
    94.             pointPosition = Vector2.zero;
    95.             pointPosition.z = brushLineContext.Canvas.BrushOffset;
    96.  
    97.  
    98.             renderTextureMaterial.SetFloat("_OriginX", brushLineContext.FirstPointUVPosition.x);
    99.             renderTextureMaterial.SetFloat("_OriginY", brushLineContext.FirstPointUVPosition.y);
    100.             MeshUtil.ChangeMeshColor(renderTextureMesh, brushLineContext.Points.Last.Value.PointColor.Color);
    101.  
    102.  
    103.             if (brushLineContext.IsLastPointInLine)
    104.             {
    105.                
    106.                 Graphics.DrawMesh (renderTextureMesh, pointPosition, Quaternion.identity, renderTextureMaterial,
    107.                     brushLineContext.Canvas.BrushLayerId, brushLineContext.Canvas.CanvasCameraController.Camera);
    108.  
    109.                 isClearNeeded = true;
    110.  
    111.             }
    112.             else
    113.             {
    114.                 Graphics.DrawMesh (renderTextureMesh, pointPosition, Quaternion.identity, renderTextureMaterial,
    115.                     brushLineContext.Canvas.TempRenderLayerId, brushLineContext.SourceInputHandler.Camera);
    116.             }
    117.                
    118.             RenderTexture.active = temp;
    119.             GL.PopMatrix();
    120.             return true;
    121.         }
    122.  
    123.  
    124.         Mesh GetRenderTextureMesh(BrushContext brushLineContext, Point point){
    125.             float width = brushLineContext.Canvas.RenderTextureSize.x;
    126.             float height = brushLineContext.Canvas.RenderTextureSize.y;
    127.  
    128.             Mesh result = MeshUtil.CreatePlaneMesh(width, height);
    129.  
    130.             MeshUtil.ChangeMeshColor(result, point.PointColor.Color);
    131.             MeshUtil.UpdateMeshUV2(result, width, height, Vector2.zero, 0.0f, (float)brushLineContext.Canvas.Width, (float)brushLineContext.Canvas.Height, brushLineContext.Canvas.transform.position);
    132.             return result;
    133.  
    134.         }
    135.  
    136.         #endregion
    137.  
    138.         Material GetRenderMaterial(BrushContext brushContext, Material parentMaterial, Texture regionTexture = null, Texture renderTexture = null)
    139.         {
    140.             Material result = new Material(parentMaterial);          
    141.                      
    142.             if (null == renderTexture)
    143.             {
    144.                 result.SetTexture ("_MainTex", brushRenderTexture);
    145.             }
    146.  
    147.             result.SetTexture ("_RegionTex", regionTexture);
    148.             result.SetFloat("_OriginX", brushContext.FirstPointUVPosition.x);
    149.             result.SetFloat("_OriginY", brushContext.FirstPointUVPosition.y);
    150.  
    151.             if (brushContext.ClippingMaskOffset != Vector2.zero && result.HasProperty("_ClippingMask"))
    152.             {
    153.                 result.SetTextureOffset("_ClippingMask", brushContext.ClippingMaskOffset );
    154.             }
    155.  
    156.             result.enableInstancing = true;
    157.  
    158.             return result;
    159.         }
    160.  
    161.  
    162.     }
    163. }
    Hi! Chaged render swatch to draw not-overlapped brushes without creating new meshes. Needs to turn off deleting points in same place(spline interpolator).

    The only problem is in rotation of brushes. It must be done by rotating of background texture around current painted point, but there are some calculation troubles.
     
    nicloay likes this.
  42. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
  43. inCreactive

    inCreactive

    Joined:
    Dec 21, 2016
    Posts:
    9
    Hello nicloay!

    We already bought this excellent project and we're really happy with all the cool features you have integrated over time. We wanted to know what would be the best approach for making a painting app that has multiple layers... think of a simplified version of the layers in Photoshop... We don't need the blending features, we only need to have opacity between the layers...

    Any advice would be great, thanks!
     
  44. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Hello inCreactive

    Thanks for the feedback I really appreciate that.

    Soon I'll release a new version with a proper blending which will support transparency on the black layer. so you will be able to place several layers, on top of each other. Each layer will have own render texture. and if you will want to draw on one of them you would need to change the active render texture in the paintcraft controller. I see just one complex thing here which you would need to solve is an undo/redo history by default probably this feature won't be supported.

    Another thing which you can try is to place several paintcraft controllers (several instances of paintcraft) on top of each others. in this case you won't have an issue with undo/redo as each layer will have own history. What you would need to code is just simply change destination in input controller (which listen input and forward events to proper paintcraft controller).
     
  45. madmoredie

    madmoredie

    Joined:
    Jan 18, 2013
    Posts:
    7

    I hope all this features and fix will be on your next PaintCraft release :)
     
  46. inCreactive

    inCreactive

    Joined:
    Dec 21, 2016
    Posts:
    9
    Hello again nicloay!

    Thanks for answering my question, it's really helpful!
    We are going to start working on other features of the app while you have the transparency feature working... we just need to know a couple of things first: will it be part of the Standard version or the Pro version of Paintcraft? Could you please give us an estimated time of arrival for the next update so that we can plan ahead?

    Thank you again for your amazing effort!
    Have a great day :D
     
  47. UDN_761ce67b-3ffc-456b-918a-7dadd9958927

    UDN_761ce67b-3ffc-456b-918a-7dadd9958927

    Joined:
    Apr 24, 2017
    Posts:
    5
    Hello, I set up the paintcraft game object in the quick start guide and I keep getting this error when I attempt to play. What's going wrong with this?

    Assertion failed: Screen position out of view frustum (screen pos -19.000000, 19.000000, 0.000000) (Camera rect 0 0 0 0)
    UnityEngine.Camera:ScreenToWorldPoint(Vector3)
    PaintCraft.Controllers.ScreenCameraController:GetWorldPosition(Vector2) (at Assets/ColoringBook/PaintCraft/Engine/Scripts/Controllers/ScreenCameraController.cs:153)
    PaintCraft.Controllers.ScreenCameraController:HandleMouseEvents() (at Assets/ColoringBook/PaintCraft/Engine/Scripts/Controllers/ScreenCameraController.cs:132)
    PaintCraft.Controllers.ScreenCameraController:Update() (at Assets/ColoringBook/PaintCraft/Engine/Scripts/Controllers/ScreenCameraController.cs:65)
     
  48. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    inCreactive
    Transparency is already live as part of both (base and pro) packages

    UDN_761ce67b-3ffc-456b-918a-7dadd9958927
    Could you export the scene where you have this problem (without dependencies and share with me, so I will able to debug it. Thanks.
     
  49. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Just tried your package. The issue was that you add paintcraft prefab instance to the UI Canvas. just move this instance to the top level as on the screenshot below.
    Screen Shot 2017-08-01 at 09.26.17.png

    p.s. could you remove attached file from your message please.

    Thanks.
     
  50. UDN_761ce67b-3ffc-456b-918a-7dadd9958927

    UDN_761ce67b-3ffc-456b-918a-7dadd9958927

    Joined:
    Apr 24, 2017
    Posts:
    5
    Unfortunately it still isn't working and is giving the exact same error as before.
     

    Attached Files: