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. AndrewRoto

    AndrewRoto

    Joined:
    Jul 7, 2021
    Posts:
    3
    Did some more digging. It appears that to get the Points On UV mode to work properly in build the mesh asset needs to have Read/Write Enabled in it's import settings. I now have this up and running. I might have missed a section on asset preparation for this.
     
    Darkcoder likes this.
  2. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,710
    Aha, yes someone pointed this out before. This is on the to-do list, and I will add some sort of inspector warning in an upcoming version.
     
  3. manscomgamedesign

    manscomgamedesign

    Joined:
    Feb 17, 2021
    Posts:
    9
    Thanks for your reply, I have used a shader editor to test out a few shaders and I think I am now understand how it works.
     
  4. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,710
    Great, let me know if you encounter any issues with the painting!
     
    manscomgamedesign likes this.
  5. pastersteli

    pastersteli

    Joined:
    Dec 9, 2020
    Posts:
    5
    Hello, There is a problem with changecounter. Can u help? @Darkcoder
     
  6. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,710
    Sure, if you provide some details.
     
  7. AndrewRoto

    AndrewRoto

    Joined:
    Jul 7, 2021
    Posts:
    3
    We're using this on a mesh that has a secondary UV and getting this bizarre effect where it applies a screen instead of a regularly applied color to the Mesh, and only on the meshed that are using the secondary UV. This can be seen in the linked GIF below:

    https://imgur.com/a/dLMmVa8

    Our other meshes aren't having this issue where the screen is applied and have a pre-multiplied application as intended.

    Are we setting values up incorrectly? Is there a way to get the UV to use the same effect as the base? Or is this made this way by design? I have attached below the material settings. It and the mesh being used are the only differences between the meshes when it comes to painting settings.

    upload_2021-10-14_15-14-18.png
     
  8. piegaro

    piegaro

    Joined:
    May 17, 2017
    Posts:
    10
    Hello, thanks for this cool asset.

    For some reason, the rear of my horse mesh cannot be painted in-game (using the usual P3D Hit screen & P3D Paint Sphere), where it is working absolutely perfectly in the editor (Via the Paint in 3D window). Any idea why?
     

    Attached Files:

  9. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,710
    It's hard to say what's happening without seeing your full setup or a test scene. The painting modes should behave the same regardless of the UV channel and mesh you specify.


    In in-editor painting uses the visual mesh for painting via Unity's super secret internal editor-only API. However, in-game painting uses physics raycasts, which use colliders. You only have a BoxCollider on your horse, which probably isn't precise enough to paint the mesh relative to the size of your paint brush. To fix this you should use a MeshCollider, or some kind of compound collider from individual colliders on each bone. You could also use the technique shown in the "Zombie Blood" demo scene, which uses a stretched decal that still works with just a BoxCollider, but it has some drawbacks like painting through everything under your mouse/finger.
     
  10. pastersteli

    pastersteli

    Joined:
    Dec 9, 2020
    Posts:
    5
    When I start the game, count start higher but texture has nothing changes. but When downsample step is 0 there is no problem. It causes performace problems I want to make higher but there is a problem.
    upload_2021-10-16_13-29-20.png
    upload_2021-10-16_13-31-1.png
     

    Attached Files:

  11. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,710
    If I modify the "55 Change Counter" demo scene to match your settings, it works as expected. I see no real difference between DownsampleSteps = 0 and = 3. Let me know what I'm missing so I can replicate the issue.
     
  12. pastersteli

    pastersteli

    Joined:
    Dec 9, 2020
    Posts:
    5
    try to use this texture with cutstom replace painter and on 512 *512. try with downsample 0 and 6 . threshold 0. Counter will start with high values on downsample 6
     

    Attached Files:

  13. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,710
    512x512 downsampled 6 times is an 8x8 texture. I don't think this is enough pixels to give any accuracy for counting pixels. Does it work for lower values?
     
  14. pastersteli

    pastersteli

    Joined:
    Dec 9, 2020
    Posts:
    5
    no, not working. Also there is no change for 8x8 but look like changed. counter not starting from zero even for 1 downsample
     
  15. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,710
    I've attached a package that shows the change counter with the setup you describe, and it works fine for me. Let me know what needs to be changed to replicate the issue.
     

    Attached Files:

  16. pastersteli

    pastersteli

    Joined:
    Dec 9, 2020
    Posts:
    5
    I tried your example. Only difference is texture settings. I figure out now the problem. when I reset the texture settings, problem solved.
     
    Darkcoder likes this.
  17. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,710
    Sorry for the delay. I found time to debug and fix the issue, it should now be live in Version 1.11.11 :)
     
  18. lawsonh

    lawsonh

    Joined:
    Jul 25, 2018
    Posts:
    58
    Wow! great news. Thanks so much
     
    Darkcoder likes this.
  19. DromoDesigner

    DromoDesigner

    Joined:
    Mar 27, 2016
    Posts:
    34
    Hello, I'm creating a game where people build vehicles by putting together blocks, and I am thinking of using your asset for it.

    I would like to apply a texture to cover the entire vehicle that the player has built from the blocks, so it fits the entire vehicle as a whole. For example, the way a tank's armour looks like it was moulded from one large piece of metal.

    Here is a bit more about the game. The player will be able to select blocks of different shapes and sizes (e.g. corner blocks, flat blocks) from a menu, and combine them together to make the shell of a vehicle, such as a tank. I'm not sure if I've gone about this the right way, but each individual block has a material to make it look like a painted metal.

    The way the tank is built is by adding each block as a child of the main vehicle game object (which is the first tank component to be placed - in this case the tank tracks). So the tank ends up with about 20-30 blocks as children game objects that make up the hull. At the moment, each of these blocks has its own material, and as a result the blocks produce a tiling effect, as the pattern on each block's material does not match up with its neighbours.

    What I would like is for the whole tank to not have this tiling, so that it would seem to be made out of one piece of painted metal. I am looking for a way of either making each block's materials match up so the tiling disappears, or have one material that just covers all of the tanks blocks, so it looks like the tank is made out of one piece when it is finished.

    Would your Paint in 3D asset be able to help me do this?

    Thank you for your help.
     
  20. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,710
    What you want is a triplanar mapping shader. This will make all blocks appear as though they're part of one continuous material, and it wouldn't even require you to UV map them, and it wouldn't require any additional texture memory.

    Paint in 3D has a triplanar painting mode, but to use it in your scenario you would have to merge all the blocks into one mesh, generate or at least move around each block's UV so there is no UV overlap, and then create a paintable texture for each tank and then paint it all. This would be fairly difficult and would only be advised if your game also needs decals, paint, and other features of the asset.
     
  21. Uncochonvolant

    Uncochonvolant

    Joined:
    Oct 13, 2021
    Posts:
    1
    Hello Darkcoder, thank you for the great asset!
    I encountered some problems when using it to make an archaeological interactive game. I hope that the user can use the mouse to color the stone. (The colored texture will gradually appear wherever the mouse goes, and the colored texture will gradually disappear when the mouse has moved away.)

    I want to use the functions in Sample49: Reveal Original and Sample 88: Delayed appearance at the same time, but judging from the brush blending mode, it seems to be impossible.:(
    Do you have any suggestions for me? Thanks!

    (The attachment is the effect I have achieved with Sample49: Reveal Original, but now the color on the stone can't gradually appear, it appears directly, which makes me very distressed.)
     

    Attached Files:

  22. DromoDesigner

    DromoDesigner

    Joined:
    Mar 27, 2016
    Posts:
    34
    Hello, thank you for the information.

    I will look into triplanar mapping shaders. They sound exactly what I need.

    I actually bought your asset some time ago, as I liked the idea of giving players the opportunity to customise their tanks by painting them and adding decals. From what you said, this could be difficult with how my game is set up. If I get a triplanar mapping shader working for the tank's overall general texture, would it be possible to use Paint in 3D just for decals and maybe a bit of paint work to be added by the player on top of it?

    I have made the tanks blocks in Blender, and each has its own UV (in fact I followed how the UV is set out in your first example, so they are hopefully well placed out). I am also thinking about merging all the block meshes when the player has finished assembling the tank (I have the Mesh Baker asset which can do this). If I did try and use Paint in 3D for the tank's overall texture, would it be possible to then create a paintable texture for each tank and then paint it from code? This would need to be done before the player takes control of the tank and starts using it. If these procedures were done by code, could then player then be able to paint and apply decals?
     
  23. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,710
    The "88 Delayed Appearance" configuration can be used with any blending mode or paint tool. You probably haven't configured your object properly. Look at the child GameObjects of the Spaceship in this scene and you will see a it's a little complex.


    Yes this would work. Keeping the blocks separate would also be easier as you wouldn't have to adjust the UVs after. One thing to keep in mind is that main use-case for a triplanar mapping shader is if your mesh is too complex to UV map, then you can use this technique to apply textures without any UV data. However, Paint in 3D requires UV data, so your shader would have to apply triplanar without UV, and then apply your painted texture on top using UV. This would most likely require a custom shader.

    Another approach is to just keep your blocks separate, and paint them all with Paint in 3D's triplanar mapping tool. This allows you to use almost any shader, and will allow for painting and such as long as each block is UV mapped. Of course this means you must actually paint each block, so your game's texture memory will increase depending on the resolution of the texture on each block.
     
unityunity