Search Unity

  1. 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. Xwad

    Xwad

    Joined:
    May 14, 2020
    Posts:
    38
    When i do that the whole model gets emissive. I only want to make the painted line emissive. How can i do that?
     
  2. Xwad

    Xwad

    Joined:
    May 14, 2020
    Posts:
    38
    It's emissive now, but not the painted line. I tried to set a shader for the paint sphere but there is not option for it.
     
  3. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    By default P3dPaintableTexture is white, but I assume you want it to start with no emission, so you must set it to black.


    You can't set the shader for the painting. I'm talking about changing the shader for your object's Material, which is what I thought you were referring to. You can see your object's MeshRenderer component, expand the Materials list, and drag and drop a new Material there, or double click it and change the shader. Keep in mind the "Matte White" Material is used in most demo scenes, so if you modify the shader for this, you will change the shader in all demo scenes and probably break them. So I recommend you leave this as it is unless you know what you're doing.
     
  4. Xwad

    Xwad

    Joined:
    May 14, 2020
    Posts:
    38
    I want to make a lightsaber that leaves a glowing trail or line behind it when it touches a surface/terrain.
    So if i understand you correctly than it is not possible to make only the painted line glowing with this asset.
    Could you maybe recommend any asset where i could achieve this effect?
     
  5. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    I think Unity has their own free post processing asset somewhere on the store. Was it called Image Effects or something? Also, HDRP has this built-in to the volume profile. I'm not sure about URP, maybe it has something like HDRP. Just search for bloom or glow effect and you should find it. I haven't done anything like this in years so I'm not sure what specifically.
     
  6. linenum

    linenum

    Joined:
    Nov 16, 2020
    Posts:
    56
    I'm using a blood particle system with P3dHitParticles and P3dPaintDecal. P3dPaintableTexture uses a Point filter. When there is an angle on the edge sometimes the pixel won't paint (in the white spots). Is there anything I can do?
    blood-jagged.JPG
     
    Last edited: Nov 19, 2023
  7. Megalon2D

    Megalon2D

    Joined:
    Nov 29, 2015
    Posts:
    8
    Hello, I'm struggling to prevent paint from going around corners.
    I am trying to make a spraycan and I want to only paint what is visible to the camera.
    The closest I've gotten is with the "P3D Paint Decal", however it will still paint around corners on the ground.

    1st picture is where I painted from
    upload_2023-11-19_22-54-31.png

    2nd picture is what it looks like around the corner
    upload_2023-11-19_22-55-40.png
    Also that decal is a circle but it gets pretty square when painted at an angle I guess.
    This asset is great and I'm really happy with it so far, I just need some help figuring this out!
    Thanks
     
  8. warde

    warde

    Joined:
    Sep 10, 2012
    Posts:
    7
    Hi, can I use this package in a lock-step multi player game. What I want to do is two players shooting on a same non-skinned object, the one paint more will win. I want to know if I pass the same start position and force to the bullet, will it hit and paint the same area at different clients?
     
  9. DanDanCreations

    DanDanCreations

    Joined:
    Nov 22, 2018
    Posts:
    1
    Hi, thanks for sharing this amazing package. I have a small issue with painting. Painting does not work on every material on my skinned mesh renderer -> i have 5 materials and it only paints on the first one (no matter what it is, i can only paint on the head). Do you know how to fix it? Thanks in advance.


    All the materials have the shader: Paint in 3d/solid
    Paint object uses p3dPaintSphere and p3d hit nearby
     
  10. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    Hey everyone, I just found out that the Shave & Stuff game was made using Paint in 3D. Check it out, it looks amazing!

    Made With Paint in 3D

    Shave & Stuff by HyperVR Games
    (Site, Oculus, Steam)​



    Does your mesh use Auto Seam Fix, or a mesh generated by the Seam Fixer tool?

    In the last version or so I added the "93 Depth Mask" demo scene, which shows you how to mask anything 'behind' objects in view of the specified camera. Maybe it doesn't work in the latest version though, but I'm not sure as I'm currently redoing a lot of code on my end so please let me know.


    It depends which paint hit component you use. If your bullet uses Unity's physics system then I don't think even that would be deterministic. However, if the paint hit point and normal is the same across all clients then the paint should apply the same. One thing to keep in mind is that components like P3dHitScreen by default use RotateTo/ReplaceTo = CameraUp, so your camera's orientation could change the way paint is applied. There are some minor GPU differences in some scenarios that may technically cause differences, but I'm not sure if this would change the results.


    From what I can see, your settings look correct so it should be painted. Is it possible for you to prepare a really simple scene with your mesh configured like this, and make a unitypackage of it + your mesh, and send it to me via email or private message?
     
  11. linenum

    linenum

    Joined:
    Nov 16, 2020
    Posts:
    56
    The diagonal edge in the object was created during the gameplay using EzySlice.... it doesn't involve any seam fixing.
     
  12. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    105
    Hello. I'm using the Hit Collisions method. Is there a way I can activate a child of the ball specifically when the first collision takes place? I saw the "Action OnEnable" script, but that turns it on immediately.
    upload_2023-11-23_22-20-39.png
     
  13. FuzzyOnion

    FuzzyOnion

    Joined:
    Aug 22, 2014
    Posts:
    33
    Hi, thank you for making a fantastic asset!

    Wondering if I can ask for some help. I'm using 2022.3.9f1 to build for android VR using URP and am getting this build error:
    Code (CSharp):
    1. Shader error in 'Hidden/Paint in 3D/Decal': undeclared identifier 'sampler_DepthTexture' at Assets/Plugins/CW/PaintCore/Required/Resources/P3dMasking.cginc(40) (on gles3)
    2.  
    3. Compiling Subshader: 0, Pass: , Vertex program with STEREO_MULTIVIEW_ON
    4. Platform defines: SHADER_API_GLES30 SHADER_API_MOBILE UNITY_ASTC_NORMALMAP_ENCODING UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_LIGHTMAP_RGBM_ENCODING UNITY_NO_CUBEMAP_ARRAY UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_RGBM UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3
    5. Disabled keywords: P3D_LINE P3D_LINE_CLIP P3D_QUAD P3D_QUAD_CLIP UNITY_COLORSPACE_GAMMA UNITY_ENABLE_DETAIL_NORMALMAP UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF2 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_VIRTUAL_TEXTURING
    6.  
    Same error for Sphere and Fill.

    My coding skills are low. Is there a way to best resolve these build errors without breaking the asset?

    Thanks in advance!
     
  14. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    Oh I see, in that case it would have seams.

    The auto seam fixer should still work though. However, the auto seam fixer caches the seam fixed mesh after you first use that mesh, so if this slicing asset just modifies the original mesh then any changes will be ignored. This is a scenario I didn't consider, so I'll add a method to remove a cached mesh that you must manually call after slicing.


    You'll have to make a custom script that implements IHitPoint/Line/Quad that then activates your GameObject. You can see the P3dDestroyer component for a really simple example of a component that performs an action when it first receives a hit, and modify that to make it activate your GO rather than destroy it.


    Never seen this before. Can you check the Plugins/CW/PaintIn3D/GUIDE and let me know the exact version of Paint in 3D you're using?
     
  15. Darkcoder

    Darkcoder

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

    Here's a sneak peak at what I've been working on:



    This is a complete rewrite of the in-editor painting features, with a focus on making it as easy to use as possible:
    • You no longer need to make any modifications to your scene.
    • You no longer need to configure your objects.
    • You no longer need to enter play mode.
    • You no longer need to seam fix anything.
    • All painting is done in screen space with pixel units (like Photoshop).
    • All paint is automatically depth masked, so you can easily paint complex geometry without fiddling with Normal Front/Back settings.
    • Adding support for custom shaders is now much easier.
    This will be released as a separate asset, but it will be free for all existing customers of Paint in 3D.

    It should be ready in a few weeks.

    If anyone has any questions or ideas for this then please let me know!
     
    Dobalina, OU-dFun and hopeful like this.
  16. linenum

    linenum

    Joined:
    Nov 16, 2020
    Posts:
    56
    EzySlice creates two new meshes for the two pieces. Then I just hide the original mesh (rather than destroying it). Note it can chop the pieces an infinite number of times and the exposed surface uses a different material and it doesn't use Paint in 3D (because it is already red). It keeps the Paint in 3D blood from the mesh before it was sliced.
    I tried the following code:
    Code (CSharp):
    1.     public void SetupPaint3D()
    2.     {
    3.         var paintable = GetComponent<P3dPaintable>();
    4.         if (paintable != null)
    5.         {
    6.             return;
    7.         }
    8.         paintable = gameObject.AddComponent<P3dPaintable>();
    9.         paintable.UseMesh = P3dModel.UseMeshType.AutoSeamFix;
    10.         P3dPaintableTexture paintableTexture = gameObject.AddComponent<P3dPaintableTexture>();
    11.         gameObject.AddComponent<P3dMaterialCloner>();
    12.         paintableTexture.Filter = P3dPaintableTexture.FilterType.Point;
    13.         Texture mainTex = GetComponent<Renderer>().material.mainTexture;
    So I added the auto seam fix line. But now when chopping one of the characters I get this error: (and they don't initially use RenderTextures)
    For other characters with different meshes (that also use RenderTextures)
    If the UV is adjusted too much the big pixels in the texture might not keep on lining up properly....

    Also if a piece was chopped again and again I guess the auto seam fix would be applied to itself multiple times?
     
    Last edited: Nov 26, 2023
  17. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    105
    Hello,I have a question regarding Hit Collision painting. When a collision occurs, I'm hoping to modify the script to do one of the following (whichever is easier):

    1)a way for the "Paintable" to trigger an event when it's painted by a paint collision.
    or...
    2)
    "Hit Collisions" report which Paintable it hit (note: I'm using the "Only Use First Contact" option). For example, say we have a throwing dart as the collision painter and there's several paintable dart boards, the "Hit Collision" on the dart would report which dartboard gameobject it painted when the collision took place.
     
    Last edited: Dec 5, 2023
  18. vladfomich123

    vladfomich123

    Joined:
    Mar 22, 2020
    Posts:
    6
    Hi all! How can I make this work with my own input system? I'm working with Rewired and I need to be able to draw with the mouse, joystick and finger.
     
  19. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    By default, the P3dHitCollisions component sends out 3D hit point data (IHitPoint), which doesn't contain any information about the object that was hit. Therefore, you would either modify this IHitPoint data to include this (difficult), or store this data with P3dHitCollisions and later retrieve it (easy).

    The simplest way to do the latter is to add something like a public static Event<Collider> in the P3dHitCollisions script, and inside CheckCollision just before the switch (emit), you invoke this event with the contact.otherCollider. You can then have your dartboard script hook into this event and detect it.


    Check out the code for P3dPointerMouse/Touch/etc, and make your own versions of it. Then you can replace the P3dPointer___ components used alongside P3dHitScreen with your custom ones.
     
  20. dkukushkin

    dkukushkin

    Joined:
    Dec 5, 2022
    Posts:
    2
    Hello!
    After upgrading Unity from 2022.3.8 to 2022.3.14, we are having problem with in editor-painting. It looks like shortly after beginning new stroke mouse suddenly jumps to top left viewport corner and then immediately back, leaving long diagonal stroke.
    I think the problem is with this line in Plugins\CW\PaintInEditor\Required\Scripts\P3dSceneTool.cs:
    Code (CSharp):
    1. LastPosition = HandleUtility.GUIPointToScreenPixelCoordinate(Event.current.mousePosition);
    While handling some events, LastPosition.x becomes -2.
    This change fixes the problem for us:
    Code (CSharp):
    1.                
    2. if(Event.current.type == EventType.Repaint)
    3. {
    4.      LastPosition = HandleUtility.GUIPointToScreenPixelCoordinate(Event.current.mousePosition);
    5. }
    6.  
    Not sure this is totally correct, please take a look.
    Thanks!
     
    madfish-od likes this.
  21. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    Would you be interested in testing the new Paint in Editor asset I showed a preview of earlier? It's almost finished and should be superior to the old/current version in every way, and will replace it.
     
  22. dkukushkin

    dkukushkin

    Joined:
    Dec 5, 2022
    Posts:
    2
    Yes, we are very interested in new simpler workflow
     
  23. vladfomich123

    vladfomich123

    Joined:
    Mar 22, 2020
    Posts:
    6
    So I should make my own version of P3dPointerMouse and everything will work? I still don’t understand how I can do this, I don’t see who calls the methods and how the input works. Do I need to change anything in the CwInputManager and CwInput classes?
     
  24. ozgenaliekber

    ozgenaliekber

    Joined:
    Feb 21, 2021
    Posts:
    1
    Hi! Thanks for this great asset but i have a same problem in urp and vr on android build. Build failed with these errors

    Code (CSharp):
    1. Shader error in 'Hidden/Paint in 3D/Decal': undeclared identifier 'sampler_DepthTexture' at Assets/Plugins/CW/PaintCore/Required/Resources/P3dMasking.cginc(39) (on vulkan)
    2.  
    3. Compiling Subshader: 0, Pass: , Vertex program with P3D_LINE_CLIP STEREO_MULTIVIEW_ON
    4. Platform defines: SHADER_API_MOBILE UNITY_ASTC_NORMALMAP_ENCODING UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_RGBM_ENCODING UNITY_NO_CUBEMAP_ARRAY UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_RGBM UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION
    5. Disabled keywords: P3D_LINE P3D_QUAD P3D_QUAD_CLIP SHADER_API_GLES30 UNITY_COLORSPACE_GAMMA UNITY_ENABLE_DETAIL_NORMALMAP UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF2 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_VIRTUAL_TEXTURING
    Unity ver. 2022.3.4f1, Paint in 3d asset ver. GUIDE 3.0.3 but package manager 3.1.0 (also i delete all files in plugins and reinstall the asset)

    if i delete gi cache in preferences (few times) build can complete but shaders looking weird (like too dark or broken light baked)

    Thank you!
    Here is screenshot
     

    Attached Files:

  25. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    Alright, I'll send you a build hopefully within a few days.


    The CwInput___ classes are just wrappers around Input/InputSystem. If you want to integrate another input system then you will want to replace all these calls with your own.


    I'll try and release a fix for this soon. I'll send you a quick fix in a bit.
     
  26. TommyTheITGuy

    TommyTheITGuy

    Joined:
    Jun 11, 2015
    Posts:
    53
    I have a problem with using the P3DColorCounter. I'm using a simple reddish color on my painting tool (Replace Mode, decal with white quad, all channels 1, opacity 1, hardness 999) to paint the object (the object starts with a white texture), but the colors (RGB values) that P3DColorCounter reads from the paintable texture of the object are slightly diffrent and it doesn't count them towards the tracked P3DColor - it only does that whent the threshold is pretty high, 0.7+.

    I see the same problem on the example scene for Color Counter, the threshold has to be set to > 0.5 for it to track the used colors (even when replacing the mode on tools from Alpha Blend to Replace).

    How can I make sure that the Color Counter reads the colors I actually use on the object? Or how to make sure the colors applied to the object are only the colors I use?
     
  27. ddsinteractive

    ddsinteractive

    Joined:
    May 1, 2013
    Posts:
    28
    Does the Coloring Book Asset have a DOC section on your website yet? We already have the Paint in 3D asset and want to create a way to paint a 2D texture then apply it to a 3D model. It will be easier for the kids to figure out than painting on a 3D model I think.
     
  28. ddsinteractive

    ddsinteractive

    Joined:
    May 1, 2013
    Posts:
    28
    Hello! I have another question regarding the Paint In 3D. How can I paint over the top of an existing texture and still show that texture through. There are features on the 3D model that still need to be there, we're just trying to tint it. For example eyes on a creature, scales, stripes, etc that we still want to be shown, we just want to overlay/tint the colors to make them customized. Does that make sense?
     
  29. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    Does this issue occur in the "54 Color Counter" demo scene, or only in your project?



    Not yet. You can see the current documentation HERE.

    The main benefit of the 2D painting system is that you can paint Sprite Renderers.

    However, in your scenario this may not be necessary. For example, in Paint in 3D you can configure a quad to be paintable. You can then use a custom script to apply the quad's material (or just the texture) to your 3D object.



    The shaders that come with Paint in 3D allow override/overlay of textures using alpha blending only. I'll consider adding options to these shaders to change the blending mode. In the mean time you would have to use/make a custom shader that does this.
     
  30. ddsinteractive

    ddsinteractive

    Joined:
    May 1, 2013
    Posts:
    28
    Thanks for the heads up on this. I ended up making a mask texture and just masked out the eyes, stripes etc with that. Seems to work well so far.

    As I'm building a few other questions have popped in. For the tools, I want to first select a color palette (reds, blues, etc) and then turn on that palette in the Canvas. However, it seems like I don't know how to have the tools not be dimmed out. I'll re-examine some of the other demos to see if I can find this in the examples in the meantime.

    Second question, how do I save the painted PNG texture to a local folder (StreamedAssets). I'll need to send the finished painted texture over to another computer to display on a second device attached to a screen. Thanks again for your phenomenal support on these assets.
     
  31. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    1 - The demo button system that comes with Paint in 3D allows you to make UI images with the CwDemoButton component attached. You can see in almost all demo scenes this is used. These link to a 'Target' GameObject that the painting components are on for that particular tool, and each time you click that button it will activate the 'Target' GameObject, and disable all sibling GameObjects. Therefore, you must make sure all other tools are on the same parent GameObject. If this is broken you likely have some UI buttons that don't have any 'Target' set, or you have multiple tools activated at the same time, or something like this.

    2 - At runtime you must write a custom C# script to do this. The P3dPaintableTexture component has the GetReadableCopy() method which you can use to get a Texture2D (that you must manually destroy). You can load this texture into your P3dPaintableTexture using the Clear or Replace methods.
     
  32. ddsinteractive

    ddsinteractive

    Joined:
    May 1, 2013
    Posts:
    28
    I found the target and the parenting field. This is how I made the UI for it. I created six buttons for the color palettes then used a Activate command to show or hide the relative GOs. Works like a charm. Is it mandatory to deactivate the unused paints or can I keep them the full opacity color?

    My post must not have been clear. I won't be using Paintable on the other computer. Just need to load the saved texture onto an instantiated material and will load the PNG texture upon a gameobject spawn. I found the GetPngData function and will explore that.
     
    Darkcoder likes this.
  33. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    The UI Image opacity will automatically change based on the activation state of the Target, and if Link=Isolate then clicking on any of them will deactivate all siblings of Target. You can activate all targets if you want, but in the example scenes each target has paint components on them - therefore enabling them all will make your mouse/touch paint the same spot with many tools which in these scenes at least makes no sense.

    In any case, these are just example components. If you need different functionality then I recommend entirely replacing them with your own.
     
    ddsinteractive likes this.
  34. vladfomich123

    vladfomich123

    Joined:
    Mar 22, 2020
    Posts:
    6
    Hello! I have a problem. I draw something on the texture, then save it. Then I load this texture and draw something on top. I do undo and in theory my drawings should be canceled first, but instead my fully loaded texture is deleted first, what could be the problem?
     
  35. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    Are you talking about the in-editor painting features?

    These will very soon be replaced with a better system that doesn't have this issue. If you need a fix now I could send you an early test version?
     
  36. vladfomich123

    vladfomich123

    Joined:
    Mar 22, 2020
    Posts:
    6
    This happens during the game itself, that is, I draw in Unity in playmod. If this is a global update, then I guess I can wait. But if the problem is in one or more components and you can send me a replacement, I will be grateful to you.
     
  37. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    If you're talking about the in-game painting features then you must manually call the PaintIn3D.P3dStateManager.StoreAllStates(); method from your code before you perform an action you want to be able to undo. For example, the P3dHitScreen component calls this each time you press the mouse/finger down, so that any paint later applied as you drag you finger can be undone.
     
  38. vladfomich123

    vladfomich123

    Joined:
    Mar 22, 2020
    Posts:
    6
    Do I understand correctly that enabling StoreState in the inspector for the P3DHitScreen component is incorrect? Because that's exactly what I did
     
  39. Alex_Heizenrader

    Alex_Heizenrader

    Joined:
    May 16, 2019
    Posts:
    86
    I am getting constant spikes and am not sure what the issue is. There are about 14 paintable objects in the scene and each has a channel counter. If I remove the channel counter the spikes go away. upload_2023-12-20_8-24-14.png
     
    Last edited: Dec 20, 2023
  40. Alex_Heizenrader

    Alex_Heizenrader

    Joined:
    May 16, 2019
    Posts:
    86
    I did a deep profile, here is what it shows, not sure what the 80k calls are (per pixel calls?)
    upload_2023-12-20_8-28-41.png
     
    Last edited: Dec 20, 2023
  41. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    P3DHitScreen will automatically call PaintIn3D.P3dStateManager.StoreAllStates(); if you enable the Advanced/StoreStates setting. I was just giving you an example of a component that calls this.

    If you manually make a change to paintable textures (e.g. Loading a texture), then you must manually call PaintIn3D.P3dStateManager.StoreAllStates(); before you make any changes you want to be able to undo.

    The counter components all copy texture data from the GPU to CPU, and then count the pixels. To reduce the amount of pixels copied/read, you can increase the DownsampleSteps setting, which by default is 3 (i.e. 1024 texture -> 512 -> 256 -> 128 = 128 x 128 pixels = 16384 pixels).
     
  42. vladfomich123

    vladfomich123

    Joined:
    Mar 22, 2020
    Posts:
    6
    I look at the HitP3dScreen code and the P3dStateManager.StoreAllStates() call is already implemented there.
    If I were doing my own challenge I would do the same.
    This won't solve the problem. I'll describe it again.
    I enable the Advanced/StoreStates setting, then load the texture into the game using _p3dPaintableTexture.Load("Name");. If I then call _p3dPaintableTexture?.Undo(), then nothing will happen, but if I draw something on top and then call _p3dPaintableTexture.Undo(), then both the last drawing and the loaded texture will disappear.
     
  43. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    As I said originally, you must call P3dStateManager.StoreAllStates() before you perform any changes you want to be able to undo. Calling Load() is a change, therefore you must call P3dStateManager.StoreAllStates() before you call it. Forget everything else I said.
     
  44. beard-or-die

    beard-or-die

    Joined:
    Jul 12, 2017
    Posts:
    6
    I already have Paint in 3D and as of yesterday there is a new asset called Paint in Editor. Can't I already paint in editor with the original asset? When I go to the docs for the new one it just points to the original docs. Could someone explain?
     
  45. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    Version 4.0.0 of Paint in 3D removes all in-editor painting features. These features have been completely rewritten and improved for the new Paint in Editor asset, and all customers who purchased Paint in 3D before December 2023 will get it for free if they go to the Paint in Editor page and download it.
     
  46. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    Merry Christmas everyone, Santa came a little late with these presents:

    Version 4.0.0 of Paint in 3D is now out!
    • WARNING: This is a massive update that includes file structure changes, so before installing you should delete the "PaintCore" and "PaintIn3D" and "PaintInEditor" folders.
    • Removed in-editor painting features (customers prior to the release of this version can download the new Paint in Editor asset for free).
    • Renamed all scripts to have Cw prefix instead of P3d prefix.
    • Renamed Paint in 3D window to Paintable Objects.
    • Renamed P3dPaintable to P3dPaintableMesh.
    • Renamed P3dPaintableTexture to P3dPaintableMeshTexture.
    • The Material Cloner is no longer required.
    • The Seam Fixer tool has been replaced with the Mesh Fixer tool.
    • The new Mesh Fixer implements UV unwrapping.
    • The new Mesh Fixer can fix meshes that go outside the 0..1 UV range.
    • The Preset system is now much simpler and intuitive to use.


    Version 1.0.0 of Paint in Editor is now out!
    • Completely rewritten from scratch.
    • All painting is done in screen space with depth masking.
    • All painting is done in the editor Scene window (no play mode).
    • No scene modifications required.
    • Includes new Mesh Unwrapper tool so you can paint any mesh without changing shaders.
    • Creating new paint tools is much simpler.
    • Adding support for custom shaders is much simpler.
    • Free for customers who purchased Paint in 3D before December 2023.
    • New YouTube tutorials (more soon).





    As mentioned, you will have to delete your old PaintCore/PaintIn3D/PaintInEditor folders before upgrading. However, your existing scenes should automatically work with the new changes.

    If anyone encounters any issues, please let me know!

    Enjoy :)
     
  47. Davidnovarro

    Davidnovarro

    Joined:
    Oct 6, 2015
    Posts:
    21
    Hello, I'm getting this exception right after importing the asset. What could cause this issue?

    Scene name: Dripping Paint

     
    Darkcoder likes this.
  48. linenum

    linenum

    Joined:
    Nov 16, 2020
    Posts:
    56
    Hi I was wanting advice about how to upgrade a project to version 4 from a version using P3d. Should the P3d, etc, scripts be deleted first? If I did that I guess all of the P3d components in the game objects would be broken (and I have a large number of them). I really really really wish the P3d names weren't changed to Cw. The new name isn't really an improvement to clarity, etc. I'd even pay some money to not have to have that change. So I was upset with the Christmas present.
     
    Last edited: Dec 27, 2023
  49. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,389
    Thanks, I sent you a new build via email.


    The scripts have the same GUIDs, so changing their names doesn't break anything. This change was done because I plan to soon release Paint in 2D which uses the same base code, and having all the scripts be called Paint in 3D might have been confusing.
     
  50. linenum

    linenum

    Joined:
    Nov 16, 2020
    Posts:
    56
    Ok I see. Anyway I was wondering how to upgrade - do I just delete everything in the old /Plugins/CW/ then import version 4? Note I'm using 2.0.3 and unfortunately hadn't been keeping the plugin up to date.... Another idea - maybe I could move the old plugin to something like /Plugins/CW-old/ then import version 4 and update the old game code and game object components... ??? Or is it easier to upgrade if I upgraded to the version 3 package first (which I don't have) Thanks!
     
    Last edited: Dec 29, 2023