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

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    189
    Does this allow painting materials? Like can a decal have a PBR shader on it Albedo, SpecSmooth and Normal? Is it compatible with custom shaders like amplify shader?

    EDIT: My bad i missed the image in the store page, though still i'm wondering about custom shader support!

    EDIT2: ALSO! I was wondering does this work with a sprite sheet type layout? Or is it individual images?
     
    Last edited: Oct 23, 2019
  2. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    Yes, Paint in 3D works with any shader, including custom ones from Amplify. You can also paint multiple textures at the same time, and the "PBR Painting" demo scene (among others) shows you how to do this. The only thing you must keep in mind is that the painting itself is applied using the mesh data, so if your custom shader modifies the mesh vertex positions, then the paint may not look like it appears in the right place, because Paint in 3D doesn't know where your modified vertex positions are. If you only have minor modifications like subtle displacement then this shouldn't be an issue though.

    The decal painting feature works using a Texture, not a sprite, so it will ignore any sprite sheet layout you have. As long as your decals are originally separated and you rely on Unity to pack them into an atlas, there should be no problem.
     
  3. ARideout

    ARideout

    Joined:
    Sep 7, 2017
    Posts:
    7
    I have a question regarding implementation of an almost reverse gradually fade effect. I'm looking at creating an effect where as you paint, your paint appears slowly over time. Ultimately I am using the painted texture as a mask in a custom shader. My implementation has the red channel function as a mask for blending textures, and I would like to use the green channel to slowly fade in so I can use it to drive strength of normals/displacement for a kind of growing effect. Effectively the green channel fades in to match the red channel over time, though preferably doesn't overshoot? Is it better to try to achieve this effect using two separate textures and feed the first (actively drawn in runtime) into a modified fadegradually script as the texture argument for PaintFill.Blit? Or could I do something similar with individual channels of a single texture as I currently have set up? Would performance be particularly different either way?
     
  4. ARideout

    ARideout

    Joined:
    Sep 7, 2017
    Posts:
    7
    Actually scratch that, it seems as though just using the gradually fade component in additive mode with the color set to green appears to work for my current setup.
     
    Darkcoder likes this.
  5. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    Glad you found a solution!

    There are some complex scenarios where things should gradually fade based on a separate texture, and there currently isn't any component to handle this. For example, you could have it so painting one texture channel acts as 'heat', and when this value reaches maximum it begins painting to another channel like 'damage', and that eventually results in holes being cut into the mesh. Another scenario is having paint drip over time, but have the drip speed slow down as it moves. I plan to add features like this, but I think it would require one component/shader per effect type, and it wouldn't make sense with the current blend mode setup. I'll have to think about it!
     
  6. jesusluvsyooh

    jesusluvsyooh

    Joined:
    Jan 10, 2012
    Posts:
    346
    Hi, i am trying to paint on multiple layers, switching between slot 1 and 2, for example, however everytime i change the slot number its always painting on same layer as before.
    Please guide me to correct way or what i might be doing wrong, thank you. :D

    Screenshot 2019-10-24 at 17.21.40.jpg Screenshot 2019-10-24 at 17.21.47.jpg
     
  7. ARideout

    ARideout

    Joined:
    Sep 7, 2017
    Posts:
    7
    The solution I found is somewhat of a hack. The gradual fade script slowly floods green additively into my texture. The actual paint is simply painting red on top of the background covering the green, then the gradual fade slowly adds green back to these areas giving the illusion of the effect I am after which works since I using the red channel as a mask. A side effect of this is if you paint over an old area, it resets the green again and doesn't build upon it. The scenario I am working with is a sort of drying effect. Fresh paint is painted on the surface and over time it "dries out" and "expands". This drying/expanding is simply modifying normal map strength and displacement (though might nix the displacement unless I can get tessellation working in the lwrp on android) as well as the specularity. So ultimately the hack somewhat works, but wouldn't get a building look as far as the expansion.
     
  8. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    If you're changing the slot in game then you must call the UpdateMaterial method after, this will update the cached material reference.


    Interesting, expanding paint could be done by gradually increasing the paint opacity up to some value, and using a cutout or similar threshold shader. I'll add it to the to-do list alongside the other effects I mentioned :)
     
  9. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    Which version of Unity and Paint in 3D are you using?

    In version 1.7.2 I fixed a bug like you describe, where the counter components would produce inconsistent values under some circumstances.
     
  10. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    Great! You can see the version inside the documentation under the Versions list.
     
  11. jesusluvsyooh

    jesusluvsyooh

    Joined:
    Jan 10, 2012
    Posts:
    346
    Hi, whenever i change the slot index number, and call UpdateMaterial, the other layer goes black or white, materials with textures loose textures or both layers start showing the material being painted on.

    Used Scene '28 Paint On Top', as my template scene, used the 'clear' material already on there and renamed layer 1 and 2, and added to the material slots.
    Paint on layer 2 (index 2), then switch to index 1 and call UpdateMaterial, now it should paint under layer 2 but it paints ontop and then the slots all go black and white etc, like i mentioned above.

    I am not sure if these are bugs, a layer example scene would be great! :)
    I am on latest Paint in 3D, latest 2019 Unity.

    Material setup
    Screenshot 2019-10-25 at 18.13.35.jpg

    Quick buttons to update material and switch between slot.index layer 1 and 2.
    Screenshot 2019-10-25 at 18.22.53.jpg
    Painting on layer 1 makes layer 2 go black
    Screenshot 2019-10-25 at 18.13.31.jpg

    Switching to layer 2 makes layer 1 go white and removes its paint
    Screenshot 2019-10-25 at 18.00.18.jpg
     
  12. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    Thanks for the info, I'll have to test this after the weekend!
     
  13. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    I had a chance to test this and wasn't able to reproduce the pink material issue you saw, though I did notice the P3dMaterialCloner is set to the wrong Index (should be 1). If you're using two materials then you also need a second one for your second layer (index 2).

    That said, this scenario doesn't work because the P3dPaintableTexture component creates and manages its own texture. If you change and update the slot material then it will just put the current painted texture in the new material slot you specify. This wouldn't allow you to selectively paint different textures, nor do I want to change this component so it works like that.

    To paint multiple layers I recommend you use multiple P3dPaintableTextures. To pick which texture gets painted to you can use the P3dPaintableTexture.Group setting (works just like layers), where each painting component also has a Groups setting that must match. If you don't want to use groups then you can just enable and disable the P3dPaintableTexture components depending on which layers you wish to paint.
     
  14. jesusluvsyooh

    jesusluvsyooh

    Joined:
    Jan 10, 2012
    Posts:
    346
    Thanks for replying, this was the other way i was going to try :D
     
    Darkcoder likes this.
  15. VadymPetruk

    VadymPetruk

    Joined:
    Sep 3, 2017
    Posts:
    3
    Hi Darkcoder!

    Can you please give short explanation about magic happens on next part of shader "Hidden/Paint in 3D/Sphere":

    Code (CSharp):
    1.                   o.vertex   = float4(texcoord.xy * 2.0f - 1.0f, 0.5f, 1.0f);
    2.                     #if UNITY_UV_STARTS_AT_TOP
    3.                         o.vertex.y = -o.vertex.y;
    4.                     #endif
    I'm trying to understand how to compute position of target render texture pixel. As I understand, shader directly uses UV coordinates of mesh and map it (with some magic) to render texture. But I'm stucked on this magic :)

    Thanx in advance!
     
  16. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    This part of the shader vertically flips the UV coordinates, which is necessary for compatibility between different rendering APIs. You can read more about it HERE.
     
    VadymPetruk likes this.
  17. kripa1415

    kripa1415

    Joined:
    Oct 3, 2016
    Posts:
    2
    Hey Carlos,

    Thank you so much for this great asset.

    I'm facing an seam issue. When i do a seamfix to the character face, the blendshape which contain all the face animation disappears. Is there a way i can fix the seam without losing the animation ? thank you
     
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    Could you private message or e-mail me (in documentation) this mesh so I can test and fix the issue?
     
  19. KishoreMayilsamy

    KishoreMayilsamy

    Joined:
    Aug 23, 2019
    Posts:
    1
    Thanks Carlos. Sent you an email.
     
  20. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    5
    Hey Carlos, I'm having a little trouble trying to get the preview of Decals working with Hit Between. The painting itself works -- i.e. when I click on the object -- but the preview doesn't show.

    If I just add the required scripts to an empty scene, it doesn't work. However, when I change the "Normal Back" option of the Paint Decal script above 0.001, the preview decal shows, however, it's mirrored along the X axis.

    You can see this in the attached image. The large cube is the paintable, and the small cube is where my "Point B" is located. Point A is the camera.

    Similarly, if I change the "08 Decal Painting" example scene and replace the Hit Screen script with Hit Between, I get the same issue. I use the camera as Point A and the spaceship as Point B.

    Also, while I'm here, is there a way to get the decal to stop blinking using Hit Between? I have my Interval set to 0.

    I've test on Unity 2018.3.11f1 and 2019.2.10f1 using 1.7.3 and 1.7.1. Cheers
     

    Attached Files:

  21. Darkcoder

    Darkcoder

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

    Version 1.7.4 of Paint in 3D is now released!

    This version adds many new demo scenes, the most interesting of which is perhaps "Dynamic Decal", which shows you how to type in text, and then paint it on your objects.

    This version also adds the new "Replace Original" and "Replace Custom" blending modes, with associated demo scenes. These blending modes allow you to more easily 'undo' paint to your object, without the need for multiple layers.

    WARNING: I rewrote the blending mode code in this version. This means you will have to pick your blending modes again, unless you already picked (Alpha Blend/Alpha Blend Advanced), which is the default.


    P3dHitScreen automatically toggles between real and preview painting based on mouse/finger/key interaction. However, P3dHitBetween isn't based of any controls and it simply paints between two points. This means you must manually toggle the Preview setting to switch between real and preview painting. I could add key support to this though, as I can see how it would make sense. It sounds like maybe you added some code to toggle this yourself?

    Regarding the cube, you can't paint the standard Unity cube properly, because it uses the same UV data across all 6 cube faces. In the new version I included a new "Separated Cube" mesh, which solves this issue.

    Good point about the blinking. Currently P3dHitBetween paints in FixedUpdate, and the preview is cleared in Update. If these go out of sync then it will blink. I'll add some settings to allow painting in Update, or just the preview. Same issue with the P3dHitNearby component.
     
  22. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    5
    I don't think I understand what you're saying. Let me clarify the issue.

    I only need P3dHitBetween to show a preview of the decal on the model (I don't use it for actual painting). When I do this, I can't get the decal to correctly appear on the model unless I increase the Normal Back value. But when I do this, the decal appears mirrored along the X axis.

    Here's a screenshot of the modified "08 Decal Painting" scene. All I did was added a HitBetween on the Paint object and configured the Point A/B. You can see that the duck is mirrored when using HitBetween. On the other hand, if I just use the HitScreen, it'll paint the correct orientation -- i.e. duck facing right.

    upload_2019-11-13_13-17-49.png

    I've already got a way around this, but if there is a reason behind this or if I'm missing something, I'd appreciate the explanation. Cheers
     
  23. ktpttd

    ktpttd

    Joined:
    Aug 2, 2017
    Posts:
    4
    Hello there,
    I have a problem with Percentage Counter.

    As we see, It's counted 100% when the Spaceship is not fully covered.
    I didn't modify anything in scene(31 Paint Percentage).
    I'm looking forward to hearing from you.
    Thank you!
     
  24. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    Sorry for the late reply!

    Thanks for the screenshot, I can confirm the issue. I just checked the code and it looks like the hit normal used by P3dHitBetween is backwards compared to P3dHitScreen, oops!

    This can be fixed by modifying P3dHitBetween.cs line 88 to:

    Code (csharp):
    1. var finalNormal   = normal == NormalType.HitNormal ? -hit.normal : ray.direction;
    This does look wrong though, so perhaps the decal drawing code itself is backwards. I'll fix this in the next version!


    It looks like you're using an older version here. In the latest version I fixed a bug with the counting system, and it should now be very accurate :)
     
    jimmying likes this.
  25. dheerajbreddy304

    dheerajbreddy304

    Joined:
    Feb 18, 2018
    Posts:
    6
    Hi, will this work for LWRP?
     
  26. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    Yes, painting and most demo scenes work in all pipelines.

    The PBR demo scenes require you to upgrade the Standard shaders though. I will fix this soon and make it a bit easier.
     
  27. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    189
    For some reason when using a particle system collider on a skinned mesh with "paint decal" I get the reverse paint impact from what i expect.

    It seems to work fine with sphere paint like the example, but it gives backwards results with paint decal which has what i need. For example, if the particle hits the chest from the front, the decal will paint on the back.

    Also the seam issue is really pronounced when using a PBR decal with a normal map... :(

    Seems the script forces a normal map to be read as a sprite instead of a normal map.
     
    Last edited: Nov 25, 2019
  28. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    The backwards particle normal issue is fixed in the next version, and is currently under review. I can send you an early copy of the next version in a little bit.

    As for normals, the current normal painting doesn't take into account the orientation of the surface, so if you paint a seam where both sides have different UV directions then you will notice a seam. Recent changes to the painting system make fixing this easier to do though, I'll implement this very soon.
     
  29. Darkcoder

    Darkcoder

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

    Version 1.7.5 of Paint in 3D is now out!

    Also:

    50% OFF during Black Friday!

    This new version includes some nice bug fixes, and full SRP support without the need to manually upgrade shaders (eww), but most importantly, new demo scenes!

    In particular, I decided to make a more realistic demo scene than the others. This demo scene shows you how to implement HVLP style paint spraying of a car wheel in VR using Unity XR (bonus points if anyone can guess what wheel it's based on). I recorded a quick video of it with a slight twist :D



    Enjoy!
     
  30. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    189
    Awesome!

    And what if I want a single particle source to have many various possible decals to paint? Like how a bullet shot will have various blood splatters?
     
  31. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    You can add the P3dModifyTextureRandom component to your paint GameObject (e.g. the one with the P3dPaintDecal component). This component stores a list of textures you can specify, and the decal texture will be changed to a random one in this list when painting :)
     
  32. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    325
    Hello,

    I have a question - What is the requirement for this asset to work if I want to add blood decals on my skinned mesh at runtime, when the character gets hit. Its also about 35k polygons and can wear armor (separate skinned meshes).
     
  33. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    The only requirement is that your mesh must be UV mapped such that each triangle is within the standard 0..1 range without overlapping (e.g. no mirrored areas, or tiling). Paint in 3D comes with the Mesh Analyzer tool, which allows you to quickly see if your mesh meets these requirements, and which areas need to be adjusted.

    If your mesh for some reason can't meet these requirements, then as a placeholder you can enable generation of lightmap UV data in the mesh import settings, and then use one of the UV2 shaders that comes with Paint In 3D to display your paint on top.

    For best results though (e.g. final release), I recommend you manually UV them, because automatic UV generation will tend to waste a lot of texture space.

    Performance shouldn't be an issue with 35k tris, but lower detail will of course be faster, so you can always paint a lower LOD level, and use the same painted texture for the visual mesh. I will include a demo scene for this scenario in a future version.
     
  34. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    325
    Okay so it works with custom shaders as well? I dont get how the whole painting is done... do I need to have a mesh collider? What kind of components are required on the skinned mesh renderer for it to work? Can these components be added on the root object? Is it possible to paint blood on the "hit" point of the mesh?
     
  35. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    Yes, it works with any shader. The painting itself is done with the visual mesh though, so if your shader modifies the vertex positions a lot then the paint will appear in the wrong place, because the paint doesn't know how your shader modifies the vertices. This isn't an issue for most shaders though, even if they have some vertex or pixel displacement.

    Painting itself is enabled by adding the P3dPaintable + P3dMaterialCloner(s) & P3dPaintableTexture(s) components to your GameObject (e.g. alongside the SkinnedMeshRenderer, or MeshRenderer).

    If you're painting using a known 3D location (e.g. paint brush, VR tool), then you don't need a MeshCollider, or any kind of collider. But if you want to paint from a 'hit' point, then you need some sort of collider so the paint knows when and generally where to apply. In the zombie demo scene, one BoxCollider is used to cover the whole zombie, which is good enough for these blood decals. If you need more accurate painting then you may want one BoxCollider per bone, or capsules, etc.
     
  36. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    325
    Thanks for the response!

    Is it possible to also pre-define these decals, draw them in the scene more accurately and then at runtime just enable the predrawn decals?

    It would be good if I can attach these components on the root game object because I tend to update the fbx a lot and will have to redo all the work.
     
  37. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    I think I understand what you're asking. You want to be able to manually place decal points in the editor, and then be able to modify their positions and such in game? If so, this currently isn't possible.

    Right now, decals are only applied in-game at the exact time you paint them (e.g. from a raycast hit, tapping the screen), then they are baked into the texture.

    I plan to add this feature though, as many users have requested variations of this for painting and adjusting decals on a car, etc.
     
  38. noobynobody

    noobynobody

    Joined:
    May 9, 2019
    Posts:
    76
    From the videos and screenshots, I've only seen cartoony examples and the painting is similar to a kid's painting game. Are there any examples of this being used on realistic models, painting something more realistic like rust or dirt?
     
  39. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    This is something I'm currently working on improving. The video I posted above is a step in this direction. If you have an idea for a demo scene or some reference image/video for what you'd like to see then I'll consider implementing it :)
     
  40. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    325
    I would say manually place decals in the editor and then at runtime just enable / disable them (not changing their positions). Also is there a workaround to avoid adding these scripts to the SkinnedMeshRenderer component but maybe on the Root and then reference the SkinnedMesh?

    I also noticed something on the zombie demo, if you spray his chest the blood is also spawned on its back and vice versa.
     
  41. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    I'll try and include this editor/game decal system in the next version, I think it should be quite easy to add.

    As for the components, currently they must be placed alongside the SkinnedMeshRenderer/MeshRenderer, I could easily change this though. However, is there a reason why you must place them on the root? Last time I tried, updating the mesh still kept these components. It's only an issue if I change the root bone name or something drastic.

    As for the zombie demo, the front/backface painting of decals can be adjusted with the P3dPaintDecal component's NormalFront, NormalBack, and NormalFade settings. I'll check them out, as it's been a while since I updated this demo.
     
    skinwalker likes this.
  42. Darkcoder

    Darkcoder

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

    Here's a sneak peak of a feature that it will be in the next version of Paint in 3D:



    Splat map painting!

    You could always paint splat maps, but I never provided a shader to make this easy to do. As you can see, the major advantage of splat maps is that you can tile them, which allows you to have high detail textures, and blend between them using a low detail splat map. Splat maps also make material setup easy, because you set up each material as you normally would, and only need a relatively simple painting setup.

    Also, I extended the VR code to allow non-VR simulation. This means the VR car wheel spray painting demo scene I added in the latest version will now be usable by users without a VR device!



    This means you can expect many more VR demo scenes, and everyone can enjoy them :)
     
    noobynobody likes this.
  43. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    Hey everyone, I've made good progress on the new VR tools, and some of the more realistic demo scenes.

    You can see a sneak peek of a new demo scene here:



    I also improved the quality of the splat painting:

     
  44. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    331
    Just threw my hard earned cash at the screen...

    Looking forward to developing out a project for a local children's hospital.

    Am keen to test this in V.R & PBR materials

    Kids will dig this.
     
    Last edited: Nov 29, 2019
    Darkcoder likes this.
  45. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    331
    Regarding the Spray Painting

    Q.1.

    Is it possible to create a flat arc with a consistent flow like a real spray can.
    Ability to vary the width of the arc ?

    Q.2.

    Is there a feature that takes into account the distance from the creation point to hitting the surface so the user can achieve a gradual feathering or falloff.
    & if so will this be available in VR mode ?

    Q.3 Will this paint on "ArchiMatix " textures ?

    note: I'm reading over the document now... under Drawing Continuous Lines it describes P3HitScreen separation setting... I'm guessing this is to do primarily with each paint dot particle.
     
    Last edited: Nov 29, 2019
  46. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    1 - If you're referring to the typical spray cone shape, then that can be adjusted from the ParticleSystem component settings (Shape > Angle).

    2 - This can be done using the Pressure feature, which some hit components (e.g. P3dHitScreen) can send to painting components. However, P3dHitParticles currently just sends a pressure value of 1.0 (100%) to all hit points, mainly because the particle collision info doesn't contain the age of the particle. However, I could add a setting that sets the pressure based on the distance between the emitter and the hit point as you suggest, which should be close enough. I'll see what I can do!
     
  47. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    331
    Am testing the VR spray paint Demo on an Oculus Quest.

    Spray particles are fine... but upon contact with car wheel surface I encounter very high lag..
    ( 1fps )

    Wondering what player settings others have used for Oculus Quest ?

    note: I've changed from Linear to Gamma & adjusted quality.. turned of light probes / reflection probes. still lags way to much.
     
    Last edited: Nov 30, 2019
  48. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    Thanks for the info, I didn't optimize this scene at all, so this isn't too surprising. To speed things up:

    1) Reduce the sizes of the painted textures to the lowest value you can get away with before the quality degrades.

    2) Reduce the amount of particles emitted, and increase the opacity of the paint to compensate. This will drastically reduce the amount of paint operations per second. To keep the visuals looking the same you can add a second particle system that doesn't have paint components on. Perhaps I can introduce a new setting to only paint every 'n' particles to make this easier.

    3) Replace the high poly mesh with a more optimized version for the painting.

    Doing 3 may be difficult, because I don't think I've made any guide or demo scene showing how to do it. I will include a demo scene demonstrating how to do this in the next version. 1 & 2 are probably the most important and easiest to change though.

    When I'm back at my PC I'll make and send you an early build with these changes.
     
  49. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    331
    A quick update... it is now a lot better but getting an constant flow is difficult... I tend to get patchy blobs. When I paint very close up to the surface it is better but more taxing. Now doing some tests on a flat plane. It works.. but once again I'm getting lag. I need to reduce the particle emission count etc..
     
    Last edited: Nov 30, 2019
  50. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,705
    Alright, I sent you a private message with an updated build. This includes the new P3dHitParticles.Skip setting, which allows for easy optimization of particle painting. I went ahead and updated the VR HVLP demo scene to include this, as well as adjust the paint settings to compensate for the lower number of particle hits, giving almost the same visual results unless you move the sprayer too fast. I'm stuck using on-board graphics until tomorrow, and even with this I can get good framerates on this demo scene with these modifications (I get similarly bad FPS with the original scene on this setup).

    Not to mention I didn't have to adjust the texture size. It's currently painting two 2048x1024 textures per hit, and if you reduce these to 1024x512 then you should see a 4x improvement in performance. For a scene like this, the texture resolution doesn't need to be too high. You could even modify the mesh UV so the front face takes up the vast majority of the space, and the inside or hard to see areas are comparatively tiny. This would allow for even further size reduction.

    Another optimization to double the performance would be instead of painting two textures (albedo + PBR metallic/ao/smoothness), you just paint one like Albedo. If you really need to change the PBR stuff too, then painting a splat map that blends between the base coat and paint would work well, though this feature is still in progress and doesn't have any documentation yet.
     
    Last edited: Nov 30, 2019