Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Vertex Painter

Discussion in 'Assets and Asset Store' started by reissgrant, Sep 6, 2010.

  1. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    Vertex Painter 2 is now released!

    http://reissgrant.com/VertexPainter2.html

    Vertex Painter has been updated to version 2.0

    Updates include:

    1.) Paint by texture (Paint by color is still available in advanced roll-out)
    2.) New Mobile shaders allow 4 texture blend and two bump map blend (OpenGL ES2 compatible only)
    3.) Hide the mesh wireframe while painting
    4.) Performance increased.

    You can now paint by texture instead of painting a color and wondering what texture that goes with.

    Purchase includes all future updates.
    Future updates will include dx11 shaders as well




     
    Last edited: Jun 7, 2013
  2. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    First post updated with new package
     
  3. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    This looks very cool, I'll give it a try later today.
     
  4. Alex Mat

    Alex Mat

    Joined:
    May 14, 2010
    Posts:
    177
    Great stuff.
    Should be usefull for road borders etc.
     
  5. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    First post update with new package.
     
  6. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    How do you select the two textures to use?
     
  7. oblivionfeet

    oblivionfeet

    Joined:
    Jul 24, 2010
    Posts:
    481
    Doesn't work on 2.6.1, but looks very cool anyway, nice one!
     
  8. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    Can you tell me what errors you received?

    I'd like to get it working for the 2.6 folks too.
     
  9. oblivionfeet

    oblivionfeet

    Joined:
    Jul 24, 2010
    Posts:
    481
    IIRC it gave an error about float3 should be float4?

    oh and
    Assets/Editor/vertexPainter.cs(205,70): error CS0246: The type or namespace name `var' could not be found. Are you missing a using directive or an assembly reference?

    and
    Assets/Editor/vertexPainter.cs(43,31): warning CS0219: The variable `myWindow' is assigned but its value is never used

    and
    Cg in program 'vert': error C0000: syntax error, unexpected ';', expecting ',' or ')' at token ";" at line 19
     
  10. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    For this, you need the shader package linked in the first post.
     
  11. ikke998

    ikke998

    Joined:
    Jan 7, 2010
    Posts:
    79
    changing the var to int made the script work for me in unity 2.6.1!
    But I cant get the shader to work properly :(
    I get these errors:
     

    Attached Files:

  12. oblivionfeet

    oblivionfeet

    Joined:
    Jul 24, 2010
    Posts:
    481
    Awesome! nice one! I would have done it myself but have my head in Jessy's shader tutorials over on youtube, so my brain is all mushy and spongy from overuse lol.
     
  13. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    There is now a 2.6 version attached above.

    I'll rewrite the blend shader to be compatible with 2.6, right now it's written with version 3 surface shader syntax so you will definitely get errors.
     
  14. hizral

    hizral

    Joined:
    Apr 27, 2010
    Posts:
    568
    hi...I download the 2.6 version and I got this.

     
  15. coin-god

    coin-god

    Joined:
    Jan 21, 2010
    Posts:
    325
    This is awesome man. Ill try it out.

    Been really waiting for this.
     
  16. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    Very cool if it works like it should. Wish I could try it in Unity 3. One of the things I liked about making levels in max was how easy it was to do vertex painting with blend shaders in realtime. Look forward to trying this tool out someday in the future :)
     
  17. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    THis looks fantastic. Now we can paint as if it was a terrain like objet. When I'm more advanced in my project I'll give it a try. Will be nice for a beach for instance, to blend the sand nearby the coast and the rest.
     
  18. ikke998

    ikke998

    Joined:
    Jan 7, 2010
    Posts:
    79
    I wish I had Unity 3 beta, I would love to try it out!
    It would be so cool if you got this working in 2.6 or you could make some more demo's so we can drool until the release of Unity3!
    Anyway, this is a tool I've been wanting to see in unity and it is awesome you made this and shared it with the community!
    Keep up the good work!
     
  19. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    The vertex painter works with 2.6, I uploaded a new version today.
    The blend shader will be converted to Unity 2.6 shortly.

    And thanks ;)
     
  20. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    Ok Blend Shader has been converted to 2.6.

    Textures included:
    click here to download 2.6 blend shader!

    blend shader for version 3 beta is on the front page

    Remember, red vertex means texture 1,
    black vertex means texture2.

    Have fun!
     
  21. oblivionfeet

    oblivionfeet

    Joined:
    Jul 24, 2010
    Posts:
    481
    I really want to use this, but am concerned about how it would work with my shaders.

    I'm not very knowledgeable on shaders at all, but what I would love to do would be to make this work with any shader I like, by that I mean the blending of textures using the vertexes and such.

    Ok I'm doing horribly at wording this post well, lol. All I know is how useful this utility would be.
     
  22. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    It will not alter your shader at all. It will change the color of the vertex only. If you are using any kind of shader that is using a vertex color input, then you can see the change in realtime in the editor. That's ultimately what it is for. That's why I included a blend shader so you can see how it affects a model in realtime. A vertex color shader *is* applied when you press "see vertex colors" but then is removed when you uncheck it, and you're original shader will be re-applied. At worse, you may just have to re-apply your shader, but it will in no way modify your shader, just the vertex colors of your mesh :).
     
  23. oblivionfeet

    oblivionfeet

    Joined:
    Jul 24, 2010
    Posts:
    481
    Yeah, that's not what I mean though. I WANT it to effect my shaders, I really really do, lol. I want to be able to use this and edit my shaders so they can recognize the changes to the vertex colors or blend between two textures. Just no idea yet how to do it, and since I can't even get a relief shader (the ones on the wiki, not the bundled parallax ones) to work properly with my lightmapped shaders, I don't see me learning anytime soon, lol.
     
  24. hmacyt

    hmacyt

    Joined:
    Jul 1, 2010
    Posts:
    203
    I'm not having much luck getting this working.

    win7 version 2.6
    vertex color shader not working, vertex painting opening up, but not painting
    I don't know if the blend shader is working, but the diffuse and normal map for the main color work.
     
  25. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726

    Apply random colors to ensure the vertices have color, because when you first apply the vertex color shader, the colors are white to start off so it will look like nothing is happening.

    To paint, select a color with the color picker and Press and hold "CTRL" while moused over your object. Also, Ensure the strength is sufficient to paint a color.

    BTW this was developed on Windows 7 64bit, 3.0 and 2.6 and tested on both.
    Let me know if the above works for you.
     
  26. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    @oblivionfeet

    At this time it will not affect the shader, but maybe in the future? I assure you the new surface shaders in Unity 3 will be much easier to learn, and will allow for you to write your own. I would also suggest trying one of the great shader node systems here in the showcase forum. If you do, look for "vertex color" inputs and start experimenting.
     
  27. hmacyt

    hmacyt

    Joined:
    Jul 1, 2010
    Posts:
    203
    Okay got it working, the vertex color shader is still broken, and I'm having some issues with the blend shader, the rock normals are showing through too much and the spec is kinda funky.

    What controls the blending? I'd expect a height map of some sort for the base texture 1.

     
  28. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    They are showing through because the vertices are not totally painted. If they are totally painted, there will be no hint of blending. As for the specular, adjust the specular color and "shininess" value.

    The blending is based on the alpha channel of the blend map. Open it in photoshop and look at the Alpha channel, you will see that it looks similar to a height map. This controls where the texture is blended first. Along with the vertex color which determines which texture to paint.

    The vertex color shader works for me in 2.6, can you tell me if you are getting errors? Or is it just not showing up?
     
  29. oblivionfeet

    oblivionfeet

    Joined:
    Jul 24, 2010
    Posts:
    481
    That would all involve buying Unity 3, which I can't do for the foreseeable future. So I miss out on the node methods cause those developing them jumped ship to v3 as soon as they could. :(
     
  30. hmacyt

    hmacyt

    Joined:
    Jul 1, 2010
    Posts:
    203
    How do I check for errors on shaders?

    The picture I posted is as painted as I can make it, cranked up the intensity and the color as high as I could and it didnt change anything.
     
  31. hmacyt

    hmacyt

    Joined:
    Jul 1, 2010
    Posts:
    203
    ShaderLab error: Shader 'Custom/VertexColorsOnly': no subshaders can run on this graphics card

    I have a 9800GT, unless that's too dated...


    MissingComponentException: There is no 'Renderer' attached to the "Main Camera" game object, but a script is trying to access it.
    You probably need to add a Renderer to the game object "Main Camera". Or your script needs to check if the component is attached before using it.
     
  32. WinningGuy

    WinningGuy

    Joined:
    Aug 10, 2009
    Posts:
    884
    I'm getting this error in Unity 2.6 when I try to paint on vertices on a plane.

    Code (csharp):
    1. IndexOutOfRangeException: Array index is out of range.
    2. vertexPainter.RenderVisibleVertices (UnityEngine.Transform obj, GizmoType gizmoType)   (at Assets\Editor\vertexPainter.cs:236)
    3. UnityEditor.Handles:Internal_DrawBuiltinGizmos()
    4. UnityEditor.Handles:Internal_DrawBuiltinGizmos()
    5. UnityEditor.Handles:DrawBuiltinGizmos()
    6. UnityEditor.SceneView:OnGUI()
    7. System.Reflection.MonoMethod:InternalInvoke(Object, Object[])
    8. System.Reflection.MonoMethod:InternalInvoke(Object, Object[])
    9. System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
    10. System.Reflection.MethodBase:Invoke(Object, Object[])
    11. UnityEditor.HostView:Invoke(String)
    12. UnityEditor.DockArea:OnGUI()
     
  33. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    @winningguy, apply random then try to paint. I'll try to find the problem though.

    @hmacyt make sure you are applying full red (1,0,0,0) and full black (0,0,0,0). Also, the camera does not have a renderer so I would not try to paint its vertices ;). I will put a check in there to disable painting while selecting other objects...

    Also, the vertex color shader is as basic as it gets, it will run on most everything. Not sure why you're getting an error?
     
  34. WinningGuy

    WinningGuy

    Joined:
    Aug 10, 2009
    Posts:
    884
    Applying random and then paint didn't do anything.

    The blend shader appears to be working though. Pretty nifty.
     
  35. hmacyt

    hmacyt

    Joined:
    Jul 1, 2010
    Posts:
    203
    maybe the "no subshaders can run on this graphics card" is limiting it to one normal map or something, I should probably figure out that problem first
     
  36. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    Oh, the BLEND shader, yes this is limited to shader model 3 right now. I will write one for shader model 2 without spec maps.
     
  37. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    Ok, I found out what is causing the problem, I'll fix it up and re-upload a new package.
     
  38. WinningGuy

    WinningGuy

    Joined:
    Aug 10, 2009
    Posts:
    884
    Not sure if this was referring to me or the other post above.

    The Blend shader appears to be working for me.

    The VertexColorsOnly shader is the one that is acting hokey.

    But maybe you already knew this. If so, pretend I said something more useful instead.
     
  39. hmacyt

    hmacyt

    Joined:
    Jul 1, 2010
    Posts:
    203
    I checked and its just the diffuse showing through, made sure the vertex colors were as absolute as possible, I'm updating my video drivers just to make sure that's no causing any issues, they should be fine though.
     
  40. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    Ok, package is updated on the front page.
    Vertex color shader is NOW included, somehow got left out of the previous package...

    "Index out of range" error fixed.

    Fixed an error when trying to paint vertex colors on a camera or light. :b

    Please let me know if these changes resolve your issues, or if you have any more issues, or questions.


    @hmacyt
    Are you using Unity 3 beta or 2.6?
     
  41. hmacyt

    hmacyt

    Joined:
    Jul 1, 2010
    Posts:
    203
  42. hmacyt

    hmacyt

    Joined:
    Jul 1, 2010
    Posts:
    203
    different errors this time.

    Shader 'Custom/VertexColorsOnly': no subshaders can run on this graphics card


    Cg in program 'vert': warning C7011: implicit cast from "float4" to "float3" at line 79

    Cg in program 'vert': error C1115: unable to find compatible overloaded function "mul(error, float4)" at line 28

    Unrecognized renderer for #pragma exclude_renderers: xbox360

    Unrecognized renderer for #pragma exclude_renderers: gles
     
  43. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    Ah ok, it appears Unity 3 is compiling the version 2.6 shader before I can package it : /

    Let me fire up good ole' 2.6

    Ok hmacyt, download the separate new vertex colors shader for 2.6 on the front page, overwrite the shader that was included in the package, let me know how it works.
     
  44. hmacyt

    hmacyt

    Joined:
    Jul 1, 2010
    Posts:
    203
    yay the vertex color is working perfectly, no errors, but the other shader is still having the same issues, figured out its tied to the lighting some how...



    the sand is still transparent and it only shows up with light.
     
  45. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    Make sure to fill up all of the shader slots with the right textures, normals and blend map.
     
  46. WinningGuy

    WinningGuy

    Joined:
    Aug 10, 2009
    Posts:
    884
    Regarding the VertexColorsOnly shader... for some reason it's still telling me that it has errors.

    Code (csharp):
    1. Unrecognized renderer for #pragma exclude_renderers: gles
    2. Unrecognized renderer for #pragma exclude_renderers: xbox360
    3. Cg in program 'vert': error C1115: unable to find compatible overloaded function "mul(error, float4)" at line 28
    4. Cg in program 'vert': warning C7011: implicit cast from "float4" to "float3" at line 79
    I'm also getting a message that no subshaders could run on my graphics card. I'm using a Nvidia GeForce GT230.
     
  47. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    Download the new vertex colors shader (only the shader, not the package) on the front page. This will overwrite the shader included in the package. This will fix the errors.
     
  48. hmacyt

    hmacyt

    Joined:
    Jul 1, 2010
    Posts:
    203


    same issue.
     
  49. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    Ok, try this:

    set the vertex painter to the settings in the screenshot and press the "click to apply colors to all vertices" button.

    Also, set the colors to light grey and drag the shininess slider all the way to the right

    Take a screenshot with your vertex painter settings and the plane in view so I can see what you have.

    It should look close to this:

     
  50. WinningGuy

    WinningGuy

    Joined:
    Aug 10, 2009
    Posts:
    884
    Everything is fine and dandy on my end. Nice.

    Great work!