Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

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

  1. Tahan

    Tahan

    Joined:
    Nov 10, 2015
    Posts:
    12
    @Darkcoder No, only replace painting, but I think it but I think it's because my Paintable texture has color with opacity and that was the problem with the replace mode.
     
  2. jantunes

    jantunes

    Joined:
    Jan 27, 2018
    Posts:
    2
    First of all, thank you for the amazing asset.
    Is there any way to make the paint disappear after a certain given time?
     
  3. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    The P3dGraduallyFade component (Texture Fading demo scene) can do this :)
     
  4. Darkcoder

    Darkcoder

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

    Version 1.8.2 of Paint in 3D is now out!
    • Improved P3dHitScreen.Spacing behaviour.
    • Improved connected P3dPaintSphere painting when using scaling.
    • Improved connected P3dPaintDecal painting when using scaling.
    • Added P3dChannelCounter.Interval setting.
    • Added P3dColorCounter.Interval setting.
    • Added Atlas Painting demo scene.
    • P3dHitParticles.Pressure setting renamed to PressureMultiplier.
    • P3dHitParticles.PressureMinDistance setting renamed to PressureMin.
    • P3dHitParticles.PressureMaxDistance setting renamed to PressureMax.
    • P3dHitParticles.PressureMode setting added.
    • Fixed P3dPaintDecal when using Texture modifiers.
    • Fixed P3dPaintableTexture.State = LocalCommandCopy undo and redo.
    • Fixed P3dModel painting with different submesh and material indices.
    Enjoy :)
     
  5. Darkcoder

    Darkcoder

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


    The VR game Banana for Scale made using Paint in 3D was recently released to Steam.



    Congratulations to the Hypothermic Games team on the release, it looks fantastic!
     
  6. Leeong

    Leeong

    Joined:
    Sep 10, 2018
    Posts:
    11
    Hi,@Darkcoder ,
    绘画过程中可以替换不同材质吗?
     
  7. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Yes, you just need to call the P3dPaintableTexture component's UpdateMaterial() method after you change material :)
     
  8. Leeong

    Leeong

    Joined:
    Sep 10, 2018
    Posts:
    11
    Hello, I have other questions. The attachment was relatively large, so it was sent to your mailbox (email address: carlos.wilkes@gmail.com), please check it.
     
  9. Tahan

    Tahan

    Joined:
    Nov 10, 2015
    Posts:
    12
    @Darkcoder, Hi! Is it possible to block painting on a zone using an additional object? (If it is groups, how I can tune it to paint with different stencils)
     
  10. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    I don't see any email from you? You can try sending me a private message (conversation) on this forum.


    This feature will hopefully be in the next version of Paint in 3D. You can kind of already do this with layers, or a mesh that blocks the paint hits, but it wouldn't be as good as your video.
     
  11. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    107
    Hey Carlos, I think I've got an issue that looks similar to the one Tahan had except I'm able to replicate with one of your example scenes.



    So that was using the 02. Seam Fixer example. The only changes I made were HitScreen.spacing from 5 to 3, Paint Sphere radius to 0.025 and hardness to 10.

    This is using the latest version of Paint in 3D and using an iPhone X on IOS 12.4.1. Unity version 2019.2.10f1. Issue doesn't happen on Android and doesn't appear while in editor on Mac or Windows.
     
  12. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    I'm currently trying to track this issue down, but it's tricky since this issue only happens on some triangles of the same mesh. I suspect this is some kind of iOS build setting to do with mesh or vertex data precision or compression, but I'm not sure. If you can try changing any setting that seems like it would be related to meshes and shaders then that would be awesome!
     
  13. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    107
    Yeah I can test stuff. Can you clarify what you mean by that, though?
     
  14. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Sure, like in the player settings I see Vertex Compression and Optimize Mesh Data, try disabling all of that.

    I don't have iOS build support installed right now (maybe tomorrow), so I can't give iOS specific settings, but you can try disabling metal, and any other settings that sound like they might mess with mesh or UV settings.
     
  15. francoiscoiscois

    francoiscoiscois

    Joined:
    Oct 23, 2019
    Posts:
    38
    Hi Carlos,

    I made a build with a basic setup in paint in 3D, and the result is quite laggy on my ipad2 (exept paintin3D everything run smooth)
    The model is extremly low poly and use a single 2048x2048 texture (I want to be able to print the texture on a A4 sheet so it should be even larger)
    What should be the best optimised settings for a good framerate?

    I plan to allow the user to paint with a opacity of 100% with a really basic brush, and apply stamps (lots of them), on a really low poly model with a large texture.
    It is for mobile and I would love to support as many device as possible.

    One last question :
    In the doc you say that each undo/redo state is stored as a full texture state.
    Is it true also for LocalCommandCopy? Is there an optimised way to have undo redo when using large textures on mobile device?

    Thank you,
     

    Attached Files:

  16. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    107
    I couldn't see how to disable metal, but did try disabling Vertex Compression and Optimize Mesh Data which didn't make a difference. Also tried enabling some of the disabled options under Optimization which also seemed to make no difference.
     
  17. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    The best way to optimize painting is to use a lower resolution texture. If 2048x2048 is necessary for your project then you should split your mesh up into smaller parts, and modify the UV map so each mesh fills the remaining space. This means each mesh can now use a lower resolution texture while still maintaining the same texel size. Unless your paint brush overlaps all the meshes at the same time, you will now be painting less pixels. You can also disable the KeepUnpaintable setting.

    LocalCommandCopy doesn't store the texture state, only the paint commands, so it's very memory efficient. I should update that are of the documentation!


    Thanks for testing it out, shame this didn't fix it. I'll let you know if I think of any other settings that may fix it.
     
  18. francoiscoiscois

    francoiscoiscois

    Joined:
    Oct 23, 2019
    Posts:
    38
    Thank you for your answer, I will test it with multiple smaller textures as you recommend.

    For the undo/redo, this is great.
    Unfortunately I added 2 buttons with undo all and redo all component following the steps described on the documentation, and they react strangely.
    The Undo button erase all steps with 1 click, then go through different states in no particular order. The redo button doesn't do anything.

    I think I have the latest version, but was not able to find the version number of paintIn3D in my project.
     
  19. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Alright, I have the iOS settings open. You can disable metal by unchecking Player/OtherSettings/Rendering/AutoGraphicsAPI, and then adding one of the OpenGLES entries above.

    You can also try disabling Multithreaded Rendering.

    If it still doesn't work then I can try some more things within the code to change the way the textures are painted.


    I see this too, I must have broken local commands in the recent updates where I made changes to the command implementation. I'll try and fix this now and send you a new build!
     
    francoiscoiscois likes this.
  20. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    107
    Unfortunately, didn't work. Tried disabling those options separately and also together. Also tried both OpenGLES 3 and 2.
     
  21. Foxaphantsum

    Foxaphantsum

    Joined:
    Jul 5, 2013
    Posts:
    139
    I'm curiousness how does this handle the fast painting? Is it a shader that overlays multiple textures and then after bakes it out to a new texture?

    I know combining stuff per pixel in arrays on the cpu is expensive so I've tried methods using compute shaders to merge textures together and or bake out normal maps from them.

    However I haven't seem to figure out how you could paint without using the array method other then some sorta double buffer renderTexture. Where you make a change, and it flips between renderTextures to save texture changes.


    Edit*

    I've been trying to find a tool to make painting normal maps easier for spine2d characters.

    I think this tool may help.
     
    Last edited: Mar 10, 2020
  22. erpatton

    erpatton

    Joined:
    Oct 6, 2014
    Posts:
    55
    Is there a way to save/load what's been painted at runtime? I'm making a game with a level editor, and I'm wanting to use this to let users paint textures onto objects (like the ground), save the scene, and then be able to load them up again with the painted textures. Is that possible?
     
  23. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Paint in 3D uses double buffering, because it makes the blending code simple. However, it's possible to use a single buffer for most of the painting modes. The GPU is specially designed to process lots of pixels which is why this is fast.


    Yes, each paintable object has one (or more) P3dPaintableTexture components, and you can call the .Save(name) and .Load(name) methods at any time to savewith the specified name. This automatic system uses PlayerPrefs though. If you want to use normal files then you can call .GetPngData(), and .LoadFromData(data) and handle the saving yourself.
     
    Foxaphantsum likes this.
  24. StudioV

    StudioV

    Joined:
    Aug 29, 2017
    Posts:
    3
    Hello! I am using your asset in Unity 2019.3.0f1 URP but I have encountered a problem. I am not able to paint on any mesh. It seems that the normals are inverted when I load it up in the window. I am also not able to load in my skinned mesh. It does not show up on the left side. Is it a problem that it has multiple materials?
    https://gyazo.com/35f4f2db8440c558472edfc65c581693
     
  25. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    107
    Hey Carlos, do you have an eta on this? Or a work around?
     
  26. Foxaphantsum

    Foxaphantsum

    Joined:
    Jul 5, 2013
    Posts:
    139
    Thanks for the response, I've been testing building my own tool for painting normal maps.

    I think that while this tool may be a bit too much for my specific needs, it'd at least serve as a solid foundation of reference for building my own.

    I could possible extend it too to work for my specific use case.

    I'll be buying this soon.

    I'm curious, how much source code is there and how complex would it be to use this as a system for a custom editor tool.

    (With a custom preview window and everything)

    I simply wanna be able to paint normal maps on spine characters. However due to my requirement of modularity I wanna make it so that the tool can export the painted texture atlas into each part rather then just the entire atlas.

    Currently with spine you have to make each part of ur sprite seperately. That way spine can use the sprites for rigging and animation purposes to properly setup the regions.

    To actually use the sprites tho you need to pack it into an atlas (otherwise you need a lot of materials for each part which isnt good)

    If I wanted to paint normals I can just start painting on top of the existing uv atlas...however if I were to ever change and re export the base sprites id lose my normal data being usable due to the uvs being modified during the repack.

    So my solution was to make a tool that lets u paint into the uvs and save out source normals that are seperated from the atlas

    Then when I repack, id just use the source albedo sprites as a pack reference, and pack all the normals as the same layout.

    This way it's much more modular.
     
  27. NiLeHaiHUT

    NiLeHaiHUT

    Joined:
    Oct 14, 2013
    Posts:
    4
    Hi friend, I updated newest version but it seem GraduallyFade getting some parameter null, so it can run normally
     
  28. benjamin666

    benjamin666

    Joined:
    Jan 11, 2019
    Posts:
    23
    Hello,After installing the 1.8.2 version, Unity 2019.3.1f1 uses URP with some errors, which makes Material unusable
    upload_2020-3-17_19-31-32.png
     

    Attached Files:

  29. munimraza007

    munimraza007

    Joined:
    Sep 23, 2019
    Posts:
    3
    Hello, This tool works like a charm! Really impressed by the effort. Although I am stuck at a point and would be great to have some help on stencil painting. I know this must be implemented and maybe I am missing something but what I want to do is to paint easter egg using a stencil on top. So certain parts of the mesh should be painted which is revealed through the stencil.
     

    Attached Files:

  30. SiMULOiD

    SiMULOiD

    Joined:
    Dec 23, 2013
    Posts:
    126
    Hi Carlos,
    Does this work with URP?
     
  31. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Oops, missed the notification. Sorry for the late replies!

    You must follow the Paint in 3D documentation guidelines to enable SRP support, then the paint brushes will show properly. There seems to be some issue with the actual paint scene rendering though, and with adding skinned objects, I'll look into it tomorrow.


    I'm not sure what the issue is, so it's hard to say. My Mac Mini is now too old to run the latest OSX & XCode so it's difficult to test too. I'd rather not throw another $800+ to Apple, so when I have more time I'll find some place where I can borrow a mac and generate the files required to run Unity Cloud Build or something.


    The core painting code of Paint in 3D is completely separate from the in-editor and in-game painting features, so it should be easy enough to implement into a custom tool. However, I didn't exactly design the asset with this manual painting as a priority, so there are no tutorials or extensive comments for how to do this. You can look into how the in-game painting features are implemented to get a good idea of what methods to call though.

    For something so specific it might be easier to just write the painting code yourself, especially if you're dealing with atlases and other things Paint in 3D wasn't exactly designed for.


    This bug has been fixed, and a new version will be out soon. I can send you an early build if you'd like?


    Did you follow the steps in the documentation to switch to SRP mode?


    This has been implemented and will be in the next version (out in maybe a week). If you'd like an early version I can send it?

    Yes, URP and HDRP are fully supported for in-game painting. There are still some issues with in-editor painting, but they're being worked on.
     
  32. SiMULOiD

    SiMULOiD

    Joined:
    Dec 23, 2013
    Posts:
    126


    THANKS!!!
     
  33. Foxaphantsum

    Foxaphantsum

    Joined:
    Jul 5, 2013
    Posts:
    139
    @Darkcoder Heya thanks! Yea ultimately I'm likely gonna need to write my own solution. I did however buy your asset anyway to get an idea on how I may accomplish some things (I figured it'd save me some time, I hope you don't mind)

    I also wanted to make sure I supported you for your hard work.
     
    Darkcoder likes this.
  34. munimraza007

    munimraza007

    Joined:
    Sep 23, 2019
    Posts:
    3
  35. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    munimraza007 likes this.
  36. Darkcoder

    Darkcoder

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

    Paint in 3D Version 1.8.3 is now out!
    • Added P3dHitScreen.Fill setting.
    • Added P3dHitScreen.FillSpacing setting.
    • Added P3dMask component.
    • Added Path Filling demo scene.
    • Added Mask demo scene.
    • Added Mask Stretch demo scene.
    • Removed P3dPaintSphere.RotateTo setting.
    • Added P3dHitScreen.RotateTo setting.
    • Added Normal Blend blending mode.
    • Added Normal Replace blending mode.
    • Improved P3dConnectablePoints.ConnectHits inspector order.
    • Fixed P3dHitScreen stopping when reaching HitLimit.
    • Fixed P3dPaintableTexture.State = LocalCommandCopy bug.
    • Fixed P3dGraduallyFade bug.
    • Fixed in-editor painting of skinned meshes.
    Besides bug fixes, the long requested masking feature is now here. To use it, simply add the P3dMask component to your scene, set the texture, size, and any paint will be masked by it. Keep it mind only one mask can be used at a time, which will be the closest one to the paint point/area. I plan to improve the scene gizmo for this component to make it easier to visualize, but for now it should give you all something to work with :)

    Let me know if you encounter any issues, enjoy :)
     
  37. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    107
    Am I the only one with the issue, though? I'm just trying to figure out what I can do now besides downgrading.
     
  38. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    No, I think I made some change that impacts all iOS builds. I should be able to test iOS builds again in a few days though, so I'll try and fix it.
     
  39. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    107
    Great! Thank you
     
  40. HamzaBr197

    HamzaBr197

    Joined:
    Jul 9, 2019
    Posts:
    4
    heeyyy ,
    I need help plz I want the to paint using another object who project a raycast how can I achive this
    it seems the only way that you can paint is using mouse postion raycast
    I searched the documentation but i found nothing can help :(
     
  41. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    This can be done using the P3dHitBetween + P3dPaintSphere/Decal components. See the "Between Painting" demo scene for an example :)
     
  42. HamzaBr197

    HamzaBr197

    Joined:
    Jul 9, 2019
    Posts:
    4
    thank you ,
    that's helpful , I solved the problem :D
     
    Darkcoder likes this.
  43. HamzaBr197

    HamzaBr197

    Joined:
    Jul 9, 2019
    Posts:
    4
    is it possible to select which material to paint on from script ?
     
  44. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Yes, you can set the P3dPaintableTexture component's Slot setting, then call the UpdateMaterial method.
     
  45. Darkcoder

    Darkcoder

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

    Version 1,8.4 of Paint in 3D is now out!
    Added P3dPaintSphere.TileTransition setting.
    Added P3dPaintDecal.TileTransition setting.
    Added Normal Painting demo scene.

    Pretty minor update, mostly so I could also update the store images. New demo scenes coming soon :)
     
  46. Realgar

    Realgar

    Joined:
    Sep 30, 2012
    Posts:
    52
    Hi Carlos, I'm a beginner in Unity, and I bought and I use you great asset to make a prehistoric tool for student (I work in France, near Lascaux cave :) I just integrated a Color Picker, and I want to set the color variable of my P3DPaintDecal (or a P3DPaintSphere) but I can't with my script. I have a protection error. I need also to access the radius variable, to control it with the scroll button of the mouse. Could you help me ? It would be bice. I just begn to developp with Unity... Thanks !!!
    Here is my test of script I had attached to P3DPaintDecal.

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    #if UNITY_EDITOR
    using UnityEditor;
    #endif
    namespace PaintIn3D
    {
    public class FCP_Couleur : MonoBehaviour
    {
    public FlexibleColorPicker fcp;

    public P3dPaintDecal p3dpaintdec;
    public Color externalColor;
    private Color internalColor;

    // Start is called before the first frame update
    void Start()
    {
    internalColor = externalColor;
    }
    // Update is called once per frame
    void Update()
    {
    //apply color of this script to the FCP whenever it is changed by the user
    if(internalColor != externalColor) {
    fcp.color = externalColor;
    internalColor = externalColor;
    }
    //extract color from the FCP and apply it to the object material
    p3dpaintdec.color = fcp.color;
    }
    }
    }
     
  47. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    The public properties are called Color, Radius, etc ;) color and radius are the private fields, which you cannot access externally.
     
  48. Realgar

    Realgar

    Joined:
    Sep 30, 2012
    Posts:
    52
    Great !!! I'm sorry for ma newbie question, it was so evident !! Thank's, you are very reactive !!!
     
    Darkcoder likes this.
  49. HamzaBr197

    HamzaBr197

    Joined:
    Jul 9, 2019
    Posts:
    4
    hello i've got some questions :

    - Can we modify Metallic and Smoothness seperatly
    - How is it possible to detect when there is texture painting so we can apply vfx for example
     
  50. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    1 - If they are in separate textures then you can use two P3dPaintableTexture components (one targeting each), and use the Group setting to isolate metallic painting to metallic textures and vice versa. If both of these maps are on the same texture in different channels, then you can use the Additive/Subtractive blending modes with colors like 1,0,0,0 or 0,1,0,0 to isolate painting. There's no blending mode that can apply alpha blending on specific channels though, that sounds like something I should add though.

    2 - You can hook into the P3dPaintableTexture component's OnModified event, or you can add your VFX to your paint tool by making a component that depending on your requirements implements these interfaces: IHit, IHitPoint, IHitLine, optionally: IHitQuad, IHitRaycast