A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Assets and Asset Store' started by Darkcoder, Jul 10, 2018.
Thanks for the info, that helps a lot.
Hello, the version of the plug-in I use now is 1.5.3. Unfortunately, I have modified some code of the plug-in so that I can not update to the latest version, because it is inconvenient. Now I have a problem that when I move my finger or mouse quickly, the brush will draw a little separated circle instead of a straight line. How can I fix this problem? I see that the latest version of the plug-in will not have this problem.
Hello, the version of the plug-in I use now is 1.5.3. Unfortunately, I have modified some code of the plug-in so that I can not update to the latest version, because it is inconvenient. Now I have a problem that when I move my finger or mouse quickly, the brush will draw a little separated circle instead of a straight line. How can I fix this problem? I see that the latest version of the plug-in will not have this problem...
Version 1.5.3 of Paint in 3D still has this ability. If you're painting in-game, then the P3dDragRaycast.DragStep setting allows you to control the pixel distance between each paint when you drag the mouse/finger. If you're painting in the editor, then Painting tab > Drag Step allows you to control this.
I just tested the transparency bug I was having with the replace blend mode.
When using a paint decal component with a decal that is using a texture with its alpha source set as input from texture alpha, and the shape as the circle 50 image. Transparency is lost (filled with white) when the only group being painted on is the paintable objects _MainTex property.
I am not sure if the white filling in where there should be transparency is from circle 50 or from the source texture. The expected behavior would be for transparency to be preserved.
(Only seems to happen when using the MainTex, setting it to a group is important to replicate).
Can you post a picture of your settings and textures? I don't think there's any issue with the Replace blending mode, perhaps I just didn't explain what it does clearly enough in the documentation.
Replace will Lerp between the current surface RGBA value and the RGBA value of your paint Texture, using the Shape's alpha channel as the Lerp weight. If your paint texture is transparent, then the fully transparent pixels (A = 0) will potentially have unexpected RGB values such as white. The "Decal 3" texture for example of the duck has the "Alpha Is Transparency" setting enabled, which causes the edge of the transparency (A > 0) RGB color to be stretched to the edges of the texture, which in this case is white. This means painting this duck texture using the Replace blending mode with the "Circle 50" shape results in the transparent parts of the duck being drawn as white as expected, because those are the RGB values outside of the main duck shape.
Hello, when I use the brush, because our need is not to use the position of the finger or mouse to spray, but to spray with the center of the screen, so we call the paintat method in update, when the unit camera moves too fast, there will be intermittent points, can not be connected into a straight line, I set dragstep to 0, so how to solve it?
Hello, I found a problem, that is, to keep the logic of spraying with the mouse or finger, and then move the camera while spraying, there will be intermittent situation. If you don't go to the mobile camera, you won't have this problem. Is there any way to paint while moving the camera?
I'm ready to buy this! One question though for the developer ( @Darkcoder), or someone who knows if this is possible, but I definitely want the developer's response as well: Can you create a trigger event once someone paints within a certain boundary on the surface mesh? For example, lets say I made a game where I make the user paint on a mesh, but once they paint in an area that I've made into trigger area, then the paint changes color, or an object spawns. Can I do this using this Paint in 3D app?
Sorry for the incredibly late reply!
There's currently no feature in Paint in 3D to fix the painting gaps in your scenario. I plan to include a new painting method that paints between two points without any gaps, and this could be used in your scenario to fix the issue. Implementing this is a little tricky though, so I will have to experiment a little before I can release it.
There's currently no feature like this, and it sounds like something very game specific so I'm not sure if there ever will be. However, you could implement it quite easily using the P3dSpawner component and a little bit of code. P3dSpawner works like P3dPaintDecal and other painting components, except instead of painting it spawns a prefab at the hit/paint location. For this prefab you could use a kinematic rigidbody that is set up to only trigger your triggers, and then you run your special code when you detect this trigger entry.
If you can describe a scenario where this would happen and other users might find it useful in a demo scene then I could make it though.
Congrats on a really nice, clean implementation that does almost everything it claims. I have a question: Once I have painted a texture, if there a simple way to clean it? I.e paint to the same UV-coords with say completely transparent? I don't appear to have been able to get this to work so far. Thanks
A few more details: Using the spray paint test scene for setup. I have a Skinnable Mesh that I am painting. This mesh has UVs for the standard albedo texture in the mesh. I just generated the skinned mesh collider every frame for testing. Object has 3d Paintable Texture, 3d Paintable and Material cloner on it. I am using UV 0, group 0, ARGB32 texture for painting.
Second thoughts: How about just a secondary, pre-made overlay texture for the current model that can be alpha'ed out to reveal the primary diffuse texture?
1 - To clear a texture you can call the Clear( ... ) method on the specified P3dPaintableTexture. It would probably make sense to add an additional component that can store this initial texture + color state, and clear it when requested. This way there would be no code required.
2 - This sounds similar to the "Overlay" and "Overlay Cutout" materials that are in Examples/Materials, and are used in some of the demo scenes. Simply add these as the second material to your model, set the P3dMaterialCloner + P3dPaintableTexture to use material index/slot 1, and it should work.
hello . thank you for your good asset.
but i have some problem
my project have a lot of objects, meshs
they don't have uv0 data, so i have to do Coord Copier myself
it's realy boring works
i have to do Coord Copier, darg mesh to mesh filter one by one..
i wanna ask you , do you have tool to do this things.
select object and do coord copier to all of child objects
i write code about this myself
to do this, i had to change some codes of this asset.
this code is poor, but it works
this codes support doing coord copier, fix seam object and childs of that.
also moving 'worked mesh' to mesh filter is supported .
This sounds like a good idea. I could combine both tools and allow them to convert multiple meshes, and also automatically replace references or something.
thank you for replying
maybe there is a lot of people want this tool like me
I just updated from 1.6.1 to 1.6.4 and ran into a problem. My pre-existing P3d scenes are now giving this error:
"NullReferenceException: Object reference not set to an instance of an object PaintIn3D.P3dPaintableManager.UpdateAll () (at Assets/PaintIn3D/Scripts/P3dPaintableManager.cs:68)"
There is no error when playing a loaded scene directly. This only occurs when loading the scene via
This will be fixed in the next version, I'll send you an early build in a little bit.
Could you make multi layered system for paint decals ?
When i select a decal layer that i was painted before, i can delete it immediately !
I'm not sure I understand, you can already create a multi-layered painting system by using multiple materials, as long as each layered material is transparent. I don't think any of the example scenes demonstrate this though, that's something I should fix!
Sorry for my comment. I mean,
When you paint decal A to the car, decal A will save to the X list.
When you paint decal B to the car, decal B will save to the X list.
When you paint decal N to the car, decal N will save to the X list.
Decal A, B,...N can show to the UI. And user can select decal B, or D to remove it from car paint texture.
I think X list that save decal A, B, ... N like decal layer system that user can select any decal to remove it or reuse it.
I see, this requires you to store a list of all painted decals, and to repaint the object using this list every time you make a modification. This can be tricky to implement depending on your scene setup though. I plan to make a demo scene showing how to do this, but I currently have quite of lot of other tasks to do first.
While testing with different game resolutions, an issue has come up. The P3dPixelCounter values change with the screen resolution. I'm using downsampling and I'm assuming that mipmapping is also accounted for. What am I missing here?
Game resolution should have no impact on the pixel counter, and mip maps aren't used for this. However, it may impact the way paint is applied if you use the P3dDragRaycast/Smooth component, because different resolutions will have different pixel densities and such, so the calculations will differ slightly. How much of a difference are you noticing? And in what scenario is this an issue?
Yes, I'm using the P3dDragRaycast/Smooth. What's happening is my if-then code is checking pixel counts:
if (innerFabric.GetComponent<P3dPixelCounter>().TotalR > 13000)
fabricDone = true;
spoolCheck.GetComponent<MeshRenderer>().enabled = true;
On an iPhone 8 Plus it works great, but on an iPhone 5S it fails to reach the pixel count. On an iPad Pro 12.9 it triggers too soon. The difference is about 15% or 2,000 pixels in the example above.
Edit: Sorry, just regular P3dDragRaycast, not Smooth.
That sounds like quite a difference, are you sure each object has visually been painted the same amount? What components are you using to do the painting? You can also display the final textures on screen or similar to see where the extra pixels might be coming from. You can also try painting a simpler mesh and gradually add complexity to see at what point the differences start to appear.
I'm using the P3d Paint Decal component and I traced this down to the "One Sided" option. Changing that to 0 brought the pixel numbers much closer together, and changing the depth from 0.1 to 100 makes them identical but I guess that's to be expected. My guess is that polygons at oblique angles to the camera cover wildly varying pixel amounts, depending on the screen rasterization. That would also explain why painting around the edges was unreliable.
With a bit of geometry tweaking, this is now solved. Thanks for your time and help with this.
Ah, dual sided painting can indeed easily result in unexpected pixels being painted. For the next version I have rewritten the dual sided painting implementation to make it hopefully be clearer and a bit more flexible. The main scenario where the pixel counter can fail is if you have triangles inside your model, because it's still possible to paint them depending on where you paint your model, but externally it will be impossible to see if you painted these triangles or not.
If I have a bunch of unique meshes that all use the same material with their own dedicated UV place, can I get away with not having to clone the material for each object? If I have to add material cloner on all objects it wouldn't be good for performance I assume.
In this scenario you should set up one object with P3dPaintable + P3dMaterialCloner + P3dPaintableTexture, then in the P3dPaintable.OtherRenderers list you can drag and drop all your others in, then add the P3dModel component to all the others, and then link the P3dModel.Paintable to the first P3dPaintable.
There are some obvious limitations to this, like the 'OtherRenderers' must exist at the time the material is cloned, otherwise you must manually copy the cloned material over after you spawn a new other renderer. Also that you can't delete the original paintable object, but you could make some kind of dummy object to handle this.
Also keep in mind the painting performance depends on the size of your texture, so depending on your game you might get better performance by splitting the UV up for each object so they all use smaller textures.
Hey Darkcoder, great plugin!
It seems I have an issue where a custom texture I'm painting is blurred/resampled with every new stroke I made. The older the stroke the more it get's blurred and blurred. If I set the paint texture to unfiltered it doesn't do it so I guess it has something to do with the custom texture being reinterpolated with bilinear blurring.
I'm using fairly small textures to paint on but it still shouldn't do that right?
Maybe I'm just missing a setting somewhere? (I'm painting in editor/scene view btw)
I see you posted on a similar issue a page back in the thread and found a solution for it, is that part of the latest build on the unity store?
This shouldn't happen, but there might be scenarios where it could. I need much more information, like: what size textures are we talking about? Which exact version of Unity? Which build platform do you have set? Which paint settings are you using (like paint technique and blend mode)? What texture format are you painting?
Hello! I already wrote few emails, but thought if there's anybody out there who has same problem as me, thought it'd be helpful to write in the thread instead.
So I successfully made the painting work using the example file the plugIn provided. I want the painting function to work in VR, so I first put in FPS controller to test the painting works while the camera is moving. I get dots but no lines!
Carlos, you mentioned that I can use P3dBetweenRaycast. I tried to replace Drag Raycast to this one, but no positive result. Is P3dBetweenRaycast a UI? How do I replace it from Drag Raycast Smooth?
Does anybody have experience of using this function with HTC Vive controllers? What I want to do is to paint on the walls as the player walks around the scene.
Thank you so much!
P3dBetweenRaycast doesn't use the UI, it just continuously raycasts between the two Transform points you specify. These points should be attached to your controller, or a tool it is holding. Make sure you add P3dPaintSphere or another painting component to the same GameObject.
Lets say I have a sphere collider trigger with a rigidbody that is acting as an enemy bullet. What is the best method of adding paint 3d to this so that when it combines with a building it does damage and smoke and something similair when it hits a person.
A pre-buy questions to be sure it's fitting my requirements, I'm almost sold on your asset but I couldn't read all the forum pages in details and the documentation is clear but I might have missed things
So it's only about runtime painting:
I have a room with a large floor, that is normally composed of many 1x1 tiles (a simple plane that is 1x1x1). I say normally because I might change it to a single large plane depending on your answer.
My gameplay need here is simple, if you played stardew valley you'll get it: the player character walks in front of a tile and press whatever button that will turn the 1x1 dirt tile texture to a ready to use 1x1 earth tile texture. And he can do that for any 1x1 tile around him
As all those 1x1 planes share the same material, is it a problem? or would I be better having a large plane
The second follow up question is: is there a way to get the texture used on a tile/position, let say I make a script that raycast down where my mouse cursor is and it will inform me that the texture at that position is dirt or earth?
Thank you by advance, I cross my fingers that this will work out with "Paint In 3D" and will buy straight away
Since triggers don't have hit points, I recommend you use normal collisions for this scenario. Then you can use the P3dOnCollision component to paint your objects based on where they hit. If you must use triggers then you can manually call the HandleHit method when you detect OnTriggerEnter, it's up to you to decide what the hit normal would be though.
1 - Having all the tiles share a material or texture is not a problem, since Paint in 3D will automatically duplicate it for you when painting. If you want to keep them shared then you must UV map each tile to a different area of your texture, otherwise painting one tile will also paint all other identical tiles the same way.
2 - You would have to keep track of this yourself, since Paint in 3D has no knowledge of what is being painted. You 'could' do this with the provided components if you make one material layer per paint type, and use the P3dPixelCoutner to see which layer has been painted, but this would probably be an inefficient solution.
So p3doncollision on the projectile which is interacting with a paintable component on what it's hitting?
Yes, this setup is used in quite a few of the demo scenes. For example, the "Shield Impacts" scene uses P3dOnCollision to trigger P3dDestroyer (to destroy the bullet/asteroid), P3dSpawner (to spawn the explosion effect), and P3dPaintSphere/P3dPaintDecal to actually paint the hit object.
Thank you so much for your reply! So I would need to write a script similar to P3D Input Manager script, but replacing "Finger" to for example "Oculus Rift Controller (right hand/left hand)"? Is there somebody out there working with Paint in 3D with Oculus rift controllers??? I don't seem to find the right script to add to the controllers. Any help will be greatly appreciated.
Yes that's right. How to implement this depends on the VR asset you're using. If you're using VRTK then you will need to make a new component that inherits the VRTK_InteractableObject class, and you can override the StartUsing and StopUsing methods to handle the paint trigger.
i brought your asset several weeks ago.
but i can not figure out how to use Tessellation on the decal with this asset.
can you teach me how.
You use it the same way you would use any tessellation shader, simply apply it to your mesh renderer. Paint in 3D doesn't care what shader you have applied to your materials, all it cares about is the mesh position + UV data, and which textures you've set up to be painted.
Actually i am talking about tessellation on decal paint. If I can have tessellation on decal paint, then the wound paint can have depth effect. Can we do that?
Yes, because you would be painting the texture used by the tessellation shader when rendering. Paint in 3D simply allows you to paint textures used on your materials, so it will work with any shader.
I just started receiving the following error message when I stop Play mode:
Can't remove P3dPaintable (Script) because P3dPaintableTexture (Script), P3dMaterialCloner (Script) depends on it
It only shows up when I stop Play mode in the editor. Do you attempt to remove P3DPaintable anywhere in your code?
Wow. You can disregard my message above. I had installed the Allegorithmic Substance plugin and was playing with some new substances. In addition to breaking something with your asset, it also broke my Unity Editor. Anything I selected in the hierarchy become deselected when I pressed Play. So basically it destroyed my ability to lock on a gameobject in scene view. I deleted the Substance plugin and all of the problems went away.
Sounds like a bad bug, perhaps that version of the plugin isn't compatible with your version of Unity. I doubt they designed it to break the scene
Hello. Congratulations for such great asset. Nice work.
I have one problem at the moment. I can not paint whole mesh to the edges.
I have uploaded two screenshots with the effect I am getting.
Each triangle here is separate mesh. I am not able to paint the edges. Texture size on each triangle is small like 50x50.
Is there any possibility to fix this issue?
You must run your meshes through the Seam Fixer tool to remove these.