Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Paint In 3D - In Game & In Editor & Skinned Mesh Painting

Discussion in 'Assets and Asset Store' started by Darkcoder, Jul 10, 2018.

  1. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326


    Paint in 3D allows you to paint all the objects in your scene - both in game, and in the editor.

    Keep in mind this isn't a decal system, so your game won't lag based on how much you paint. Instead, your FPS will remain the same, even if you paint your objects one million times!

    Try the WebGL Demo, then buy it on the Asset Store.

    If you're still not convinced, then check out some key features below:

    Consistent Performance
    The reason why Paint in 3D runs so fast even if you paint a lot is because the paint is baked into the textures of your object. Your objects already have textures, so why not use them, right?
    The code also produces no garbage (0 gc alloc), so you don't have to worry about random lag spikes.

    Lightning Fast Painting
    Baking paint into textures may sound slow, but the painting code is done 100% on the GPU, which actually makes it incredibly fast. The painting code has also been heavily optimized to minimize state changes by batching paint operations together.

    Full C# Source Code
    Just like with all my assets, I provide full C# source code - nothing is hidden inside a .dll. The code is also well organized and commented, so you can easily make changes if you need to.

    Long Term Support
    Just like with all my assets, I provide long term support and won't just disappear after your purchase. I also provide regular free updates based on great feature requests from customers.

    Skinned Mesh Painting
    Paint in 3D allows you to paint animated objects with great performance. Check out the WebGL Demo and see how great the zombie paint looks.

    Seamless UV Painting
    If you have a complex mesh it's common to get seams when painting, even when using professional painting software. Paint in 3D solves this with the 'Seam Fixer' tool that comes included. Paint in 3D also makes painting between multiple objects seamless, even if they have different scales.

    Easy To Use
    Just like with all my assets, I try to keep the interface as simple as possible. Within minutes you can add painting features to your game, and tweak the simple yet powerful settings to your exact needs.

    Team Based Painting
    Paint in 3D comes with an easy to use team based painting feature. Where you can assign a specific color to a specific team, and count how many pixels each team has painted in your scene!

    Multi-Texture Painting
    If you have a complex material & shader that has multiple textures that work together, then no problem. Paint in 3D allows you to create brushes that paint multiple textures at the same time, and to give each brush unique settings.

    Full Material Support
    Paint in 3D not only supports painting all the materials & shaders that come with Unity, but all of your custom ones too! Using the intuitive inspector you can easily pick which materials and textures you want to paint.

    In Game & In Editor
    Paint in 3D was designed from the start to support painting in game as well as in the editor. This allows you to quickly tweak your textures in the editor, and later paint them in game, using the exact same features.

    Blending Modes
    You're not limited to painting just normal albedo textures. Paint in 3D has a range of blending modes and settings that allow you to paint any kind of texture you like. For example, additive blending for illumination textures, RGB isolated alpha blending for cutout textures, and much more.

    Made With Paint in 3D
    Released a game using Paint in 3D? Let me know so I can feature it here!

     
    Last edited: Oct 11, 2018
    AthrunVLokiz and Neviah like this.
  2. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    This looks fantastic!
    I have one question: Can it be made to work with pressure sensitivity? Like the iPad Pro with Apple Pencil or Surface Pro for instance?

    Many thanks in advance.
     
    Lars-Steenhoff likes this.
  3. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    Not yet, but this is a good idea. I'll include it in the next version!
     
    AthrunVLokiz and mrmdesign like this.
  4. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    Thank you! That would be amazing. Can symmetry be enabled in some way too? It would be great to be able to paint on both sides of a mesh at the same time. This would be amazing for editing a characters face and clothing at runtime.
     
  5. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    Bought it! Thanks for your speedy response!
     
  6. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    I love this so far! It has been the easiest 3d painting asset to implement compared to the three I tried today. I already have a very decent base to work with. I am going to look into adding Apple pencil support tonight somehow.

    It runs like butter on my iPad Pro! :)
     
  7. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    This is a very good idea and should be fairly easy to implement, I'll include it in the next version too, along with some improvements to the input system used on mobiles.


    Great! Speaking of performance, version 1.5.2 went live today, and this includes massive performance improvements, particularly when painting multiple times per frame. This version was submitted before your feature requests so it doesn't include them, but that will come soon.

    Thanks for the feature ideas by the way, they're very good. If you have more then I'd love to hear them to improve the product even more!
     
  8. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    Thank you for being so responsive! I will update to the new version now.
    Anything to simplify the runtime aspect of this asset would be fantastic. I would love to have the ability to easily erase, undo and change colour at runtime. Is there a way to have a smudge or blur brush too?
    I have also found that two finger panning still draws on the mesh. I am working on all of these things but I am pretty sure you would be able to do all of this way quicker than me. :)
    I am certainly not a natural coder. I am learning all of the time but I am definitely more of an art guy.
     
  9. noaim

    noaim

    Joined:
    Feb 27, 2015
    Posts:
    4
    Hey there!

    Thanks for this awesome tool!

    I have a small question and hopefully someone can help me with that. I am painting with P3D_Paintable on a Plane. Beforehand I want to check if the color on that position is already the same I wanna paint on. How can I get this data?

    Thanks!

    Cheers,
    Noaim
     
    mrmdesign likes this.
  10. CaptainBaxter

    CaptainBaxter

    Joined:
    Nov 19, 2016
    Posts:
    10
    Hi, I'm really interested in this asset and I have a few questions to see if it would be suitable for my needs. Does it work in VR? Is it possible to serialise the painted objects so that they can be loaded again at a later point? For example, presets for stickers in a car game.

    Cheers,
    Baxter
     
    mrmdesign likes this.
  11. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    I just submitted version 1.5.3, which includes pressure based opacity/radius/hardness settings. Mirroring will come in a future version because it requires an animated mesh to be in a bind pose, which I don't have prepared just yet. I don't think there's a sensible way to prevent painting while keeping the old control system, so I added a 'rotation' button to most demo scenes, which allows you to toggle between paint mode and rotate mode. I may change this again in the future, but for now it's a simple fix.

    You can already erase by using the 'Subtractive' blending mode, and setting the RGB to 0, so only the A gets subtracted. This is what the bullet hole demo scene does. If you want the erase to basically undo what was painted in that area then I'll need to add some new blending modes, but these should be easy to add.

    I will look into adding blur and smudge, these are much more difficult to do, especially smudge :D

    Thanks for the great ideas as always, I've added them all to my to-do list!


    Assuming you're using an older version (before 1.5.0), then the P3D_ReadToImage component (Read Color demo scene) shows you how to read a pixel at a specific point and output that color to a UI.Image.color. To do what you describe you can make a new component, copy + paste most of P3D_ReadToImage, but instead of writing the color to an image, you call P3D_Painter.PaintAt(point) if the read color satisfies your requirements.


    Yes, it works great in VR. I didn't mention this in the product description yet because there is no VR integration (e.g. VRTK demo scene). But if you know how to connect a VR controller to a painting GameObject (e.g. spray can coming in version 1.5.3), then it will work.

    Yes, all paintable textures use the P3dPaintableTexture component, which has the 'Save Name' setting. Setting this to something causes the texture to automatically save/load. Keep in mind this won't work correctly with multiple prefabs in the same scene, because they will all share the same name. For this scenario you need to write a script to decide which prefabs get which save name, but the code to handle this is as simple as yourPaintableTexture.Save(uniqueName) and yourPaintableTexture.Load(uniqueName). I'll include a demo of this in the next version!
     
    mrmdesign likes this.
  12. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    Amazing! Thank you.
    I got the pressure working in a rather hacky way. :)

    It will do for now until Unity update the version on the store.
     
  13. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    Erase seems to be working but does seem to leave a bit of ghosting behind which is visible when painting over the area again. I also really need to get runtime image saving / export working so that the user can save their painted image for later use.
    I got something working with easy save but the png image would not open in photoshop so I must have done something wrong. Ideally I would love to have a gallery of saved files that the user can nip back in to.

    Thank you for creating an asset which is making the runtime painting aspect possible and thanks again for listening. :)
     
  14. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    Another quick question: (sorry)
    I am using this script to save an image to the device gallery:


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class savetogallery : MonoBehaviour {
    6.  
    7. public Texture2D myTexture;
    8.  
    9.     // Use this for initialization
    10.     public void saveitman () {
    11.    
    12.     NativeGallery.SaveImageToGallery( myTexture, "GalleryTest", "My img {0}.png" );
    13.        
    14.     }
    15.    
    16. }
    (This seems to be working a lot easier than the other assets I have tried)
    https://forum.unity.com/threads/native-gallery-for-android-ios-open-source.519619/

    How do I access the 'painted' texture to save it to the device gallery?

    Screen Shot 2018-07-20 at 06.18.31.png
     
  15. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    I was simply dragging an image into the myTexture slot to make sure it is working but I want to reference the aafacepainter texture from the image so I can save that to the gallery.

    Many, many, many thanks in advance.
     
  16. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    The current alpha blending approach doesn't work well with 0 alpha, and will cause this bleeding/ghosting when painting in a different color. I know how to fix this, but that will have to wait for next week.


    To get a Texture2D snapshot of a paintable texture, you first need to store a reference to the P3dPaintableTexture component you want to use, then you can call these two methods: var outputTexture2D = P3dHelper.GetReadableTexture(yourPaintableTexture.GetCurrent(false));

    You can then save that texture. Keep in mind you should destroy that texture when you're finished with it.
     
    mrmdesign likes this.
  17. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    Thank you! That’s amazing and so fast. :)
     
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    Version 1.5.3 Out Now!
    - Added ‘Asteroid Holes’ demo scene.
    - Added ‘Shield Impacts’ demo scene.
    - Added ‘Spray paint’ demo scene.
    - Added finger pressure support to P3dPaintDecal.
    - Added finger pressure support to P3dPaintSphere.
    - Added finger pressure support to P3dPaintSphereTriplanar.
    - Improved mobile input support in demo scenes.
     
    mrmdesign likes this.
  19. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    Excellent! Thank you. :)
     
    Darkcoder likes this.
  20. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    I had another thought this evening; Physics or particle based brushes! Is there a way to make particles leave a paint trail on the mesh texture? It could create some cool, random paint effects where no stroke is ever the same. :)
     
  21. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    The latest version has the 'Spray Paint' demo scene, which does exactly this ;)

    Just add the P3dOnParticleCollision + P3dPaint___ components to your ParticleSystem. For physics collisions the P3dOnCollision + P3dPaint___ components can be used.
     
    mrmdesign likes this.
  22. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    Wow! It’s like you read my mind! :)
     
    Darkcoder likes this.
  23. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    Here's a sneak peak of the next version:



    Blur paint mode! It works just like the other paint styles, so you can make it blur under the mouse, on collision, on particle hit, etc.
     
    mrmdesign and AthrunVLokiz like this.
  24. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    Wow! I love this!!!! Thank you. :)
     
    Darkcoder likes this.
  25. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    Will the alpha blending / ghosting be fixed in the new version too?
     
  26. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    Yes, the upcoming version has a new AlphaBlendAdvanced blending mode which fixes this. It's a little slower than the original AlphaBlend, so I decided to keep them both in case users don't need alpha modification and want maximum performance.
     
  27. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    Fantastic! Thank you for all of your hard work on this. I am sure this will go above and beyond what this asset is was originally designed for but. Is there any way to smooth the curves on really fast circles?

    I can live with out it or try to get it working on my own in some way so please don’t worry about it. This asset is worth 100 times what I paid for it and you have been so amazing so far.

    Apparently Apple created a method called coalesced touches that ‘fills in’ the jaggies in the curvature. It may be a native app only thing but here it is in use in a tutorial anyway: https://www.raywenderlich.com/121834/apple-pencil-tutorial
     
  28. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    It's well within the scope of what the asset should do, so I'll add it to the next-next version.

    I've already got it working for fast circles, but getting it to work with small ones too is a little more complex it seems.
     
    mrmdesign likes this.
  29. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    The best customer service EVER! :) Thank you! :)
     
    Darkcoder likes this.
  30. gfaraj

    gfaraj

    Joined:
    Jul 11, 2016
    Posts:
    32
    Hi @Darkcoder this asset looks really awesome! I was having some issues and I sent you an email, was just wondering if you had received it. Thanks!

    edit: Just saw your email, my mail client was being stupid. Thanks for the quick reply!
     
    Last edited: Jul 30, 2018
    Darkcoder likes this.
  31. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    Version 1.5.4 Out Now!
    - Added ‘Auto Save Load’ demo scene.
    - Added ‘Chalk Board’ demo scene.
    - Added ‘Strength’ setting to Sphere Triplanar paint mode.
    - Added ‘Sphere Blur’ paint mode.
    - Added ‘Alpha Blend Advanced’ blending mode for transparent texture painting.
    - Added P3dPaintSphereBlur component.
     
    mrmdesign likes this.
  32. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    237
    I sometimes wish this forum had a Facebook style Love button! Thank you @Darkcoder! You rock!!!
     
  33. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    Thanks, and thank you for so many great suggestions! The next version will include even more nice things :)
     
    mrmdesign likes this.
  34. CaptainBaxter

    CaptainBaxter

    Joined:
    Nov 19, 2016
    Posts:
    10
    Wow! Rapid response Darkcoder. Thank you so much. Keep up the fantastic work! I will definitely be trying this in the next project.
     
    mrmdesign and Darkcoder like this.
  35. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    Hey everyone,

    Version 1.5.5 Out Now!
    - Added P3dPaintDebug component.
    - Added P3dDragRaycastSmooth component.
    - Added ‘UV Data Requirements’ documentation.
    - Added ‘Mesh Analysis’ window to debug UV data.
    - Fixed ‘Auto Save Load’ demo scene painting.


    Unity accepted the update sooner than I expected and I've actually made improvements to the P3dDragRaycastSmooth which you can expect to see soon, as well as decal preview painting on mobile devices.
     
    mrmdesign likes this.
  36. KillerOfSteam7

    KillerOfSteam7

    Joined:
    Jul 27, 2016
    Posts:
    121
    Hi, I'm going to buy Paint In 3D soon (due to the great reviews on the asset store) but before I do so I have some questions...

    1 - Can this tool create a texture and paint on it or it does require that the model have a texture pre-made for it.

    2 - Does it require any runtime scripts? because I'm not planning on using the runtime features.

    3 - Does it use/require custom shaders? because I use some custom shaders.

    4 - Does it have a texture size limit? because I might use it to paint 128x128 textures or even smaller.

    5 - Does it require any additional setup other than importing it? (no problem in this case)

    6 - How many folders/files come included with the package and are they organized? (I ask this for project organization purposes)

    Thanks in advance!
     
  37. KillerOfSteam7

    KillerOfSteam7

    Joined:
    Jul 27, 2016
    Posts:
    121
    @Darkcoder Hey sir, I have been waiting for over 3 days for a reply before I buy this asset.
     
  38. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    Hey, I just got back from a 2 week holiday and was too busy to answer most requests.

    1 - It can create a texture if your model does't have one. Your model requires UV data though. If your model doesn't then there is the 'UV Data Requirements' documentation, which shows you steps to make UV data using Unity's light mapping features.

    2 - Nope, you can paint entirely in the editor if you don't need any runtime stuff.

    3 - You can paint on any object using any material & shader, as long as those shaders use the vertex UV data that comes with the mesh. i.e. a triplanar mapping shader will not be paintable, but most will.

    4 - The only limit is your GPU, which may be up to 16384x16384, 128x128 or smaller is no issue.

    5 - You need to pick your object, the material slot you want to paint, the texture in that material you want to paint, and the brush settings you want, but other than these obvious things there's no special setup required I can think of.

    6 - Everything is inside /Assets/Paint in 3D, you can see the folder structure in the asset store package preview.
     
    mrmdesign and KillerOfSteam7 like this.
  39. MagicK47

    MagicK47

    Joined:
    Sep 5, 2017
    Posts:
    8
    我们制作了一个角色模型,但是在uv边缘,有一条线从未被画过,How do you make this line disappear?How to color the model,full
     

    Attached Files:

  40. datbq

    datbq

    Joined:
    Nov 6, 2017
    Posts:
    5
    @Darkcoder,
    Can your tool work on mobile VR? I need to paint color on terrain's texture by collision. It's like a ball move on a terrain and paint a color where the ball moved. Can your tool do that?
     
    Last edited: Aug 21, 2018
  41. Edward13th

    Edward13th

    Joined:
    Apr 20, 2015
    Posts:
    1
    Hello, I use the P3dPaintSphereTriplanar.cs script to draw some effects on the plane. but now the problem is i want to get percentage of how mush i cover the surface.Is there a way to get percentage of how much i drawn?
     
  42. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    I answered you via e-mail.


    No, terrains are special in Unity. Paint in 3D can only paint normal Mesh Filter + MeshRenderer or SkinnedMeshRenderer objects.


    I answered you via e-mail.
     
  43. datbq

    datbq

    Joined:
    Nov 6, 2017
    Posts:
    5
    I'm sorry for a unclear question. My terrain has a Mesh. It's not a built-in Terrain of Unity. Can your tool solve my problem in a VR mobile application?
     
  44. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    There's no issue with VR. If your terrain renders with a MeshFilter + MeshRenderer then it will be compatible. Just keep in mind that the painting is applied to the texture, so if your terrain is very big then you will need a very big texture to give it enough detail. It also needs non-tiling UV data, but this can be generated in the editor.
     
    mrmdesign likes this.
  45. datbq

    datbq

    Joined:
    Nov 6, 2017
    Posts:
    5
    Thank you for your reply.
     
  46. SheepVsGravity

    SheepVsGravity

    Joined:
    Feb 13, 2012
    Posts:
    1
    I am interested in purchasing your painting code, but have 2 questions:

    1) Could I use it to create transparent "holes" in a Texture/Texture2D Unity object? So I could see through it to objects behind it?

    2) Would this works on moblie platforms? iOS and Android?

    Thanks!
     
  47. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    1 - Yes, all you need to do is change the Blend Mode of your painting component to Subtractive, and set the color to black (i.e. RGBA 0, 0, 0, 255).

    2 - Yes, it works on all platforms.
     
    mrmdesign likes this.
  48. MagicK47

    MagicK47

    Joined:
    Sep 5, 2017
    Posts:
    8
    Hi, We hope to use the SVGA format in our project,will the plugin support it? Because the texture zooms in a lot when using png, is there any other solution if we can`t use svga?Thank you very much!
     
  49. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,326
    There's no way to paint SVG data directly, but if your SVG is being rendered using a mesh via MeshFilter+MeshRenderer, then it might be possible. All it needs is non-tiling UV data, and a material that has a texture. Just keep in mind the painting itself still uses pixels, so when zooming in the resolution will decrease. You could improve this by using a cutout shader though.
     
  50. beard-or-die

    beard-or-die

    Joined:
    Jul 12, 2017
    Posts:
    4
    I am planning on buying this, but have a few questions. I've bought lots of decal solutions and am disappointed with them or they don't support Unity 2018.2+ or require a custom shader. I am interested in being able to place (in editor and via runtime) decals from PNGs with a metallic and normal map onto meshes (conforming to that mesh's shape). An example would be a sticker that has a logo on it, where the sticker material is a matte look and the logo appears like a silver reflective metal, and the sticker can be placed on a sphere or a custom mesh like a skateboard ramp, etc. Versatility in mesh shape and material/metallic properties are important. Also, emission from a painted decal would be an optional but nice feature. Is this asset appropriate for this kind of usage?