Search Unity

UnityPaint - Painting with Unity

Discussion in 'Made With Unity' started by half_voxel, May 9, 2009.

  1. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Hi

    The last week I have been working on a painting application in Unity.
    And this is the result.
    In this version I'm using 32x anti-aliasing.
    So far I have only three tools : Line tool, Brush tool and the Eraser tool.
    I have also made a colorwheel instead of having those boring rgb sliders.

    Paint here: http://www.arongranberg.com/unity/unitypaint/

    What do you say about it?
     

    Attached Files:

  2. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    Very cool :)
     
  3. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Why did you make this?
     
  4. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Well, there is no outOfTheBox solution for painting on a texture in Unity (unless I have missed something), and in a lot of my projects I sometimes need some painting functionality and I always en up with half-good results, so I wanted to make a good one for once.
    Also I think others can have use for it, I think I'm going to release the source.
     
  5. Tempest

    Tempest

    Joined:
    Dec 10, 2008
    Posts:
    1,286
    Yes, there are two projects I'm interested in doing in which this is essential. I would love to see the source.
     
  6. VoxelBoy

    VoxelBoy

    Joined:
    Nov 7, 2008
    Posts:
    240
    I always love seeing different and creative uses of Unity. Good job mate :) Thumbs up!
     
  7. jcarpay

    jcarpay

    Joined:
    Aug 15, 2008
    Posts:
    561
    Very cool sturestone!
    Can you eloborate a bit how you did it?
     
  8. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Very interesting, and works surprisingly well and very fast/smooth. Well done!
     
  9. minevr

    minevr

    Joined:
    Mar 4, 2008
    Posts:
    1,018
    Fun. What are the principles of
     
  10. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Hi

    The painting works like this.
    i start to get pixels from the texture I want to paint on in only the rect the line or whatever I want to paint takes up, then I loop through the pixels and call the nearest point on line (Mathfx - wiki) to see if the pixel is in a certain distance from the optimal line, if it is I do the same thing with 4/8/16/32 samples inside the pixel and see if they are in that distance and take the average of it
    e.i if I have 4 samples in the pixel that looks like this: true true false true I take
    1+1+0+1/4 = 0.75 the pixel will be 75% white (if white was the color I should paint with). with the brush tool I do almost the same thing, the only difference is that I use Gussian Falloff instead of just true/false.

    In the source there is also code for painting vector lines but I removed that in the webplayer because it was so slow (like 1-4 seconds to paint one line).

    I will post the source today or tomorrow.
     
  11. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Hi, unfortunately I have no time to put up the source today :(
    So you will have to wait until tomorrow.

    /Aron
     
  12. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    chandruchiku likes this.
  13. Sbd

    Sbd

    Joined:
    Jun 16, 2008
    Posts:
    36
    Thanks for this! Interesting to see how you've made it.
     
  14. jcarpay

    jcarpay

    Joined:
    Aug 15, 2008
    Posts:
    561
    Very generous, thanks Aron!
     
  15. spiralgear

    spiralgear

    Joined:
    Dec 13, 2007
    Posts:
    528
    Very VERY cool.
     
  16. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    Cool stuff!
     
  17. Dexter

    Dexter

    Joined:
    Apr 15, 2009
    Posts:
    104
    Yep,

    It could be a new texture paint panel in Unity !
    For directly paint a texture of a mesh for example.
    Basic painting without leaving the World editor would be great :)
     
  18. amitchai

    amitchai

    Joined:
    Nov 8, 2010
    Posts:
    12
    Hello,
    Your script is ausome!
    Im trying to use parts of it on a little project of mine (hope this is ok),
    I got a question, is there a way to clear all the painting changes to the texture? reimport is only manual, and is there a script code for this?
    TY
    amit.
     
  19. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    By outOfTheBox , you mean no OS dependent?
    I saw many paint like in HTML5 ;) With a lot of features.
     
  20. b4cksp4ce

    b4cksp4ce

    Joined:
    Apr 13, 2011
    Posts:
    114
    Thanks, this colorPicker in UNITY PAINT is really usefull!
     
    Kjurek likes this.
  21. ganesh-pingale

    ganesh-pingale

    Joined:
    Dec 19, 2012
    Posts:
    11
    Hey Hi,
    Thanks for sharing but I have some issues,
    I want draw on plane not on OnGUI and when change camera to orthographic or build and run it is not drawing on mouse position.
    could you please help !!!
     
    Last edited: May 12, 2013
  22. LargerEagle

    LargerEagle

    Joined:
    Aug 15, 2012
    Posts:
    59
    Is it possible to paint on textures and not just colors?
     
  23. saddam751

    saddam751

    Joined:
    Nov 6, 2013
    Posts:
    41
    it's nice but i need it for iOS. when i build it for iOS it give lots of ERRORS ! :twisted:
     
  24. ben.aten

    ben.aten

    Joined:
    Jan 10, 2013
    Posts:
    8
    For static image size its working fine, when i draw image and image rect with screen.width and height, its not working properly. Could you please help me to sort this issue.

    Thanks,
    Ben
     
  25. malviyanpawan

    malviyanpawan

    Joined:
    Oct 24, 2013
    Posts:
    7
    I download your project but not able to used it. As I open the projects tons of error comes.
    Currently I'm using the unity 5.0. SccreenShot.png
     
  26. Rinoa_Heartilly

    Rinoa_Heartilly

    Joined:
    Jun 26, 2014
    Posts:
    85
    you should make a particle drawing tool like when I press the mouse some particles will play and stay on the canvas that would be awesome
     
  27. tulaib-pirzada

    tulaib-pirzada

    Joined:
    Sep 14, 2014
    Posts:
    1
    Hello I have a question related to this Unity paint app. Everything is super awesome. But what if I want to not to disturb the drawing while brushing like if I apply brush on the drawing it comes over it instead of removing it. I am attaching images to explain my point. Can anyone help?

    Thanks in advance
     

    Attached Files:

  28. iegghilba

    iegghilba

    Joined:
    Oct 20, 2017
    Posts:
    7
    Hello everybody,
    I'd like to develope a very similar app, i.e. painting a closed area by a brush, and I'm wondering if Unity should be the correct development tool.
    I downloaded the project, I updated some outdated functions in 2017.3 and now I don't have any compiling error.
    The problem is that the scene is almost empty: only a camera and the light.
    Is it correct? If I switch on play mode (Win10) I see nothing.
    Is there something missing?
    The automatic conversion had lost some objects?

    Thanks!