Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Paint In 3D ️️✏️ In Game & In Editor & Skinned Mesh Painting

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

  1. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    365

    :confused::(
     
  2. WJLIDDY

    WJLIDDY

    Joined:
    Aug 31, 2017
    Posts:
    6
    Alright, I found the error.
    The mirror works as expected when it (and the object it is painting) has the origin at (0,0,0).

    But, if you move the mirror and object somewhere else, then the mirror only works when it is flipped.

    To reproduce, open the "mirror" sample scene and move both the space ship and the mirror to (-10,0,-10)
     
  3. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    Which step don't you understand? You can look at the demo scenes like "PBR Painting" to see how painting multiple types of textures at the same time looks like. You basically just need to set up multiple P3dPaintableTexture and multiple corresponding P3dPaintDecal/Sphere components, with matching Group settings to link them up.


    Aha, I can see the issue. I'll send you an updated build soon.
     
  4. unity_bcbhh

    unity_bcbhh

    Joined:
    Feb 18, 2019
    Posts:
    5
    Ok, thx. I will try to implement it in the way you suggested
     
    Darkcoder likes this.
  5. Darkcoder

    Darkcoder

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

    Version 1.9.9.1 of Paint in 3D is now out!
    • Fixed P3dHitScreen.TouchOffset DPI scaling being inverted.
    • Fixed P3dGroupData shader texture presets for URP and HDRP shaders.
    • Fixed P3dMirror in some scenarios.

    I want to save version 2.0.0 for something more special, so you'll have to deal with increasingly silly version numbers for now.

    Enjoy :)
     
  6. dogabeey

    dogabeey

    Joined:
    Jul 17, 2018
    Posts:
    2
    Can I run fill / replace command (or any painting tool) in script when a critera is met? If so, how? I checked the scripts but I failed to understand how they work.
     
  7. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    The "72 Paint From Code" demo scene shows you how to paint decals from code.

    P3dPaintFill/Replace is a little different, as you must call the HandleHitCoord method rather than HandleHitPoint, but it's basically the same. The call would look like this:

    Code (csharp):
    1. yourPaintFill.HandleHitCoord(preview, priority, pressure, seed, new P3dHit() { Root = transformYouWantToPaint }, rotation);
    As you can see, it requires the P3dHit rather than the hit position, the other parameters are the same though.
     
  8. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
  9. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    Your rock is back to painting the _MainTex again, which isn't valid for default SRP shaders. (I've added a note to the documentation HERE about this) did you install an old build or load a previously set up scene? You can click the 'X' button next to the rock to clear all painting components, and then set it up again. If you see _MainTex again then something went wrong.
     
  10. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
  11. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
  12. JohnFalconEsq

    JohnFalconEsq

    Joined:
    Jan 11, 2018
    Posts:
    2
    Hi @Darkcoder, I'm also getting the same issue as @Exeneva
    • I create a new project in Unity 2020.1.14f1 using the standard render pipeline
    • Import the 1.9.11 version of PaintIn3D package from the package manager
    • Open the InEditor/Examples/01 Basic Setup scene
    • Open the Paint in 3d window from Window/Paint in 3D
    • Switch to the Paint tab
    • Press Play
    • I can move the camera around but not draw, just like @Exeneva is experiencing.
    I can get the InGame examples to work, no problem.

    Matt
     
  13. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
  14. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    I just tried these exact steps in a new project with that version of Unity and painting in this scene works exactly as expected.

    So strange, there must be some other reason it's breaking.

    I'll have to send you two custom builds with lots of debug code so I can see exactly what is or isn't happening when you try to paint.

    Sorry for the issues everyone!
     
  15. XB23

    XB23

    Joined:
    Sep 12, 2018
    Posts:
    20
    Hello, I bought your asset a while and it works perfectly, very impressive. Now I'm on a new project with your asset in and with webRTC module to communicate between apps, but when I draw with the connection established, it seems like the app don't know when I release the cursor to stop drawing. So when I click again, it links my last point to the new one. Did you know how to handle that ?
     
  16. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    In this scenario you can manually call the ResetConnections() method from the P3dHitScreen component to break any newly joined points from previously drawn ones. My documentation generator currently doesn't scan base classes, so it's not obvious that this method exists. I'll see if I can fix that.
     
  17. keremsl123

    keremsl123

    Joined:
    Apr 24, 2016
    Posts:
    2
    How can I realize how much the model is painted? For example : when all model painted , i want to execute a function.
     
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    Demo scenes 45-48 (Channel Counter, Percentage, Color Counter, Change Counter) show you how to count how much you've painted using different techniques. Each of these components has an associated event component like P3dChannelCounterEvent, P3dColorCounterEvent, P3dChangeCounterEvent, which will invoke an event when you've painted the specified amount.
     
  19. tieum67

    tieum67

    Joined:
    Mar 7, 2017
    Posts:
    50
    Hello ! I'm pretty new to this asset, but so far it looks very nice ! One question : i would like to put a decal on a big mesh where the texture is tiled. When i use the paint decal component, my decal shows up on every tile. How could i put a decal on only one place of the mesh ? Thanks !
     
  20. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    You would have to UV map your mesh so that it doesn't have any tiling. If you need tiling (e.g. brick texture), then you could use a base material with tiling via the material settings, and then have your decal painted on top using a transparent material (e.g. using the P3D Overlay shader).
     
  21. tieum67

    tieum67

    Joined:
    Mar 7, 2017
    Posts:
    50
    thanks ! I will have a look ! Actually my big mesh is an export from a terrain.
     
  22. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    Terrains aren't the best use case for Paint in 3D because they're typically very large, and so even if you paint a massive texture like 8192x8192, each pixel will be very large. If you absolutely must paint your terrain then the best solution is to split it up into small cells (e.g. 4x4 quads) with a modest texture size (e.g. 512x512). As long as these small cell meshes are only created when required, it shouldn't use up much texture memory, but of course you would need some custom system/code to generate these small meshes when required.
     
  23. XB23

    XB23

    Joined:
    Sep 12, 2018
    Posts:
    20
    Thanks for your answer, but I tried to use ResetConnections() with no succes, Maybe I'm missing where to call it. Also it seems that, finger.up is not properly set. When I have my bug, I figured that finger.up is not true (even if in reality it is).

    Did you have more advices for me ?
     
  24. XB23

    XB23

    Joined:
    Sep 12, 2018
    Posts:
    20
    Ok I think it's fixed, in P3dInputManager.IsUp(KeyCode key) I change the line using the new input system by the old one "return Input.GetKeyUp(key);" and it looks like there is not problem anymore. I will post again if the bug come back. Thanks again for the quick answers.
     
    Darkcoder likes this.
  25. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    Which key did you have set for this? When using the new input system P3dInputManager.IsUp() attempts to map the legacy KeyCode to the new input system's button control. Most of these can be directly mapped, but some aren't possible.
     
  26. prasetion

    prasetion

    Joined:
    Apr 3, 2014
    Posts:
    26
    hello, cool asset!!
    i want to make a heatmap like this,



    and i don't know where should I start from, can you give me some clue to make a heatmap like this using paint 3d, thanks
     
  27. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    The easiest way to achieve this is to use a custom shader that converts a greyscale gradient texture into a rainbow gradient texture (i.e. sample the greyscale .r value, and use that as the U or V to sample the rainbow texture, and apply that as the albedo). You can then set your car's P3dPaintableTexture Color to be black by default, and paint it white using P3dPaintSphere. This can be done using the live painting, screen painting, or however you want the paint to apply.
     
  28. siowchenying

    siowchenying

    Joined:
    Oct 27, 2020
    Posts:
    5
    Hi, I recently used your asset for 3D painting a random mesh (during runtime). But I faced some issues because the mesh has no UV data.

    I would like to ask if there are any possible problems with painting on a uneven UV (due to bad UV unwrapping), and if there are any possible suggestions to painting a mesh during runtime. (the mesh can be anything and has no UV)
     
  29. WJLIDDY

    WJLIDDY

    Joined:
    Aug 31, 2017
    Posts:
    6
    Heyo!
    When compiling for android, I get an error at line 71 in P3DPreset.cs.
    It looks like it has to do P3dGroupData_Editor being an editor script, so I just wrapped it in
    Code (CSharp):
    1. #if UNITY_EDITOR
    and everything works fine. Just thought i'd give a heads up.
     
  30. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    Your mesh must have UV data for you to be able to paint it, and for best results this UV shouldn't contain tiling or overlapping areas. The main issue with painting a mesh that has bad UV data is you will be wasting a lot of texture space, which wastes texture memory, and if your UV doesn't have a consistent scale then the texels will look weird in places.


    This should have been fixed in the latest version. I just tested it and I can build for Android without errors.
     
  31. prasetion

    prasetion

    Joined:
    Apr 3, 2014
    Posts:
    26
    sorry i don't understand shader at all, i am still learning. For the finish product, what i want is like this



    for the custom shader, it would be great if you have any article or link for dummies about related topic for me to start learn shader, thank you ;)
     
  32. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    You need to start with a black texture, and paint it white. You then need to use a custom shader to convert this black -> white gradient to black -> blue -> green -> whatever. Maybe there's a tutorial out there showing how to do this in Shader Graph or something, but I don't know and shader tutorials are outside of the scope of what this asset is designed to do so you're on your own there.
     
  33. swredcam

    swredcam

    Joined:
    Apr 16, 2017
    Posts:
    128
    Just imported the entire asset into a new project. I want to look at the Rock Engraving scene. It opened fine but the rock renders pink. Nothing has been modified in the scene, it's right out of the import. I see a material and it has correct albedo etc. Unity 2020.2a with URP.
     
  34. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    Did you switch this asset to SRP? See HERE.
     
  35. swredcam

    swredcam

    Joined:
    Apr 16, 2017
    Posts:
    128
    No I had not done that, thank you! I did try "Upgrade to Universal" for the rock material only earlier -- do I need to back that out?
     
  36. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    Possibly. By default the Rocks material uses the P3D Solid shader, which shouldn't be able to be upgraded since it isn't an official Unity shader (e.g. Standard shader), unless I misunderstand how that tool works. If it doesn't work you can always re-import Paint in 3D again. Let me know if you encounter any issues!
     
  37. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    Well I hate to say this, but I'll just have to leave a negative review. Even after numerous support attempts, it still doesn't work in latest Unity 2020.1 URP.
     
  38. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    No problem, I completely understand. Your patience with the tests has been extraordinary, I just can't replicate this issue with 2020.1 URP, so it's too hard to know what needs to be fixed. If you send me a private message or email with your invoice or order number I can always issue you a refund if you'd like.
     
  39. swredcam

    swredcam

    Joined:
    Apr 16, 2017
    Posts:
    128
    It seems to be OK, I can write on the sample rock similar to the demo video. Thank you!
     
    Darkcoder likes this.
  40. Darkcoder

    Darkcoder

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

    Version 1.9.13 of Paint in 3D is now out!
    • Added Gradually Fade / Blur demo scene.
    • Added Gradually Fade / Normal demo scene.
    • Added Dip demo scene.
    • Added ability to bind in-game camera rotate.
    • Added ability to bind in-game camera pan.
    • Made in-game camera pan default to left command key on OSX.
    • Fixed P3dPaintableTexture inspector error when painting meshes with submeshes.

    Enjoy :)
     
  41. Anubis_V2

    Anubis_V2

    Joined:
    Dec 11, 2020
    Posts:
    6
    Hello, i'm using your tool for a project. I can draw with multiple colors, erase/clean my draw but i don't understand how to add the undo/redo methods in my scene.

    I want to save state for each new line i can draw and save 10 states.

    Thanks for your work !
     
  42. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    You must enable the P3dPaintableTexture component's UndoRedo setting:

    upload_2020-12-11_19-17-21.png

    And make sure your P3dHit___ component has StoreStates enabled:

    upload_2020-12-11_19-18-2.png

    You can then undo/redo using the P3dButtonUndoAll and P3dButtonRedoAll components, or do this directly from code with the P3dStateManager.UndoAll/RedoAll methods, or directly call Undo/Redo on your P3dPaintableTexture.

    Take a look at the "PaintIn3D/InGame/Examples/35 Undo Redo" demo scene to see this in action.
     
  43. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    918
    Hi. I saw this old post. Do you already found a solution for this effect?

    Another question. Does the painting and collision also work on rigid bodys e.g. a physicalized car?
     
    Last edited: Dec 14, 2020
  44. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    1 - Yes, the latest version includes the "Dripping Paint" demo scene, which demonstrates this.

    2 - Yes.
     
  45. Augmentus

    Augmentus

    Joined:
    Apr 9, 2020
    Posts:
    1
    If the UV is uneven, is there some way we can make the UV more uniform during runtime?
     
  46. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,236
    If by uneven you mean with uneven texel sizes, then you should modify your UV generation code to not change their scale to begin with.
     
  47. robert12342

    robert12342

    Joined:
    Jun 11, 2018
    Posts:
    29
    I wanted to paint the car, the problem on mobile phones where I poke my finger the decal is immediately applied, in the future I wanted to make the current paint when you click on the button, how can I turn off this feature?) On the PC, I put when you click on the f button to paint, but it looks like the mobile there is a different processing
    upload_2020-12-15_16-5-29.png
     
  48. OVIOAli

    OVIOAli

    Joined:
    Dec 15, 2020
    Posts:
    6
    Hi, I wanted to export my paints via script. I saw save by script on documentation. I tried but that only saves on playerprefs I guess. So, does this asset have this option? I searched for this but I couldn't find any information.
     
  49. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,099
    Hi @Darkcoder

    i would like to ask a quick question. I am looking into ways to create a vehicle livery system for a racing game.
    I was wondering if you system can help us in some way. We are thinking of stacking decals and being able to move, rotate, scale and add color to them - as in many games.

    What is the way of painting in your system, is it purely painting only using brushes and stamps of you can also project stuff onto objects !?

    Thanks !
     
  50. XB23

    XB23

    Joined:
    Sep 12, 2018
    Posts:
    20
    Hello @Darkcoder, when I draw I have black flash only when using the touch screen. I didn't find anything like this on this forum, someone ever had this issue ?