Search Unity

Paint In 3D ✍️ Paint In Editor✏️ Paint In 2D

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

  1. wowo95

    wowo95

    Joined:
    Jun 23, 2017
    Posts:
    1
    Hello,

    First of all I'd like to thank you for this great asset! The problem I'm struggling with is that decals can't wrap around some cylindrical objects. However it looks fine when I do it with a normal brush, it wraps around whole object. Attached pictures shows the problem. Is there any way to force decals behave like brush from the second picture? I've already tried to change different settings like "depth", "normal front" etc but it didn't help much.

    decal.png

    brush.png
    Thanks!
     
  2. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    396
    Hi @Darkcoder

    I'm using your asset as an editor tool. I improved it a bit to fit my needs. I added those, maybe you can do too.

    - Lock All (You had "Unlock All" but no option to lock all, so it was annoying to lock one by one)


    - Lock All for same texture slot (This was super important because it was really pain to scroll other panels and lock same slot)



    So i'm painting R8 textures for design purposes. But there is an issue and i thought you could aware of this and help. When i paint with decals (or sphere etc same issue) the whole texture fades out. And eventually after a few clicks it turns all faded with all details lost (Full red in this case because its R8 texture).






    Do you know why?

    Thanks.

    Edit: Ok its because sRGB, textures needs to be Linear(which is active color space).
     
    Last edited: Apr 19, 2019
    NinjaVR likes this.
  3. tmaiss

    tmaiss

    Joined:
    Dec 12, 2018
    Posts:
    1
    Hello there,

    we just purchased the Paint in 3D asset and it seems we´re the only ones running into problems. In the "Paint in 3D window" we end up on the Textures Tab with an error message - "Failed to lock texture. This may be because the texture is not readable ... (...) This may be because texture format is not readable. If so try to changing the format." Well, our texture is set to readable in the inspector and we tried to change texture format to every format available, but it´s still not working. This is very annoying and time consuming. Any idea on what we´re doing wrong?

    Many thanks in advance.
     
  4. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Sorry for the late replies everyone, I missed the notification.

    There's technically no smudge feature, only blur, but in practice it looks the same. The "Chalk Board" demonstrates this, with the P3dPaintSphereBlur component.


    Yes, this is exactly how you can do it and still use the built in painting components.


    There's currently no way to do this, because it's actually quite complicated if you want to keep important features of P3D working (e.g. seamless painting, consistent texel size). In your example you can move the normal brush to the edge of your UV islands and it will look really bad.


    These are some good ideas!


    Yes, there are scenarios where Linear and sRGB mixing can cause issues. I'm not sure if it can be fixed in every case without a performance penalty.


    Answered you via email already :)
     
  5. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Hello, I am interested in this asset, and have a few inquiries about Paint in 3D.

    Say the game includes feature to paint a helicopter together with friend,
    How easy it is to synchronize the painting through networking?
    How will Undo work in multiplayer case if it is enabled?
    How is every paint information saved? Is there a history for every paint made into the model?

    And say the helicopter painted together is to be used in a multiplayer game, how easy is the process to save and load the helicopter, and send the painted information to other clients?

    Thank you!
     
  6. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    1 - If the models you're painting aren't moving then it's easy enough, it's just a case of making a new component that implements the IHitHandler interface, which is what all the painting (e.g. decal) components use, and sending this information over the network. When you receive this information, you can then manually call the IHitHandler.HandleHit method on all other painting components.

    2 - If you want to ensure synchronization then you would probably have to implement some kind of lockstep painting system with the aforementioned hit handler, and you can use the built in StoreState/Undo methods at fixed points in this chain to ensure everyone sees the same thing.

    3 - It's stored on the texture itself, so there is no history. You can use StoreState to keep snapshots though, but if you want a history of each paint stroke then you will have to store the hit handler results mentioned earlier.
     
    Gekigengar likes this.
  7. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Went ahead and purchased Paint in 3D, I will try implement it in a multiplayer scene myself for now.

    I will be back when I came across some trouble and need some help, thank you for the awesome tool!
     
    Darkcoder likes this.
  8. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Hey everyone,

    Paint in 3D Version 1.6.7 is out now!

    This introduces connected line painting, which turns this:



    into this:



    With just one click, and with almost no performance penalty.

    If you've ever tried painting really thin lines, or surfaces that are far away or at a steep angle to the camera, you may have noticed it often leads to your paint lines breaking up into individual dots. You could always reduce this issue by reducing the "Drag Step" setting, but this can slow down the performance of your game.

    To fix this, you can now enable the "Connect Hits" setting in your P3dDragRaycast, P3dDragRaycastSmooth, P3dBetweenRaycast, or P3dProximity components. Your painting 'dots' will then automatically be joined together into lines.

    Keep in mind that this setting only works with the P3dPaintSphere and P3dPaintSphereTriplanar components. P3dPaintDecal can't make use of this feature, because I don't see how you can calculate what the final pixel should look like when stretched along a line like this.

    This setting also allows you to increase the "Drag Step" setting while maintaining straight lines, which allows you to greatly increase painting performance, especially on mobile devices.

    Enjoy!
     
    Gekigengar and AthrunVLokiz like this.
  9. reynaria

    reynaria

    Joined:
    Mar 18, 2013
    Posts:
    2
    Hello @Darkcoder

    I purchased P3D last week and I'm very impressed with the functionality and performance.

    I just have one issue though in undo/redo feature. Basically I'm trying to undo my drawing of DragRaycastSmooth but the state was just never registered. FYI undo/redo is working just fine with decals. I have enabled "Store States" as well as set the "State Limit" to 10.

    Is there anything else I need to do to undo/redo DragRaycastSmooth?

    Thanks!
     

    Attached Files:

  10. CarlitosZ

    CarlitosZ

    Joined:
    Jun 7, 2013
    Posts:
    3
    Hi, I would like to know if you have support for Lean Touch and if you could draw with several fingers at once using Lean Touch and Paint3D together.
    I'm working on a 2D painting app that should support multi-touch.
    The plugin supports undo and redo, right?
    Thank you !
    Greetings.
     
  11. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Thanks for pointing this out, I forgot to implement the StoreState code in the DragRaycastSmooth code.

    Paint in 3D includes a stripped down version of Lean Touch, so it works with multi finger painting already. You can modify the P3dDragRaycast code to replace P3dInputManager with LeanTouch and P3dInputManager.Finger with LeanFinger to fully integrate it though.
     
  12. reynaria

    reynaria

    Joined:
    Mar 18, 2013
    Posts:
    2
    Do you mind letting me know what code to add in the DragRaycastSmooth? Hoping to get undo/redo working next week for a demo. Thanks again for this great tool and your prompt response.
     
  13. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    I sent you a private message with an updated build.
     
  14. songpwc

    songpwc

    Joined:
    Nov 6, 2018
    Posts:
    14
    hi. i have a issue. in my game play , i will change texture and material at runtime. i find once i change texture and material at runtime then make a decal, the unity editor crash.
     
  15. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Can you describe the exact steps required to produce this error? Including lines of code used to change texture, material, and decal? Also, does your editor/player logs show any error message?
     
  16. lordzeon

    lordzeon

    Joined:
    Jun 1, 2018
    Posts:
    44
    Hi, im having this problem with PaintSphereTriplanar, The material is using the standar 0 offset and 1 tiling, if i apply it to a plane it looks correctly like this:
    Drawer-Background-PNG.png
    but when i paint over the same plane, using the same texture, the painting is offset 0.5, not from the mouse pointer because it paints in the correct spot in the plane, but the texture it paints has a offset:
    paint-example.jpg

    tried to solve it with detailAlbedo using 0.5 offset in the UV but then, only a quarter of the texture is drawn (lower left) and the paint spot in the plane has the same offset, so it doesn´t paint under the mouse:
    paint-detail-albedo-example.jpg

    this is a bug or there is some way to solve it?
     
  17. lordzeon

    lordzeon

    Joined:
    Jun 1, 2018
    Posts:
    44
    no solution for this? im stuck :(

    EDIT: changing the paintable object position does change the texture offset, so i think texture sphere uses world space coordinates instead of object ones, it makes sense but it will be cool to have a extra option of using object coordinates and scale for texture origin for cases like this when i need to match original texture position with the painted one.
     
    Last edited: Jun 5, 2019
  18. Moana

    Moana

    Joined:
    Apr 13, 2015
    Posts:
    2
    Will this work with Photon?
     
  19. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Sorry for the late replies. I'll finish answering these via the emails you sent!


    It can work with Photon, but you must connect the two together, which requires some code. I know some users have done it, and I may well make a demo scene or something for it. However, doing third party integrations for my assets has a low priority, I have plans to add new features and improve the current features first.
     
  20. Darkon_Who

    Darkon_Who

    Joined:
    Jul 22, 2017
    Posts:
    14
    Hey @Darkcoder, does this support LWRP / HDRP yet?

    Also my use case is drawing wound decals on enemy characters when they are shot in realtime, this should work nicely for that right? It will be on mobile.
     
  21. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    @Darkcoder So I've found an oversight. If you have a model that starts with a texture that is pixel art for 3D (think Minecraft or similar) then the filter mode on the texture has probably been set to point filter in the import settings. However, when paint in 3D starts the render texture is always set to the default bilinear filter mode blurring the pixels.

    Can you add the option that when the render texture it created it inherits the original texture's filtering mode. This would enable us to paint pixel art without undesired color interpolation.
     
  22. ROYALFOKER

    ROYALFOKER

    Joined:
    Jun 13, 2019
    Posts:
    1
    Hi, everything works nice in the editor, but i cant paint when the application is exported to windows...
     
  23. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    As far as I've tested, all features of Paint in 3D work using both LWRP and HDRP. However, most of the demo scenes use shaders/materials that only work with the standard pipeline. You can manually upgrade some of the standard shader materials, but I still need to make new cross compatible versions of the remaining ones, which will be done soon.


    Good find, I'll see if I can fix it for the next version!

    Which demo scenes break? Which exact version of Unity?
     
  24. Euricius

    Euricius

    Joined:
    Sep 3, 2017
    Posts:
    25
    Hi, Darkcoder! Thanks for cool asset!

    Is there a way to calculate which part (in percents) of paintable texture repainted?
    I have tried P3dTeam, but it calculates amount of colored pixels. For percent value I also need total amount of pixels which can be painted.

    Thank you!
     
  25. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    This depends how you define what a painted pixel is.

    The P3dPixelCounter component for example counts the R, G, B, and A channels separately. So if your original texture is white and you paint it red, then the amount of painted pixels would be R - G (or R - B), or if it starts clear and you paint something with alpha/additive blending, then you would count the A.

    If you have more complex requirements then you may have to change the P3dPixelCounter code, though it is quite simple.
     
    Euricius likes this.
  26. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Hey, just picked up this asset to hopefully use it to paint some flowmaps on my water, and see the updates in real-time on the animated shader, in editor.

    However, I'm having a bit of a problem in my first attempt. As you can see in this gif, every time I paint previous strokes are being faded out https://imgur.com/a/61308ML

    All I've done is:
    - Created a quad, assigned it a custom material (that's just a texture sample)
    - Opened the Paint in 3d window, locked the quad in the objects tab
    - Textures tab, there's no texture in the material so I create a new one, click the "paint" button.
    - Start painting with the "sphere" technique"

    What am I doing wrong?
    Edit: Read through the thread. This is a gamna vs linear color space issue. Is there a switch to make it work in linear color space?
     
    Last edited: Jul 16, 2019
  27. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Indeed, sRGB and Linear conflicts will give results like this. In the Paint in 3D window Texture tab, when creating a texture you should see the 'Linear' checkbox, does this match your project settings? If so, it should work. Perhaps I made a mistake somewhere between settings that and the painting though.
     
  28. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    @Darkcoder Yes, when I create a texture format is ARGB32 and linear is checked (both by default). My project uses linear color space so these settings do match.

    I'm using the latest version from the asset store, and Unity 2019.2.0b3
     
    Last edited: Jul 16, 2019
  29. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Alright, I modified the code a bit and in my testing painting now works fine in your scenario. I sent you a private message with a new build, let me know if you encounter any issues.
     
    DMeville likes this.
  30. JakartaIlI

    JakartaIlI

    Joined:
    Feb 6, 2015
    Posts:
    30
    Hello.
    I have question before purchase.
    I like that is possible to draw texture on character in editor.
    But does it contain mirror function? To draw on two sides of one mesh(face, body)
     
    Last edited: Jul 25, 2019
  31. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Not in the current version, but I've just finished implementing this, and it will appear in version 1.6.9!
     
  32. ruben-casarara

    ruben-casarara

    Joined:
    Jul 26, 2017
    Posts:
    1
    Hi fellow PaintIn3D users,

    Has anyone tried to use it interfacing with BOLT? Did you manage to make it work and do you have any pointers?
     
  33. JakartaIlI

    JakartaIlI

    Joined:
    Feb 6, 2015
    Posts:
    30
    I bought an asset as soon as I found out about updating with a mirror. But I could not use it correctly, I put a component of the mirror on the object, but nothing happened when I began to paint the texture. How to use a mirror.
     
  34. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    You can see the "09 Mirror" demo scene to see how it can be used. You can see the mirror plane in the Scene view when you select the GaneObject with P3dMirror.
     
  35. JakartaIlI

    JakartaIlI

    Joined:
    Feb 6, 2015
    Posts:
    30
    Another important issue. I need a mirror function in the editor. Is it possible to use a mirror in the editor?
    I need it for simple texturing of characters.
    (Scenes 09 Mirror and 07 Decals mixed up in places)
     
  36. TrueProger

    TrueProger

    Joined:
    May 26, 2017
    Posts:
    40
    Hello! I am interested in this asset and there are a number of questions before buying!
    Does web and android support work there completely for drawing? The decals that I drew on the machine how to save and load them, is it difficult to implement in code? Is it possible to have several texture sets texture texture 1, texture 2 and so on?
    Is it possible, after covering the decals, to paint, for example, with dirt, and then when you drive through the water, it was erased, but did not touch the decals?
    Another moment with decals, you can rotate and scale them, is it possible to erase decals with an eraser?
     
  37. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Not yet, but I guess it would make sense to add. I'll see if I can add it to the next version!


    - Yes, WebGL and Android (as well as all other platforms) are supported. It may not work on super old devices, but it should work on all devices that support at least Shader Model 2 (basically everything).

    - If you want to manually do this then you just need to call the Save or Load methods on the P3dPaintableTexture component, super easy.

    - Yes, and the Group system can be used to pick between the textures (works just like layers).

    - This is possible if you use 2 texture layers, where the decals get painted below, and the dirt goes on top. Doing this with just one texture is possible, but the setup is much more complicated since you would have to 'erase' the texture using a copy of the decal texture.

    - Yes, you can erase, blur, etc decals, since they are applied to the texture and can be modified just like anything else.
     
  38. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    @Darkcoder I feel like this should be simple but maybe I am overlooking something but is there a way to target only a specific color i.e when painting on a red texture with green polka dots only paint over the green dots ignoring the red?

    Also I don't know how useful this is to most of your users but I have found that I have both dynamically imported and/or procedurally generated meshes in my project where the UVs may or may not have seams (user generated content) I'm porting the seam fixer to a static class for runtime use, not hard to do but I found it strange that when everything else works in both editor and runtime that the seam fixer was confined to the editor. Might be worth moving the general functions to a static class that can be used both at runtime and by the current scriptable object system.

    Might be useful for users that use a mesh combiner or have procedural meshes that need seams fixed behind a loading screen or something.
     
  39. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    There's no way to do this currently unless you use some elaborate setup with multiple texture layers, or a custom shader.

    To implement this properly you would have to make a custom blending mode that checks the source texture before applying paint. This would be quite a difficult addition though, as I didn't design the blend mode system with extensibility in mind. Also, such a system would probably often lead to graphics artifacts at the edge of the mask where the color blends to the surrounding colors. What kind of scenario do you need this kind of painting for?

    Good point about the seam fixer, I'll improve it soon!
     
  40. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    My scenario is that I have user generated content that goes through a mesh combiner, the meshes get color coded to help separate UVs in a texture atlas however not all textures in the atlas may be intended to be painted on. There is padding between color zones in the atlas so blending artifacts wont be to much of a problem in my case but I do need some way to check the color zones to ensure that some textures in the single atlas texture of the mesh don't get painted; pretty much using the color zones as a mask.

    So think of something like the UMA character system where clothing meshes get combined with the character body into one skinned mesh, perhaps a user wants to apply different painted textures to helmets than flesh to you don't paint blood on something metal or dents on something fleshy but still want the performance of texture atlases. In this case a mask that defines what can be painted and with what would be useful. I'm not using UMA at the moment but that is probably a more practical use case for most users.

    I'll take a look at the blend mode system but my experience in writing shaders is limited.
     
  41. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Interesting, in this scenario it would be much simpler for me to implement some kind of texture mask system into P3dPaintableTexture that all blending modes can check for. You can then build separate texture masks using the alpha channel, and since the texture wouldn't be used with rendering there would be no rendering performance penalty, and since you atlas it yourself you could use a low resolution texture. This would be much simpler to implement than some kind of color checking system. I'll add it to the to-do list!
     
  42. JakartaIlI

    JakartaIlI

    Joined:
    Feb 6, 2015
    Posts:
    30
    Hey. Have you tried working on this? Should I expect this feature in the next update? I wanted to use characters for unit texting quickly, without the mirror function, it will be in vain.
     
  43. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    1,081
    Hello, it seems that in version 1.90b scene 09 Mirror and scene 07 Decals are swapped.
    One question: how to mirror the hit point AND the decal?
     
  44. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Yes, and I'll try and submit the next version tomorrow.


    Thanks, the demo scenes have been fixed.

    If you want to mirror both you could just UV map your mesh such that both sides are mirrored. This allows you to use half the texture space, and thus improve performance and reduce memory usage.

    There are scenarios where you would want to toggle this 'full' mirroring mode though, so I'll see if I can add this as well.
     
  45. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    1,081
    I made this by adding the mirror parameter in the interface:

    Code (CSharp):
    1.  
    2. public interface IHitHandler
    3. {
    4.    void HandleHit(Vector3 worldPosition, Vector3 worldNormal, bool preview, float pressure, bool mirror);
    5. }
    6.  
    and adding mirror parameter in all implementations. In P3dMirror class I changed the HandleHit function adding a "true" parameter in InvokeHit call:

    Code (CSharp):
    1.  
    2. public void HandleHit(Vector3 worldPositionA, Vector3 worldNormal, bool preview, float pressure, bool mirror)
    3. {
    4.    ....
    5.    InvokeHit(worldPositionA, worldPositionB - worldPositionA, preview, pressure, true);
    6.    ....
    7. }
    8.  
    9. private void InvokeHit(Vector3 worldPosition, Vector3 worldNormal, bool preview, float pressure, bool mirror)
    10. {
    11.    ...
    12. }
    13.  
    With these simple changes, the decal is mirrored too, not only the point.
     
  46. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    That's one way to do it. Mirroring is a decal specific setting though, so I'll try and come up with something more generic.
     
  47. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    1,081
    Cool.
    What about a paint operation based undo/redo or save system?
    We talked about this via email several month ago.
     
  48. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    I plan to make a demo scene for this. First I want to improve the code and project organisation a bit, as adding all these new features has made it a bit messy.
     
  49. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    1,081
    Cool. When do you expect to release it?
     
  50. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    No idea, as I have to update some of my other assets first. The mirroring stuff should be ready today though.