Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

ZzZzZ UVPaint ( skinned mesh Decal+Texturing System) ZzZz

Discussion in 'Assets and Asset Store' started by iRobi, May 1, 2016.

  1. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    140
    I found two more bugs.
    If the texture import setting is not clamp, the texture is corrupted.
    If the UVPaint.DecalSize() has a size less than 1, the texture is corrupted.
     
  2. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    140
    Another bug:
    NormalizedAlpha and Normalized_DeepAlpha does not work with SkinnedMeshRenderer. It does work with regular MeshRenderer
     
  3. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    140
    Is it possible to paint on terrain? I mean I tried it and it didn't work, but I just want to verify.
     
  4. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Hi! Sorry for delay...
    Why you use Quaternion.LookRotation(-hit.normal) instead camera.transform.rotation?
    Yeap, maybe. Because i use GetComponentsInChildren<Renderer>(); instead GetComponentsInChildren<SkinnedMeshRenderer>();
     
  5. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Thank you so much! I will fix all of them
    It is so strange! I just checked this, and all works fine...
    I think, UVPaint can do it, because terrain has Unwrapped UV (plane), but all decals will be ugly (low quality). The better solution is use mesh decals. I will add this in next update
     
  6. adamjweaver

    adamjweaver

    Joined:
    Dec 5, 2016
    Posts:
    11
    Hi again iRobi
    I am having difficulty achieving an effect which I think should be possible with UVPaint. Basically I want to put a "hole" in a texture (e.g. a bullet hole through a paper target).

    I am using a custom shader that uses a mask image, and I am using UVPaint to draw to that mask rather than the main texture. I tried putting a completely blank/transparent image as the mask, and then using UVPaint to draw a small black circle on it. However nothing seems to happen to the in-game output. I wonder if it was something to do with how UVPaint creates the texture instance (does it support transparency?)

    I am a complete beginner when it comes to shaders so I might be doing something wrong, but I wonder if you had any ideas?

    This is the shader I am using (I am drawing to "_Mask"):

    Code (Boo):
    1. Shader "Custom/MaskedTextureShader"
    2. {
    3.    Properties
    4.    {
    5.       _MainTex ("Base (RGB)", 2D) = "white" {}
    6.       _Mask ("Culling Mask", 2D) = "white" {}
    7.       _Cutoff ("Alpha cutoff", Range (0,1)) = 0.1
    8.    }
    9.    SubShader
    10.    {
    11.       Tags {"Queue"="Transparent"}
    12.       Lighting Off
    13.       ZWrite Off
    14.       Blend SrcAlpha OneMinusSrcAlpha
    15.       AlphaTest GEqual [_Cutoff]
    16.       Pass
    17.       {
    18.          SetTexture [_Mask] {combine texture}
    19.          SetTexture [_MainTex] {combine texture, previous}
    20.       }
    21.    }
    22.     FallBack "Diffuse"
    23. }
    Many Thanks
     
  7. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Hi! Thank you for your support! UVPaint does not yet support, but can paint on texture. Because alpha is not overrided.
    Now has version which have this functional, but with some issues. After all fixes, i will submit new version. Thanx for patient)
     
  8. frankiecavanagh

    frankiecavanagh

    Joined:
    Dec 13, 2015
    Posts:
    11
    Hi is there a fix for unity 5.5.2f1 the material just goes pink????
     
  9. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Hi! Sure, please send me your e-mail in p.m
     
  10. ndc1992

    ndc1992

    Joined:
    Jan 18, 2017
    Posts:
    13
    hello there is a demand for my project .I have two boxes and I want to draw the box below. But still will spread, can not be completely blocked by the box above, may you have any way to solve this problem? How do I deal with it?

    upload_2017-3-28_14-49-9.png upload_2017-3-28_14-49-26.png
     
  11. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Hi! You mean Depth Covering like shadow? (Block Spreading by another object which cover peojection)?
     
  12. ndc1992

    ndc1992

    Joined:
    Jan 18, 2017
    Posts:
    13
    yes How to solve the problem? Could you please help? Thanks in advance
     
  13. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    138
    I'm having the same issue in Unity 5.5.2p1
     
  14. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Depth mask functional now done and wait for submitting in store, thanks for your patient!
    Please, send me your e-mail in p.m., i will send you the fix
     
  15. ndc1992

    ndc1992

    Joined:
    Jan 18, 2017
    Posts:
    13
    Hi iRobi
    Thanks for submitting. When I can download it? Or how do I use it?
     
  16. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    It can appear in the store at any time... May be week
     
  17. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    I want to make a quiz, and i need people's opinion.
    Is this Transparent Effect useful for somebody? (video below)
     
  18. happysjy

    happysjy

    Joined:
    Dec 21, 2016
    Posts:
    1
    Hi iRobi,
    I also have the "pink issue" with Unity 5.5.0f3.
    Could you send me (sorryone2015@gmail.com) a fix?
    Thanks.
     
  19. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Done!
     
  20. exltus

    exltus

    Joined:
    Oct 10, 2015
    Posts:
    11
    I bought asset today too and everything is pink. When will be your asset updated on store? I dont want to publish my email publically on the forum. Or can you send me new version to my spam email? exltus@centrum.cz
     
  21. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Sorry, but i dont understand, why store doesn't still approve plugin update...
    Now i sent you fix, thanx for your support!
     
  22. ndc1992

    ndc1992

    Joined:
    Jan 18, 2017
    Posts:
    13
    Hi iRobi.
    Thank you for solving my problem!But after the update I found that my stroke shape has changed,
    I used a circle as a decal and the previous version is displayed correctly.But now its error,
    the strokes are intermittent,As shown below,This stroke is no longer round. How to solve the problem? upload_2017-4-13_15-47-53.png
     
  23. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Hi! If its no hard for you, can you share screenshots identifical by it, but in old version of UVPaint?
    And... Try to increase distance from DecalCreater point
     
  24. ndc1992

    ndc1992

    Joined:
    Jan 18, 2017
    Posts:
    13
    What is DecalCreater point? You can see contrast,left picture is old version,right picture is new version:

    What is the cause of the problem?
    upload_2017-4-17_11-23-29.png upload_2017-4-17_11-23-46.png
     
  25. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Spot position. You create decal from camera? Translate back camera before calling UVPaint.Create(), and after, return position:
    SpotPosition.Translate(Vector3.back*5);
    UVPaint.Create(SpotPosition.position,SpotPosition.rotation,...);
    SpotPosition.Translate(Vector3.forward*5);
    Try to increase distance like this.

    And please, tell me, which version of unity are you use?
     
  26. ndc1992

    ndc1992

    Joined:
    Jan 18, 2017
    Posts:
    13
    Unity version 5.4.1, Using RayCast function And did not solve the problem.
    upload_2017-4-17_15-50-43.png
    upload_2017-4-17_15-52-28.png
     

    Attached Files:

  27. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Try use -transform.forward*10 instead -transform.forward*0.01f
     
  28. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    1.7a Update
    Notice: This is the last version that supports Unity 4
    • Added "Shadow Painting" feature. (based on depth map)
    • Added Transparent shaders support.
    • Added NPOT textures support.
    • Added "Zombie Race" game demo.
    • Added new Demo Scene "UVPaint Place"
    • Fixed trouble with Repeat Decals (wrap mode:Repeat now supports)
    • Removed old demo scenes.
     
  29. GreaterHawkeye

    GreaterHawkeye

    Joined:
    Apr 13, 2017
    Posts:
    8
    Hi iRobi,

    I'm very new to Unity and I'm having trouble using your awesome plugin.

    What I did:

    1)Put iRobi.dll in plugins folder of my project
    2)On my PlayerShoot.cs script I've created a Paint() function that I run on Update() method. Here are the codes :
    Code (CSharp):
    1.  
    2.  
    3.     public Texture2D Decal;
    4. private void Update()
    5.     {
    6.         if (Input.GetMouseButton(0))
    7.         {
    8.             Paint();
    9.         }
    10.     }
    11.  
    12. void Paint()
    13.     {
    14.         RaycastHit _hit;
    15.  
    16.         //We hit
    17.         if (Physics.Raycast(cam.transform.position, cam.transform.forward, out _hit, weapon.range, mask))
    18.         {
    19.  
    20.             GameObject hitGameObject = _hit.collider.gameObject;
    21.  
    22.             UVPaint.Create(hitGameObject, _cam.transform.position, cam.transform.rotation, Decal, UVPaint.DecalSize(DecalSize));
    23. }
    24. }
    3) Then, on my Player prefab (where playershoot.cs is) I drag "brush01.png" (the texture I found on the Texture folder of your UVPaint folder) to "Decal" serialized field.
    4) Then I create a cube on my environnement and put a box collider and a mesh renderer on it (i think I have to do that?) I also tried with a skinned mesh renderer
    5) But on play, when I shoot on the cube, the camera is acting weirdly and I got the error "
    NullReferenceException: Object reference not set to an instance of an object
    iRobi.UVPaint.Detect ()"

    Any help please? :(

    Edit: looks like the weird camera is UVPaint Decal Service. I dont know what is this?
     
    Last edited: Apr 21, 2017
  30. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Hi! Looks like, that you include dll without dependencies. Try to import complete package.
    And Important! Use models with Unwrapped UV. Cube doesn't have this
     
  31. GreaterHawkeye

    GreaterHawkeye

    Joined:
    Apr 13, 2017
    Posts:
    8
    Alright thanks! I will import it.
    Also, my question is how can I create the unwrapped uv on a model that i have created ? Im unsure about what unwrapped uv is
     
  32. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Often characters have Unwrapped UV. More 3D Editors like 3ds max support automatic Unrapping tool
     
  33. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Hurry up! 30% DISCOUNT of UV Paint! (Big Sale)
    ForSoc.png
     
  34. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    190
    I was interested in using this for an upcoming update to our PS4 title Honor & Duty but was concerned about the performance. Both web demos run pretty slow on a good PC. Can you let me know what I should expect performance wise? I plan to use this in a FPS to add blood splatters to enemy AI when they are shot so it may be adding decals frequently during gameplay. I'm not sure how this works but I assume all the enemy's can share the same texture without issue. One last question, is there any reason this wouldn't run on the XB1 or PS4?
    Thanks,
    Reggie
     
  35. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Hi! Web demos are ugly, and doesn't optimized (Uses GameObject.Instantiate per shooting).
    Normally in gtx 650, UVPaint works with 60 fps by calling in every frame
     
  36. GreaterHawkeye

    GreaterHawkeye

    Joined:
    Apr 13, 2017
    Posts:
    8
    Hi iRobi,

    What if I want to add your plugin to an existing project? Do I necesseraly have to import everything? Can't I take the dependencies from your plugin to my project?

    Thanks for the help, I just want a proper installation with my current settings :)
     
  37. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Hi!) You can import plugin to existing project simply, because all resources are placed in specially folder, which dont collide with other. After importing you can remove Game Demo package, example scenes)
     
  38. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    190
    I just noticed that this uses a .dll and I'm wondering if this will work on the PS4/XB1 as I've had assets before that won't work if they used compiled code.
     
  39. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    I think, all must be cool, because dll compilled with only unity dependencies
     
  40. Sovogal

    Sovogal

    Joined:
    Oct 15, 2016
    Posts:
    87
    Quick question: If I were to want to fade over time a decal texture that has been projected onto multiple meshes, could you prescribe a methodology to accomplish this?

    Also, if you don't mind suggested features, I would love to see a couple of things implemented:
    1. A Create overload that could take a Material and apply the channels of that Material to the applicable channels of the painted object materials.
    2. The ability to use a spritesheet to animate decals.

    Number two seems quite a bit more complicated than number one, but I could see myself using both of those features immediately.

    Thanks!
     
    Last edited: Apr 28, 2017
  41. bcv

    bcv

    Joined:
    Sep 1, 2012
    Posts:
    19
    Does this come with full source code ? I'd like to have the freedom to change the source code if it becomes unsupported.
     
  42. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Hi! UVPaint is more a runtime texture tool, than decal system
    You can write your own shader with textures slots that will be layers
    Nope, it's impossible, because UVPaint bake decal into the target texture slot of the model's material
     
  43. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    No, but i can provide sources by your request
     
  44. bcv

    bcv

    Joined:
    Sep 1, 2012
    Posts:
    19
    Cool, bought it yesterday, played around with the demo and noticed something though, there's a pretty big hit every time I paint on a mesh. I tried profiling the demo and a big hit happens inside the Painter script (the one attached to the player camera), I tried the script on a custom skeletal mesh and you can notice the hiccup happening every time I paint on it. is this to be expected ?
     
  45. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    This is possible due to the fact that the depth map was added, try to use UVPaint.TwoSide(true). This can boost perfomance
     
  46. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Hurry up! 1 hour left! 30% DISCOUNT of UVPaint! (Big Sale)
    ForSoc.png
     
  47. Tomza

    Tomza

    Joined:
    Aug 27, 2013
    Posts:
    584
    Hi iRobi,

    We bought your plugin and looking into your code I tried to write my own script:

    Code (csharp):
    1.  
    2. public class ObjectPainter : MonoBehaviour {
    3.    
    4.        //public Texture2D Decal;
    5.        public int currentTexture;
    6.        public Texture[] textures;
    7.        public GameObject aimObjectImage;
    8.        public Color[] colors;
    9.        public Color current;
    10.        private float DecalSize = 2f;
    11.        private GameObject paintTarget;
    12.        private bool isSpawning;
    13.        private Vector3 spawnPos;
    14.        private string textureFolder = "Decals";
    15.        private Texture2D Decal;
    16.  
    17.        // Use this for initialization
    18.        void Start () {
    19.            AimEventDelegate.showAim += OnShowObjectAim;
    20.            isSpawning = false;
    21.            aimObjectImage.SetActive(false);
    22.            StartCoroutine(PrepareTextures());
    23.        }
    24.    
    25.        // Update is called once per frame
    26.        void Update () {
    27.        
    28.            if(TransformGizmo.target){
    29.                paintTarget = TransformGizmo.target.gameObject;
    30.            }
    31.        
    32.            if(Input.GetKeyDown(KeyCode.L)){
    33.                current = colors [Random.Range (0, colors.Length)];
    34.            }/* else{
    35.                current = new Color(1,1,1,0.3f);
    36.            } */
    37.        
    38.            if(Input.GetKeyDown(KeyCode.P)){
    39.                if(Decal){
    40.                    current.a = 1;
    41.                    UVPaint.Create(paintTarget, transform.position, transform.rotation, Decal, UVPaint.DecalSize(DecalSize));
    42.                    UVPaint.ShaderPropertyName("_SliceGuide");
    43.                    UVPaint.DecalColor(current);
    44.                    UVPaint.Create(paintTarget, transform.position, transform.rotation, Decal, UVPaint.DecalSize(DecalSize));
    45.                }
    46.            }
    47.        
    48.            if(Input.GetKeyDown(KeyCode.M)){
    49.                //UVPaint.AngleInDegrees(Random.Range(0,360));
    50.                currentTexture++;
    51.                currentTexture %= textures.Length;
    52.                Decal = textures[currentTexture] as Texture2D;
    53.            }
    54.        
    55.            if(Input.GetKeyDown(KeyCode.N)){
    56.                if(Decal){
    57.                    UVPaint.DecalColor(current);
    58.                    current.a /= 2;
    59.                    UVPaint.DecalColor(current);
    60.                    UVPaint.Restore (paintTarget, transform.position, transform.rotation, Decal, UVPaint.DecalSize (DecalSize));
    61.                    UVPaint.ShaderPropertyName ("_SliceGuide");
    62.                    UVPaint.DecalColor(current);
    63.                    UVPaint.Restore (paintTarget, transform.position, transform.rotation, Decal, UVPaint.DecalSize (DecalSize));
    64.                }
    65.            }
    66.        
    67.            if(isSpawning){
    68.                RaycastHit hit;
    69.                var forw = new Vector3(0,0,100);
    70.                var fwd = gameObject.transform.TransformDirection(forw);
    71.                if(Physics.Raycast(gameObject.transform.position, fwd, out hit)){
    72.                    spawnPos = hit.point;
    73.                    aimObjectImage.SetActive(true);
    74.                }
    75.            }else{
    76.                aimObjectImage.SetActive(false);
    77.            }
    78.        
    79.        
    80.        }
    81.    
    82.        IEnumerator PrepareTextures(){
    83.            textures = Resources.LoadAll(textureFolder).Select(x => x is Texture ? (Texture)x : null).Where(y => y != null).ToArray();
    84.            yield return null;
    85.        }
    86.    
    87.        public void OnShowObjectAim(){
    88.            isSpawning = !isSpawning;
    89.        }
    90.    
    91.    
    92.    }
    93.  
    94.  
    Decals are created and applied to objects, but I am unable to remove them and use random colors.

    EDIT:
    I use the Unity cube primitive (not unwrapped) and your bear for testing.

    I can apply decals to the cube and the bear, but I cannot remove decals from the cube, but I can do that from the bear.

    UVPaint.FullRestore(paintTarget, UVPaint.DecalSize (DecalSize));

    works for both.

    I changed:
    UVPaint.ShaderPropertyName ("_SliceGuide");
    to:
    UVPaint.ShaderPropertyName ("_MainTex");

    And now I can apply colors to decals (the cube and the bear).

    How to save all decals on teh object?

    I think you should make a good tutorial with all the API and clear examples how to use it.
     
    Last edited: May 2, 2017
    julianr likes this.
  48. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Hi! Thank you for your support!
    This is tutorial "UVPaint Raycast"

    Cube must have Unwwrap UV, for correct work with UVPaint.
    Use UVPaint.Restore(), this is Eraser for particular remove decals from model.
    Try to use UVPaint.SaveStateForRestore(), it provide you to bypass erasing your baked decals!
    Good luck)
     
  49. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Hello, I use 4.7.2. I would like to paint over a vehicle that is using bumped specular shader. Do I need to use specific shader or is it compatible with Unity bumped specular shader?
     
  50. iRobi

    iRobi

    Joined:
    May 1, 2016
    Posts:
    170
    Hi! You can just place UVPaint.ShaderPropertyName("_BumpMap"); before UVPaint.Create();
    I can be wrong in names of property, but try to do this