This is Unity Paint, a small painting application made with Unity 3D.
Unitypaint is a painting script to make it easier for game developers to paint on a texture.
Features:
Line drawing
Vector drawing
Brush drawing
up to 32x anti-aliasing
Check out the example web-player to see what you can do with it.
Licence:
As of late 2011 the Unity Paint project may be used however you want, no restrictions. However a credit is always nice : D
Download:
Then it is just to download!
[download#6]
Faq:
API
Download link is here: http://arongranberg.com/wp-content/plugins/download-monitor/download.php?id=6
(Thanks to archive.org <3)
you can use the plugin like https://assetstore.unity.com/packages/tools/gui/upainter-162653 to do this
Did you get anything bro
I see you don’t monetize your page, don’t waste your traffic, you can earn additional bucks every month
because you’ve got hi quality content. If you want to know how to make extra money,
search for: Ercannou’s essential adsense alternative
Big thanks for the free project!!! It was very helpful.
It has been already 3 years as I implement some of the logic inside my Android 2D letter tracing game.
I want to share my contribution for the community:
OPTIMIZATION OF LARGE TEXTURES
Was problem until yesterday. It was very slow and glitchy for devices/screens with high resolution.
Because many maths were performed every frame for so many pixels.
After many hours working/testing on optimization of color manipulation connected with [SetPixels]
I found workaround:
– Set size of the texture to power of two, but use 1 level smaller than needed (in my case Screen.Height)
– Set transform.localScale = 2 on the GO where texture is implemented
– Do some tweaking in mouse/touch position detection
– Do some aligning/offset of the transform (where texture is) to match upper right corner of the texture to the Screen
RESULT – incredible speed improvement, finaly line is smooth when swiping is very fast!
Hey do you have a sample project to share the code on GitHub maybe? I’m new to unity and can’t get smooth drawing on touch screens, you could help me so much!
Greetings,
We the Abu Dhabi Capital Group invite you to partner with us and
benefit in our new Loan and Project funding program. We offer flexible
loans and funding for various projects bypassing the usual rigorous
procedures. This Funding program allows a client to enjoy low interest
payback for as low as 3 – 4% per annum for a period of 15-20 years. We
can approve a loan/funding for up to USD 800,000,000.00 or more
depending on the nature of business. We are currently funding for:
* Starting up a Franchise
* Business Acquisition
* Business Expansion
* Commercial Real Estate purchase
* Contract Execution
We are open to having a good business relationship with you. If you
think you have a solid background and idea of making good profit in
any venture, please do not hesitate to contact us for possible
business co-operation.
Best Regards,
Abdul Khalil Ali
Chief Investment Officer
Abu Dhabi United Group,
Abu Dhabi,
United Arab Emirates.
Can I haz youz monies?
I’m 4+ years late but sir, you forgot to leave your contact email or such. LMAO
This does look like a very useful tutorial project!
I am using Unity 5.3.4f1 and there are some problems:
This version of Unity is not tolerant of missing “var” declarations.
Loading old asset DB format no longer supported; upgrade process should have deleted DB from Library folder!
sun.flare and blue sky.mat are missing.
For many assets: ‘ProjectSettings/InputManager.asset’ is in assets but has no assettimestamp…
Thanks for creating this for the community :)!
Broos
Not work on Unity 5 …
It seems to work on mine (unity 5.1). Just had to update project and replace the obsoleted function Mesh.GetTriangleStrip with Mesh.GetTriangles wherever there was an error.
Can you give more details as to how you fixed this.
Copying and pasting this in didn’t work for me.
Sorted it thanks 🙂
Hi, the download link doesn’t seem to be working.
Fixed. Seems to have reset the download count, but whatever.
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
I can’t seem to find the download link for the package. Any ideas?
https://www.dropbox.com/s/en56h0jqc0ozo6d/UnityPaint.7z?dl=0
Excellent, thanks.
thnkas for the article, very thanks
Tahnk’s for your project to Openlicence!!!
It’s a greate post!
I love it~!!!
I have a question.
In order to use this project is the work that needs to change the format of the file first.
In the case of PNG image files are compressed and then change the status to RGB24 format should stick to baseTex figure is drawn.
How to draw a direct methodology in the PNG file?
Hello there,
I was interested in your project back in the days.
Now i am really interested in continuing it in my free time for some project that i would like to create using your source code. Though i found out that JS is not the best solution for it i spent 30 mins of life to convert it to C#.
I kept the same project structure as you did and it works the same way.
So for everyone that wants an implementation for C# here it is(You can find C# scripts inside Assets/Scripts/C#PORT folder ): https://www.dropbox.com/s/en56h0jqc0ozo6d/UnityPaint.7z?dl=0
Hi,
Thanks for this C# version of the scripts. When I open the project, it’s the JS files wich are in use, how could I use the C# scripts ?
I want to use the scripts to lake a tool to learn prehistory and rock art to childrens… Do you know how I could use the project to paint directly on a meshes, in 3D mode, without GUI, but just with the brush ?
Thanks a lot if you can help me…
Olivier / France
To be honest have not yet played that much with it as i am already having many things to handle in work. Speaking about the 3Dmeshes paint thingy.
If you check the example screen that the project has implemented i changed the js script with the c# one and it gets the job done with the same way the js does.
I will be searching for a solution to your problem when i have some more free time (yeah i have one more project that i want to develop for myself) and i’ll post back here. On the other hand you can contact me at douoht on facebook to talk about it.
Cheers mate greetings from Greece.
Hi,
.7z folder format is not extractable. Could you please upload as .zip /.rar package
Benraj you can use (which is free) to extract.
i want to test it but the rar file is damaged 🙁
I read a lot of interesting posts here. Probably you spend a lot of time writing, i know how to save
you a lot of time, there is an online tool that creates high quality, google friendly posts in seconds, just type in google – laranitas free content source
HI,
Is there any way i can use this project to draw via brush on cube or sphere on screen ,,, i;e if my camera is pointing to an object and i want to paint on top of that or ,,, if i can view that 3D object in the background and paint on a 2D plane…..
Hi,
I am trying to use your script to draw brush lines over a 3D model in model viewer, but if i draw something and stop the program and then restart the lines are still there , is there any way i can just clear the screen when i exit the program or stop the program, also or if there are more controls on the screen as soon i click on paint deactivate button of paint brush all the paint brush work on the screen goes away
Actually I am trying unity paint on IOS.But it not make color perfect.Any Suggestion??
Thanks in Adv
Some simple but very useful advice:
Currently texture.Apply(); is in every one of the draw functions (DrawLine() for example), texture.Apply() is extremely slow as mentioned in the unity documentation.
I tested drawing 1000 lines with your code, there was noticeable lag (0.5s or so). I moved texture.Apply(); so that it was outside the draw function so that it was only called once. No more noticeable lag. I suspect that this will speed up your draw bezier as well.
I also understand that you might be performing sampling to the texture for color blending, and the solution I mentioned above would mess that up (since all the lines would be drawn at once, later lines cant blend with previous lines). A possible solution would be to draw the pixels on to a 2d array save that array and sample from that. A bit more complicated, but the speed gains are tremendous.
Other than that, your code is wonderfully useful. Thank you very much for sharing!
Oh wait, PainLine() doesn’t have texture.Apply() in it. And thus distinguishing the difference between PaintLine and DrawLine. A bit more documentation to clarify this would be helpful.
I am working with Ipad painting.It is lagging somewhere.What can i do to increase the speed of coloring.???
I really appreciate for your effort to share this. Thank you 🙂
Hi, i try to make a android game where you can edit your picture. But the GUI Skin is much smaller at the android phone. How make that the GUI skin is the same size than the screen?
Its simple!!
You have to edit the painter script and comment the both GUIlayout area.It will solve you problem. 🙂
Hey hi,
I liked you paint tool so much and I am trying to add more features to it like different types of brush shape and different textures to draw but I am getting problem with it.
So if you have any updated version of this UnityPaint then please share or give any tip to implement the above.
Thanks 🙂
Hey hi,
I liked your painting tool and am trying to add new things in this but getting some problems.
So do u have any Updated version of this so that I can refer it.
Actually I am try to add different shapes of brushes and different textures to print on the background.
Please help.. 🙂
Thanks,
Hey I was want to use this in 3d space too, will it work? If not can you please explain how to change it to 3d or make a 3d version, it would be much appereciated thanks
i’m looking to apply this in 3d space, could you help me out?
I’ve been parsing UnityPaint and it’s awesome but I was wondering if you had a stripped down section of code that just places one texture on another with alpha-blending? And if you maybe had a version thatuses RenderTexture instead of SetPixels?
Hi, i have a problem with the first person controller in UnityPaint. I can place it, but there is this weird white box when i click play, and I cant move, only look around. Please tell me how to get rid of the white box and painting tool, or at least how to move. Thanks.
Hi,
I have not worked on this project for a long time. So I won’t be able to help you there. But I think you could get rid of the white box just by disabling the painting script.
I was wondering if there is a C# version of this project when I tried to port it over I ran into a few problems with the painter script.
Sorry. I have no C# version of it.
I took a quick hack at a C# version. There are a couple of // FIXME: comments and its really hacked up. But it compiles and you can use the brush to draw. Everything else is up to you =)
It’s on my pastebin: http://pastebin.com/pqjmRymM
To fix line 51 from painter, just put it: tool = (Tool)System.Enum.Parse(typeof(Tool), tool2.ToString());
hey, thanks for UnityPaint, it is really nice. 🙂
I have a question: I want to save my drawing out on disc, then with a button create a new texture2d to draw on etc.
Do you have any pointers about this?
Even if I take screenshots, the paint is not visible.
The code below is me making a new texture (from a button), which works but only exists in runtime.
function newTexture () {
//var tex = new Texture2D(128, 128);
//baseTex = Resources.LoadAssetAtPath(“Assets/background2.psd”, Texture2D);
baseTex = new Texture2D(1024,1024);
//renderer.material.SetTexture(“baseTex”, tex);
CaptureScreenScript.CaptureScreen();
}
The Texture2d class has a member named EncodeToPNG, it will return a byte array. Then you can use System.File to save it to disc. Search for “saving binary data C#” or something similar, that would give you a lot of good tutorials on that.
Hi, Could you please provide the link to download the package. I haven’t found any link for that.
Thanks,
Ben
i want just removing method any one can help me please
benraj sd this is link http://arongranberg.com/wp-content/uploads/unitypaint/UnityPaint.zip