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

    francoiscoiscois

    Joined:
    Oct 23, 2019
    Posts:
    28
    Hey Darkcoder
    Thanks for this awesome tool! I just bought it and I am really happy with the fonctionalities that the demos are showing

    I have the project to make a mobile app for kids.
    Almost all functionalities are already implemented in paint in 3D.

    There is 2 features I didn't see that would be really nice to have for my app.
    1- to be able to drag and drop decals on the model and out of the model.
    2- to be able to reajust the decals that are already placed on the model (move rotate scale) if possible by finger gesture.
    Is it something you would consider to implement in the futur ?

    If not is it something that can be coded by a beginner programmer, and what would be the best way to work on it ?
    Thank you !
     
  2. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    Thank you!

    This would be fairly tricky to implement, as it requires a lot of code. So the best way to implement this feature is to wait until I add it, and to make sure I don't forget :D

    This has been requested many times, and it's very high on my priority list. I'm currently finishing off some new demo scenes for VR, and splat map painting. My plan is to work on the feature you describe next.
     
  3. francoiscoiscois

    francoiscoiscois

    Joined:
    Oct 23, 2019
    Posts:
    28
    Awesome ! I could not hoppe for a better answer :)
    I am not in hurry as I am finishing another project first and I was just preparing for this project I will start next month.
    I will come on this page to see the progress in the meantime.
    Have a great day/evening.
     
    Darkcoder likes this.
  4. ocnenued

    ocnenued

    Joined:
    Apr 4, 2018
    Posts:
    12
    @Darkcoder Hello Darkcoder,

    We seem to have a problem regarding memory. We profiled the problem, and it turned out to be a garbage allocation problem. The garbage allocation (GC.Alloc) locks the main thread for at least 7 seconds - so this is a major problem for us.
    P3DTexture.Clear() seems to be causing the massive spike of 1GB of garbage allocation. Do you have any ideas what could be causing this? Thank you for your assistance.
     
  5. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    In theory P3dPaintableTexture.Clear shouldn't allocate anything, I'll be able to test it out tomorrow. Can you describe your usage of Paint in 3D a bit more? e.g. which painting components are you using in your scene, how many paintable objects, how many textures, are any skinned, do you use undo/redo, what resolution are these textures, etc.
     
  6. ocnenued

    ocnenued

    Joined:
    Apr 4, 2018
    Posts:
    12
    We have up to 6 SpherePainters (only one of them active at a given time) and 2 paintable objects that have MaterialCloners on them. Textures are 2048x2048 with read/write option enabled. Both of the paintable objects have SkinnedMeshRenderers and we're constantly resetting the texture by calling Clear with parameters, first one being our default texture and Color.white. We noticed that resetting texture each time contributes to longer hang times.
     
  7. ocnenued

    ocnenued

    Joined:
    Apr 4, 2018
    Posts:
    12
    Hello @Darkcoder, we actually found out that the culprit was our internal code. Paint3D is indeed perfect in terms of performance. Thank you again for your assistance!
     
    Darkcoder likes this.
  8. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    Haha, that's a relief :)

    No problem, and good luck with your project!
     
    ocnenued likes this.
  9. finecalex

    finecalex

    Joined:
    Jun 21, 2018
    Posts:
    1
  10. skytow2003

    skytow2003

    Joined:
    Feb 9, 2014
    Posts:
    18
    Hi. I have not found an example for my use case and would like a quick tip on how I could implement it using Paint3d.
    I basically have a textured mesh and would like the player to be able to customize the colors in the texture. The texture is very simple and made of colored patterns, think of a Kids coloring book.
    The modified texture would then have to be saved in the player's device.
    thanks in advance for your answer.
     
  11. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    312
    I just finished taking a good look at it for our own game and can give you a few pointers:
    • Make sure you understand the UV requirements
    • The zombie demo has what you need to implement brush based drawing.
    • Look at the zombie object to see what scripts are required to enabled painting, replicate.
    • Look at the game object "Paint (Blood)" which is a child of "Tools". It's used to paint using the mouse. The script named "P 3d Hit Screen" is your paint brush.
    • The script "P 3d Paint Decals" is where you can set the colour, intensity, shape of the decal, etc...

    All you need is to reuse these scripts and tie it all up to an in game user interface.

    Good luck.

    EDIT

    Oh, I think I misunderstood you. You would like to fill an entire zone of a given colour with a new colour. Kind of like the fill tool in a paint program. AFAIK this thing doesn't do "fills". You would have to implement it.
     
    Last edited: Dec 3, 2019
  12. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    312
    @Darkcoder I stumbled on a problem trying to use UV1 data with the standard shader.

    In this section: http://carloswilkes.com/Documentation/PaintIn3D#39526

    Step 3 reads "Step 3 Change the P3dPaintableTexture > Channel setting to UV1."

    But there is no way to select UV1 in P3dPaintableTexture > Channel.

    It goes from UV to UV2 directly, what's going on?


    I'm trying to enable painting on a mesh where I can't use the UV0 or it's Albedo texture as it uses optimized UV for mobile that are mapped to colour swatches in a texture atlas. ie.: all skin colour on the model is mapped to the same skin colored pixel on the texture.

    Hopefully using the lightmap UV in UV1 is a solution if not I'm not sure how to do this without unwrapping them by hand and creating new textures... That would be a lot of work.
     
    Last edited: Dec 3, 2019
  13. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    Thanks for pointing this out, I can replicate the issue. I'll try to fix this as soon as possible!


    Hmm, it depends exactly how you want it to work. Changing textures in a single already painted texture (e.g. albedo) would be difficult, and will result in visual artefacts at the edges where the colors blend together. The best solution is to paint each color to a separate layer, except the color you paint to each layer is actually just white. You can then use the _Color property of each material layer to control the final color. This allows you to easily change the color of each color, and preserve the original paint and blend quality. This can already be done by adding many transparent material layers, one P3dMaterialCloner for each, and one P3dPaintableTexture for each. You can then use separate Group settings for each. I'll add this demo scene to the to-do list, there are quite a few more important things I need to add first though.

    For the longest time Unity named the first channel UV, and the second UV2. This was always confusing because in shader code it goes texcoord0, and texcoord1. I decided to match Unity's naming to make this easier for users. However, recently Unity has decided to fix this and name them UV then UV1. This means in terms of Paint In 3D code, you should use UV2, which are lightmap coords. I will update this in an upcoming version.
     
  14. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    312
    That sounds like unity alright! They even still talk of UV2 on here: https://docs.unity3d.com/Manual/LightingGiUvs-GeneratingLightmappingUVs.html
    You may want to check this thread on the subject: https://forum.unity.com/threads/imp...garding-mesh-uv-channels.370746/#post-2402367

    Why they choose to name the mesh uv differently is beyond me. It's just confusing everyone.

    Thank you for the quick update.

    PS.: Just wanted to point out something, while shopping for a decal solution I almost missed your asset. Like many others, I'm sure, I searched "Decal" in the store and almost bought EasyDecal. If I hadn't had a flash last second that painting on a model was the same thing I wouldn't have bought your asset. Which would have been a huge mistake cause It's great! Love how you included tools to fix some common mesh issues.
     
    Last edited: Dec 3, 2019
  15. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    312
    @Darkcoder Hi, I need additional pointers,

    Managed to get my skinned meshes painted easily (they have proper uv) but I'm still struggling with other meshes.

    Here is how the default UV are mapped on those assets (Screenshot from QUVEDITOR, great tool btw):

    This is the whole texture for 200+ assets. See the white dots? Thats the UV mapping. The texture is not used in a traditional sense. The different sections of the model are assigned a color not a part of a texture.
    upload_2019-12-3_14-14-29.png

    Here is what the lightmap UV generated by unity looks like:
    upload_2019-12-3_14-18-20.png

    Looks much better (obviously the texture is wrong).
    I would need to set things up to use those lightmap UV with a transparent texture that would be blended on top of whatever the 1st UV and the MainText is doing.

    I've done something like this on the same meshes using a custom shader (sampling two textures using different UV sets to set the colour) but I'm wondering if you have an idea that would allow using the standard shader.

    Please advise.
     
    Last edited: Dec 3, 2019
  16. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    312
    @Darkcoder Here is some additional info on my setup:

    You can see the shader config and the resulting detail map created on the right:
    upload_2019-12-3_14-49-0.png

    For some reason nothing appears on the model.

    Here is the complete setup of the object:
    upload_2019-12-3_14-51-22.png
    upload_2019-12-3_14-52-1.png

    And the import settings:
    upload_2019-12-3_14-58-54.png

    Hopefully you have an idea that doesn't include modifying over 1500 assets /panicking
     
    Last edited: Dec 3, 2019
  17. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    As you can see, the reason why I don't advertize this as a decal solution is because decals and texture painting work quite differently :D Actual decals don't require mesh UVs, there is no cost to moving them around, and they don't require allocating new textures. However, they have many downsides like: the rendering cost is proportional to how many decals you have, and how large they are on screen, especially if you're using forward rendering. You have far less control over how the decals interact with the underlying materials. Decals don't behave too well with skinned meshes. It can be very difficult to isolate decals to only appear on certain objects, etc.

    These differences mean many of the cool demo scenes you see in Paint in 3D would be unusable in game if they weren't painted to the textures.

    In your scene I believe the issue is that your detail tiling is set to 0,0, and it should be 1,1.

    Keep in mind this Standard shader UV1/2 'hack' that you use will darken your albedo, which only works as expected if the albedo is (near) white. If you have such a colorful mesh I recommend you use a second material layer with a transparent material using a shader that maps to UV1/2 (e.g. P3D Alpha). I'm currently waiting for Unity to review the next version, which comes with some vastly updated shaders that allow you to pick between 4 UV channels, enable parallax offset mapping, and have per-texture tiling that works in SRP too.
     
  18. skytow2003

    skytow2003

    Joined:
    Feb 9, 2014
    Posts:
    18
    thanks tcz8 and darkcoder, and yes the idea is to work like a fill tool.
    I guess I could cut the mesh up so that each piece of the mesh would have its own material and then I could have the player choose each piece's/material's color.
    Do you think it could work or am I missing something ?
    thx
    pietro
     
  19. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    Yes, splitting the mesh up as you describe would be the best solution. This would give you full control over the color, give you the best performance, and would work with the current components without modification.
     
  20. Darkcoder

    Darkcoder

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

    Version 1.7.6 of Paint in 3D is out now!

    This fixes some important bugs, adds some cool new features, and some new demo scenes!

    Perhaps the coolest new feature is that the VR features now work even if you don't have a VR device, so everyone can try the VR HVLP demo scene, which has been optimized even more.

    These changes also allowed me to easily create the new VR Pen demo scene, which shows you how to paint thin lines from a 3D object, which many users have requested. To make it work great in VR this demo scene makes use of P3dHitBetween to make the pen automatically adjust its distance so it's always drawing on the whiteboard, even if you get sloppy and your hand goes through it (very easy to do in VR with such a small tool).

    This version also adds in splat map painting with a pretty neat splat mapping shader (supports all pipelines). Keep in mind this feature is still under development, so I need to work on the documentation a lot, and I need to make some better demo scenes. I didn't want to wait too long to get these new features out, so you can at least see what it looks like and give any feedback.

    Enjoy!


    [Edit] Also, it seems like I'm in the Cyber Week Mega Sale too, so if anyone missed it you have another chance to get this asset (and two of my others) for half price :)
     
    tcz8 likes this.
  21. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    312
    @skytow2003 NP BTW I came to realize there are much better examples to start off with than the zombie one so make sure you check em all :p

    @Darkcoder OMG you are so right, it was right in my face all along! :oops:
     
    Darkcoder likes this.
  22. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    312
    @Darkcoder I can't seem to get things working with static objects any ideas?

    Same thing for my objects or the spaceship included in the demo.

    With only 1 object set as static it works but when you have multiple objects it doesn't.

    I read something on the easyDecal forum about a similar issue, the dev said it was a problem with space conversion when reconstructing geometry data from colliders on static meshes. Not sure it applies but there were similarities.

    I'm guessing you would have to somehow get a hold of the combined mesh and UV.

    Hopefully something can be done beside disabling batching.
     
    Last edited: Dec 4, 2019
  23. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    312
    Also, is there anything to do to prevent decals from being partly applied to meshes with sharp edges?

    See screenshot (yes I cheated on the front of the car, placed two decals manually)
    upload_2019-12-4_18-40-43.png
     
  24. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    I'll have to test it out. I believe static objects get combined and share a MeshRenderer though (and thus materials), so you wouldn't be able to paint them since they would both have the same paint.


    If you UV map your mesh so both sides of the corner are connected, then you can use the P3dPaintDirectDecal component, which will correctly paint across both sides as you would expect.

    However, there's no way to automatically do this on an arbitrary mesh with any kind of UV. Think about it, if you paint the top right corner of a cube, the bottom left quadrant of the decal gets applied to the face you clicked on, the top left goes on the top face, the bottom right goes on the right face, but where does the top right quadrant get painted to?! Not to mention the paint applied to the top and right cube faces won't connect together properly and will form a seam.

    One alternative I'm considering implementing is some kind of curved or deformed decal painting component. Instead of painting based on one hit point (e.g. raycast from mouse), it would fire a grid of rays, and then bend the decal to the contour. This should work in your example scenario, but it would fail on my cube example, and it would probably not look too good on thin poles and such. In fact, I don't think it would work to well on most surfaces so I'm not sure if it's any better than just using direct decals with proper UV mapping.

    If you really want to be able to paint something like a car well, then I recommend you split each body part up into its own mesh, and make it so in game you must select which body part to paint, and then all paint is isolated to that. Being able to arbitrarily apply paint to the whole car at once and have it look exactly as you expect may be nice in one's imagination, but in terms of the mathematics of how to actually apply it, it doesn't really make sense.
     
  25. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    312
    1. I see what you mean. Had the same Idea about using multiple rays, I think the hardest part is in detecting when parts of the decal hits a part of the mesh that is far apart.

    Making the number of rays per decal configurable would be a nice touch for performance control, and it may be a good idea to allow positioning the rays' origin on the decal manually. I guess it could be done automatically if you can space em out reliably and check that it's not firing from under transparent areas but It would probably be complicated and not as reliable.

    I wonder if it would be possible to use whatever unity is doing with projections on 3d meshes. Also, Its worth nothing that when using Ray Direction instead of Hit Normal for the normal setting its much less prone to issues with mesh positions. Which makes me think there may be something to investigate here. (How to use this

    2. As for the statically batched objects on combined meshes, the materials still seem to be accessible, and responsive to changes. All objects in the test scene below are static and use a combined mesh. I was able to modify their texture, color, shader and even the entire material at runtime with proper results.

    upload_2019-12-5_14-26-56.png


    If I try to paint blood, the render texture gets updated and sometimes there is even something showing up on the object. In the pic below you can see very faded spots of blood on the pool table circled in blue and the corresponding render texture attached to the object.

    upload_2019-12-5_14-32-36.png


    Really looks like its working but the coordinates are wrong.
     
    Last edited: Dec 5, 2019
  26. Mickman

    Mickman

    Joined:
    May 9, 2012
    Posts:
    153
    HOW COOL IS THIS...... AWESOME !!!!
     
  27. Bejelit79

    Bejelit79

    Joined:
    Dec 18, 2015
    Posts:
    17
    hi, I'm testing 3d paint on my project, but after setting the textures, when I click paint, unity freeze, what can I do?
    unity version 2019.2.12. is there anything in particular that I have to do?
    no red alert in console, only freeze

    in a new empty project it works perfectly, but I need to work on my project
    thanks
     
  28. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    Interesting, it looks like they're put in sub meshes, so maybe they could be painted. They still all need their own materials though, so I'm not sure if any speedup would be worth it. As you say, the paint doesn't apply in the right place, and the way batching works probably has something to do with this. I'll have to test it out next week.


    VERY COOL! THANK YOU!!! More cool features coming soon :)


    Do the Paint in 3D examples work inside your project? If so, it must be something about your main scene that breaks.

    First you need to see if the freeze is caused by Paint in 3D, or your code. To do this:

    1) Open Visual Studio for this project (e.g. double click a C# script asset from the Project tab like PaintIn3D/Shared/Scripts/IHit)
    2) Inside Visual Studio, click the Attach to Unity button at the top.
    3) Run your game in Unity until it freezes.
    4) Inside Visual Studio, click the Break All (pause icon) (red circle below) button at the top.
    5) You should now see a line of code highlighted like below in magenta.
    [optional] 6) If you don't see 5, then you may need to click the blue circle dropdown list, and select a different thread. Try going through each one until you see 5.
    7) Take a picture of the code like this so I can see where the error is.



    If you can't do these steps or they don't work, then try duplicating your scene, and disabling all GameObjects, then gradually enable more until it freezes, then you can narrow it down to which ones break.

    Also, let me know which Paint in 3D components you're trying to use, what kind of objects you're using them on (e.g. solid, skinned), how many objects, etc. The more information the better!
     
  29. Bejelit79

    Bejelit79

    Joined:
    Dec 18, 2015
    Posts:
    17
    thanks Carlos for explanation
    with the feeze I solved, after 2 or 3 minutes unity unlocks and I can use paint 3d, because of the size of the project and the speed of the pc I think

    I have another problem, on some objects it works perfectly, on others it doesn't work, I have to put some decals but the positioning is busted, I think it's due to uv, do you know a way to manage uv inside unity?
     
  30. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    Good to hear. If the freeze is just on startup then I'm not sure it's Paint in 3D. On startup it just clones your materials (fast), and creates some textures (fast). Maybe you could profile it to see.

    As for the UV, you can use Unity's lightmap UV generation combined with a shader/material that draws the paint on top using UV1/2 (e.g. P3D Alpha shader with UV Channels set to 0,1,0,0). You could also edit the UVs with a different asset, but this will require you to update your texture to match the new UVs.
     
  31. Raes93

    Raes93

    Joined:
    Dec 6, 2019
    Posts:
    1
    Hi Carlos,
    I'm actually trying to expose the Paint Sphere Brush Texture, in the inspector, can you tell me where I can find this object among the scripts?

    Thx a lot!
     
    Last edited: Dec 6, 2019
  32. Bejelit79

    Bejelit79

    Joined:
    Dec 18, 2015
    Posts:
    17
    Ok thanks, I try. I also wanted to try probuilder who has an uv editor, have you ever tried it?
     
  33. Mickman

    Mickman

    Joined:
    May 9, 2012
    Posts:
    153
    Is it possible to paint the Zombie in V.R with SprayPaint ?

    I have a character that's properly U.V mapped and animated I have pulled into Unity.

    When I paint it in V.R I notice a tiny bit of paint being applied but in the wrong area.

    Regarding the material.

    I'm guessing the Zombie uses Ray tracing from mouse to surface to generate the surface splat

    I simply cloned the wheel material from the V.R demo.

    Any thoughts ?
     
    Last edited: Dec 6, 2019
  34. Mickman

    Mickman

    Joined:
    May 9, 2012
    Posts:
    153
    Am also very interested in Painting over P-Builder objects.
     
  35. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    If you're talking about the P3dPaintSphere component then there is no texture. P3dPaintDecal and p3dPaintSphereTriplanar components have textures though, and the setting is called Texture.

    Yes, the "Paint Ball Throwing" demo scene was made using Pro Builder. The paint is applied to UV1/2 channel using lightmap UVs that ProBuilder can generate. These are drawn on top of the tiled bricks using the "Wet Paint Cutout UV2" material, using a Channel setting of 0,1,0,0.


    The Zombie demo scene uses one big BoxCollider, which works well because the decals are applied based on the point you click on the screen. With a large paint depth this makes it look like you shot a hole through the whole zombie. For spray painting you need the paint to apply close to the hit point though, otherwise it will look bad. This means you can't just use one BoxCollider. I recommend you add multiple colliders to each body part that follows the bone (e.g. CapsuleCollider), then you can get paint that applies much closer.
     
  36. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    312
    I just did that, what a pain in the b... it is to position colliders on meshless gameobjects. Does anyone know of a method to make it easier?

    @Darkcoder I’ve been looking into accessing the combined meshes’ renderer for a deformation system. In unity’s fashion it’s not exactly well documented. If you find any info on it please let me know.
     
  37. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    The easiest way to add skinned mesh colliders is to bake them into the MeshCollider, but this is very slow unless you bake a very low detail version. I have a script that can do this if you want, but for a final build I recommend using the other primitive colliders. I would have thought someone made a script to auto generate capsule colliders based on the bone weights though. Maybe you could use a ragdoll building tool for this?

    As for the combined mesh renderer, I haven't looked into it. As I said though, I recommend you not mark them as static. To be paintable they require unique materials and textures so they can't be batched together anyway, there basically nothing to be gained here.
     
  38. Darkcoder

    Darkcoder

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

    Version 1.7.7 of Paint in 3D is now out!

    This version is mostly bug fixes, including an important one if you were using P3dChannelCounter or P3dColorCounter.

    It also introduces some nice new methods like Resize, and Replace. Also, GetPngData, LoadFromPngData, which are great if you want to transfer your paint data over the network, or manually save to a file, etc.

    Enjoy!
     
    francoiscoiscois likes this.
  39. XCO

    XCO

    Joined:
    Nov 17, 2012
    Posts:
    353
    Hello May I ask a question its very important hopefully you can get back to me ASAP ?

    I need to draw on a Skinned mesh character so I can make MASKS - It fairly high poly - I just need to be able to draw a simple black color on the skin texture. AND I need to be able to save the texture I drew on with the new markings ?

    Does your APP do that ?
     
  40. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    Yes, this can be done fairly easily.
     
    XCO likes this.
  41. XCO

    XCO

    Joined:
    Nov 17, 2012
    Posts:
    353
    Dude if this works its going to help me a lot, you have no idea how much this means to me... TY I shall buy it now :)
     
    Last edited: Dec 10, 2019
  42. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    Thanks! I'm also currently working on a large update to the in-editor painting features, so I can send you an early build if you encounter any issues.
     
    XCO likes this.
  43. ForliReply

    ForliReply

    Joined:
    Dec 14, 2018
    Posts:
    2
    Hi, there is a way to place and change a Decal in Editor and game in a certain location?
     
  44. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    After you've painted it? No, but I plan to add this feature soon.
     
  45. ForliReply

    ForliReply

    Joined:
    Dec 14, 2018
    Posts:
    2
    Without painted, only placed.
     
  46. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    Yeah it's not supported yet, perhaps it will make it into the next version (hopefully this week).
     
  47. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    312
    Good idea!

    Unfortunately leaving every game object dynamic would be complicated, there are too many and the map is too large.

    I just reviewed the manual and if I read things right, I believe you would gain what you usually get from the combined meshes and by using atlasing on top, batching would be able to do its thing.

    If you were to load your entire scene of static objects in blender, combine their meshes as a single one, unwrap that new mesh and texture it appropriately you would be able to paint on it just fine once its re imported back into unity. Unless I'm misinterpreting things, this is pretty much what you get when batching and using a texture atlas.
     
    Last edited: Dec 11, 2019
  48. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    Atlasing and batching are great if you have many objects that share the same texture and material, which is especially easy to do when you have many duplicates of each object. However, if two objects are the same then they cannot be batched together and still be painted, because then painting one will paint the other too. You can still maintain batching with atlased objects with Paint in 3D if you specify the P3dPaintable component's OtherRenderers setting, just keep in mind that this will give you lower painting performance than having two separate non-atlased objects, because on average more pixels will be processed per paint.

    If your level is hand crafted using nothing but unique objects and you need everything to be paintable then atlasing them may be a good idea, as you can benefit from batching. However, most scenes tend to reuse a lot of assets, so it wouldn't be possible to make them all paintable and keep them batched.
     
  49. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    312
    Oh I see what you mean, it would kinda mess with "instancing".

    Yeah I was hoping to avoid implementing level streaming. I guess I will have to look into a solution like Sectr. What a pain! At least it'll let me pimp our audio.

    Thank you for putting up with my questioning :D

    Oh, I forgot to ask something: When using the standard shader with UV2, I was having problems getting bullet holes to work (getting black circles instead). While I'm pretty sure it's a problem with my config I thought I'd ask if there are any limitations I should be aware of before trying to adapt all the other paint tools.

    Thanks again!
     
  50. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,742
    No problem.

    The Standard shader's UV2 uses multiplicative blending, so it only works well if your albedo is near white. If your albedo is black then you can't paint anything brighter. For these reasons I made the P3D Transparent shader, which you can layer on top on the Standard shader, and paint using alpha blended UV2, and still get lighting and such.
     
unityunity