Search Unity

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,745
    Hey everyone,

    Later today many of my assets will be given away in the 2019 Christmas Giveaway hosted by Devdog.

    You can sign up for free HERE to be in for a chance to win!

    Good luck!
     
  2. vizgl

    vizgl

    Joined:
    Nov 4, 2014
    Posts:
    26
    Great asset. What about NormalMap blend mode?
     
  3. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    Very soon, I've planned how it's going to work :)

    First, there are some changes I want to make to the editor painting, and internal code.
     
  4. karonte

    karonte

    Joined:
    Jun 2, 2013
    Posts:
    23
    hi all... I would like to buy the asset for a small kid game. I have to "fake paint" in Virtual Reality and show a picture that is in the canvas ( so kids think that they are painting a real picture). basically kids paint some "mask" to reveal the picture. do you think i can do it with the asset?
     
  5. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    Yes, this can be done by setting the texture of your canvas to be of the final painted picture. You can then make it invisible by changing the P3dPaintableTexture component's Color setting to 1,1,1,0 (transparent white). You can then 'reveal' the picture by painting using a brush that uses the Additive blending mode, with a color of 0,0,0,1 (only paints opacity). Something similar is demonstrated in the "Reveal Original" demo scene :)
     
    karonte likes this.
  6. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    179
    Hello. Does anybody know if this works in LWRP? (in editor)
     
  7. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    All features should work in LWRP/URP and HDRP. The only issues may be if you mix and match Linear and Gamma textures.

    I'm currently working on a big update to the in-editor painting painting features, so I'll be sure to test all of this again. I will be posting some updates to this very soon :)
     
  8. Blue-Wolf

    Blue-Wolf

    Joined:
    May 27, 2014
    Posts:
    16
    Hello,

    I bought this add-on yesterday primarily for the decal ability without fully understanding the implementation. My hope was that I would be able to add lots of variety to my models via decals to make the world look more unique, which this can do, however it seems that this can only be done by duplicating additional material/texture for an object? I was hoping that I wouldn't need to create new materials for this process as it could quickly get out of hand. Am I correct in my understanding of how this works? Thanks in advance!
     
  9. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    Yes, this is a texture painting asset. If every paintable object shared the same material then painting one would paint them all. If all these objects were UV mapped to separate areas and shared the same material then you could still use one material & texture set though. You could also keep the base material untouched and instead paint on a secondary layer that is unique to each object. The main advantage of this approach is that you can paint your objects as many times as you like with no performance degradation, and the main disadvantage is that it requires more texture memory. If you use the secondary layer approach then you can use a lower resolution paint texture though, and then still make it look good with a detail map.
     
  10. Blue-Wolf

    Blue-Wolf

    Joined:
    May 27, 2014
    Posts:
    16
    Thanks for the prompt reply. I'm not quite sure what you mean by secondary layer? A secondary map?
     
  11. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    Either seconday map (e.g. custom multi-layer shader), or a second transparent material on the same renderer.

    For example: if your base material is very high detail then making it paintable will be expensive due to a high texture resolution, and reducing the resolution of that paintable texture will make it look bad, so you could instead paint on top of it with a lower resolution texture and apply some kind of detail map to make it still look high resolution.
     
  12. Darkcoder

    Darkcoder

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

    I think the current in-editor painting implementation is too difficult to use, and it lacks some important features. So...


    I decided to rewrite it from scratch, and this is a screenshot of what it looks like so far!

    The main goal of this new version is to be as easy to use as possible, while still having a full feature set. As you can see, this now features a layering system, as well as a material system. This material system is really easy to set up and use, and it supports full PBR texturing. You just pick your material, and paint it to the object. Setting up your object is now just one click, and your scene objects are no longer touched (non destructive).

    I have plans to add other cool features missing from the original, like: painting lines, clicking to paint triangles, automatic edge painting (e.g. scratched edges), and much more. The first release will be simple though, and will just replace the existing in-editor painting tool.

    Stay tuned!
     
  13. adrienmaroisysocorp

    adrienmaroisysocorp

    Joined:
    Nov 18, 2019
    Posts:
    2
    Hello,

    I have buy this assets, and I am trying to apply decal over cars model (like bullets holes), but when I draw them on a side of the model they also appear on the other side of the model (because the texture of the mesh seems to only contain one side of the hood for example on which both side of the mesh get mapped). So do you have any advice, on how I can fix this issue ?

    Thanks in advance.
     
  14. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    To fix this you must either:

    a) Change your UV map so both sides use different areas of the UV.
    b) Split your mesh into two (left & right), then both sides will have their own textures that won't interfere.
     
  15. adrienmaroisysocorp

    adrienmaroisysocorp

    Joined:
    Nov 18, 2019
    Posts:
    2
    Thanks for the answer, I will try this.
     
  16. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,364
    Some feedback on the new version screenshot.

    The red and green colors take a lot of attention.

    I would keep all the buttons a shade of gray, and any highlights blue consistent with the unity interface.
     
  17. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    Thanks for the feedback, I agree that the coloring is too loud. I've already improved the brush highlight to be easier on the eyes. I'll post another update hopefully tomorrow :)
     
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    Here's an update to the new in-editor painting feature:


    As you can see, the colors are easier on the eyes now, and I also moved the delete/remove buttons to the corner to clean it up.
     
    Lars-Steenhoff likes this.
  19. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,364
    Yes looks much cleaner!
     
    Darkcoder likes this.
  20. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,364
    And I don't remember if you already added pressure support for wacom tablets?

    Would you be willing to see if that can be added, for example the alpha of the brush could be controlled by pressure
     
  21. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    The mouse pressure is used, but I don't have any tablets to test on, so I have no idea if it works with one.
     
  22. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    197
    How goes the fixes on normal map decals across seams?

    You can also make a custom shader to support 2 UV maps, one with the base texture and one for painting.

    That what i plan to do to paint some effects on my hair model.
     
  23. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    This will most likely be in the next version, which is almost complete. However, I'm about to go on holiday, so it will have to wait until next year. This next version will contain many cool features to make the wait worth it :)
     
    sacb0y and Lars-Steenhoff like this.
  24. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,364
    I have a Mac and a Wacom tablet but the pressure does not seem to be used
     
  25. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    197
    Also how do I clear/reset a surface? A bit confused on that...

    EDIT: I've tried many things and followed the example but for some reason the paint is not coming off the texture.

    EDIT 2: actually i got it working by reapplying the paintable texture component, but now i can reset the paints to "_MainTex" but not my specgloss map.

    It seems to only do one and not the other.
     
    Last edited: Dec 20, 2019
  26. toyhunter

    toyhunter

    Joined:
    Mar 5, 2018
    Posts:
    37
    @Darkcoder I'm going to buy this for my game with a weapon working like Splatoon 2, please confirm if your asset can do something like in Splatoon that in game spraying color painting on any mesh inside the game, and this can be undone in runtime too, thanks
     
    Last edited: Dec 24, 2019
  27. talharing

    talharing

    Joined:
    Oct 27, 2013
    Posts:
    9
    Hi!

    What's the best way to make this asset work with probuilder meshes?

    Thx,
     
  28. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    Hey everyone, I'm back from my holiday. Things are still going to be busy for the next week though!

    That's unfortunate! In the future I'll have to implement something that overrides the pressure with the actual pressure. For now though, I need to finish off the new core painting features.


    Can you upload a video or screenshots showing your P3d components and settings used?


    Yes, you will have to combine several demo scenes and specially optimize your meshes and use some custom shaders to achieve something that works exactly like Splatoon though. The painting/erasing itself can be done quite easy though.


    Make your ProBuilder mesh, then generate lightmap UV data for it, and paint using the lightmap UVs. You can see the "Paint Ball Throwing" demo scene and click 'Analyze Mesh' on the Map to see what the UV1/2 (lightmap) should look like.
     
  29. toyhunter

    toyhunter

    Joined:
    Mar 5, 2018
    Posts:
    37
    @Darkcoder

    Thanks for your reply, would you mind sharing more about "specially optimize your meshes"? Thanks
     
  30. dannyoakley

    dannyoakley

    Joined:
    Jun 18, 2016
    Posts:
    8
    @Darkcoder
    I have a feature in a VR project where the user can place a decal on an object using the tracked controller. I would like to not rotate the decal, but it seams as if the rotation of the decal is based on my headset camera. If I bank my head, the decal rotates. Is there a way to lock the rotation of the decal independent of the headset camera? The striped rectangle in the images below is the decal.
    headset_straight.png headset_Tilted.png
     
    Last edited: Jan 2, 2020
  31. francoiscoiscois

    francoiscoiscois

    Joined:
    Oct 23, 2019
    Posts:
    28
    Hi everyone, best wishes for this new year !

    I am starting planing for my next project, which will use paintin3D.
    I am wondering if you worked on thoses features already (drag and drop decals and move rotate scale), as I will need it for this project ?

    Thank you.
     
  32. tatakaeotaking9000

    tatakaeotaking9000

    Joined:
    Jan 3, 2017
    Posts:
    3
    Hello. I was following this tutorial on your site, but stuck at Step 3.
    upload_2020-1-7_14-2-26.png
    For some reason i cant choose UV1 channel in Paintable Texture script. What should i do then? upload_2020-1-7_14-1-35.png
     
  33. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    Splatoon is designed for consoles, and it allows you to paint a fairly large map hundreds of times a second, so you must optimize your meshes well. Specifically, you must make sure the paintable UV map area has no wasted space, like it doesn't need any UV underneath the map or between solid objects. You must also keep in mind that painting performance depends on the resolution of the painted texture, which you should reduce to the lowest possible size you can get away with. To cut this down even more you should slice your map up into logical 'areas', so you're always manipulating a minimum amount of pixels.

    One of the key optimizations Splatoon does is that the painting is very low resolution, and it only looks sharp and high resolution through the use of cut-out style blending (using one team color per texture channel), and augmenting this with well designed detail maps. For example, if you attempt to paint the splat shapes using a high detail splat shape on your original map texture resolution then your game will quickly slow to a crawl, because you'll be painting millions of pixels per hit to get the splat to look good.


    The decal paint angle is based on the Orientation setting in most components. For example, P3dHitBetween.Orientation. If this angle is changing based on the headset bank, then it sounds like this is set to CameraUp? The default is WorldUp though, which should work as you desire.


    Not yet, this may have to wait until the next-next version. The next version is almost ready for release, and it already includes a ton of really nice features. I'll add this as soon as possible!


    I meant UV2. In the next version I've renamed the UV channels to hopefully reduce this confusion!
     
    francoiscoiscois and toyhunter like this.
  34. Darkcoder

    Darkcoder

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

    I've made some really good progress with the new in-editor painting feature. Here's a sneak peak of what it looks like now:


    I ditched the earlier idea of using multiple windows, because it quickly made the interface look cluttered, and harder to use.

    The in-game painting features now include live decals, which can be moved around and have their order changed, etc.

    I think I've added enough new features now, so I'll try and submit this version today :)
     
    johaswe and francoiscoiscois like this.
  35. argonauta

    argonauta

    Joined:
    Nov 24, 2014
    Posts:
    1
    is there a way to paint an object white, actual white? seems like any blending mode just removes the color and shows the original material
     
  36. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    If you paint white with Alpha Blend then that will paint actual white. However, if you use a material with lighting then 'white' areas may appear different.

    If you want to force the painted area to draw as fully white and ignore all lighting, then you must either paint the illumination map white too, or paint to a secondary unlit (possibly cutout) material later that sits on top of your lit base material.
     
    argonauta likes this.
  37. Darkcoder

    Darkcoder

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

    Version 1.7.8 of Paint in 3D is out now!

    This includes the completely new in-editor painting features. These features will be expanded upon soon :)

    This version also includes many changes to the in-game painting features to make them simpler to use and a bit more flexible. For example, the painting groups mask feature was replaced by just picking one group, as I don't think the mask was too useful. I also made it so you can use more or less unlimited groups, and give them custom names rather than just using a 0..31 index. I also added in live decal (movable) decals, and made improvements to many of the demo scenes.

    Any and all feedback is welcome. Enjoy!
     
  38. songjiekun

    songjiekun

    Joined:
    Jan 21, 2017
    Posts:
    29
    hi. i have an issue.
    one of my skinned mesh has two materials ,one material for head and one material for body . and i use my own code to call P3dPaintDecal's HandleHitPoint function to add decal to skinned mesh in runtime. the issue is , decal can correctly put on head mesh, but on body mesh, it become extremely big and not in correct position. i have put two Texture Paintable and two Material Cloner scripts on gameobject with skinned mesh. they has correct slot number 0,1 and index number 0,1. why is that?
     

    Attached Files:

    Last edited: Jan 14, 2020
  39. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    It's hard to see what's happening in your screenshots. Does this extremely big painting issue happen when you paint the body first, or only when you paint the head? Does the body contain any overlapping UV areas?

    Perhaps a video of you painting with a simpler decal texture would make it easier to see what's happening.
     
  40. songjiekun

    songjiekun

    Joined:
    Jan 21, 2017
    Posts:
    29
    1.one issue. i am using gradually fade script. however, i found this script will make texture black. and i think this maybe a mipmap issue,when it close to screen the texture become correct.
    IMG_0861.JPG IMG_0862.JPG IMG_0863.JPG

    the sword on the left side has no fade script so it always correct. sword on the right side when not close to camera, the texture will become black or part of it becomes black. looks like mipmap issue.

    2.other then that. i am wondering will this fade script cost a lot of performance? will this script replace texture every few second even if all the decal have faded out?
     
  41. songjiekun

    songjiekun

    Joined:
    Jan 21, 2017
    Posts:
    29
    the big painting only when i paint on body like the second image shows, if i paint on head everything is fine like the first image show. i don't believe body contain overlapping uv, because this is a character mesh. how can i check if the uv areas are overlapping?

    i shoot 3 more screenshot.
    IMG_0867.JPG IMG_0868.JPG IMG_0869.JPG

    the first image you can see the decal is very small on head
    in the second image you can see the same decal is so big on body. these two materials are one the same skinned renderer.
    the third image you can see. the decal on face is corret. but on body is too big (deep red part below neck)
     
    Last edited: Jan 14, 2020
  42. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    I sent you a private message with a fix for the gradually fading mip map texture, thanks for pointing it out!

    [Edit] regarding performance, P3dGraduallyFade will constantly activate, even if there is nothing left to fade. This is because this component has no knowledge of the texture data that is being painted, so it's not possible to optimize like this. You can increase the Threshold setting to make it activate less frequently though.

    The easiest way to test for overlapping UV is to open your mesh in a 3D modelling program and check the UV. I should add this feature to the P3dMeshAnalysis tool to make it easier though. It's probably not the cause of your issue though, so you don't have to worry about it yet.

    I will test painting a skinned mesh with two materials later today and see if I encounter any issues.
     
    Last edited: Jan 14, 2020
  43. songjiekun

    songjiekun

    Joined:
    Jan 21, 2017
    Posts:
    29
    thanks for the quick fixed.
    I set gradual fade script as the example in impact shield example. I find some of my object will become white and whiter gradually. If I change blend mode to additive it will become black and blacker. So I wonder what configuration I should give to my object. My object is a sword, the blood on the sword should fade out gradually . Should I set “texture”?
    is that possible to add a separate “transparent material” to object and put decal on this transparent texture. And only fade out this transparent texture? Please point me to some direction . Thanks.
     
  44. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    You probably want to use the "Replace Original" blending mode, which will return it to its original state.

    Regarding multiple skinned materials, I tried it and noticed no issues:



    As you can see, both sides of the skinned and animating cylinder have different materials, and I can paint across both without seams or any change in size.
     
  45. songjiekun

    songjiekun

    Joined:
    Jan 21, 2017
    Posts:
    29
    thanks. i tried it.
    set "Replace Original" in gradual fade script will make the texture darker and darker and finally become black. is there something wrong with this setting?
     
  46. songjiekun

    songjiekun

    Joined:
    Jan 21, 2017
    Posts:
    29
    for multiply materials. maybe there is some uniqueness about my 3d model and mesh. can i send you my model. then you can try it?
     
  47. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    I sent you a private message with a new version that should fix this!

    Sure, you can send it via private message or to my email (in documentation).
     
  48. songjiekun

    songjiekun

    Joined:
    Jan 21, 2017
    Posts:
    29
    thanks. private message has been sent.
     
  49. E-Cone

    E-Cone

    Joined:
    Jul 4, 2013
    Posts:
    43
    Hello!
    Is there a way to share a RenderTexture between several P3DPaintableTextures?
    I have a level of 8 large objects with all uvs tightly packed into one atlas. Each object has its own material, but shares the same decal texture. If I use Paint in 3D as intended - I'll end up with 8 RenderTextures coloring different pieces of a single atlas. Is there a hacky way to provide a single RenderTexture for all my 8 objects? :)

    If I modify Activate() method of P3DPaintableTexture and provide my own RenderTexture from other P3DPaintableTexture, Unity just crashes when I try to paint.
     
    Last edited: Jan 18, 2020
  50. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,745
    You can put the P3dPaintable+P3dMaterialCloner+P3dPaintableTexture components on one of your GameObjects, and put the P3dModel component on your 7 others. Then set all 7 P3dModel.Paintable settings to your first one. Then drag + drop the 7 other GameObjects into the P3dPaintable.OtherRenderers list in the first, and it should work. I should really make a demo scene showing how to do this!
     
unityunity