Search Unity

► Wireframe shader - The Amazing Wireframe shader ◄

Discussion in 'Assets and Asset Store' started by Arkhivrag, Jun 11, 2014.

  1. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    For the next update I will try to add: Wire transparency control vie texture and IBL.
     
  2. 3DJayC

    3DJayC

    Joined:
    Jul 29, 2014
    Posts:
    33
    When you think deliver an update?
     
  3. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    @3DJayC
    I am very busy now, but will try to manage new update this year.
     
  4. 3DJayC

    3DJayC

    Joined:
    Jul 29, 2014
    Posts:
    33
    Okay cool! Can't wait to see!

    Thanks!

    J
     
  5. jhincapie

    jhincapie

    Joined:
    Dec 2, 2014
    Posts:
    2
    I am trying to use the "Unlit>Transparent>NoTex" shader and need to change the color of the wireframe on runtime. I am trying the:

    renderer.material.SetColor("V_WIRE_COLOR", DesiredColor);

    But it's not working. How do you do it?
     
  6. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    It works. May be your alpha is zero, that's why you do not see it.



    Vacuum Shaders
     
    Last edited: Dec 3, 2014
  7. jhincapie

    jhincapie

    Joined:
    Dec 2, 2014
    Posts:
    2
    It works, thanks for the pointer :)
     
  8. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    EDIT: Nevermind. got it fixed. Attached script to wrong object heh.

    Panic over ;)


    Hihi, bought to use on Unity Pro Beta 5.0 but I don't see any Wireframes (sadface)

    Is it not compatible?

    NoWireFrame.JPG

    As you can see the only wireframing is the default editor stuff.

    Many thanks.

    I'll tell you how it does with the Beta 5.0 and webgl :)

    Wireframe.JPG

    Thanks
     
    Last edited: Dec 9, 2014
  9. aopdenbosch

    aopdenbosch

    Joined:
    Sep 29, 2014
    Posts:
    5
    I am interested in using the your wireframe shader on a mesh that I am updating on every frame. I am refreshing the points of the mesh in the Update() function. Could you tell me if this is possible? I bought the plugin today so I have the WireframeGenerator code.
     
  10. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    @aopdenbosch
    There is no problem if you just modify vertex position in the Update() function. But if you generate new mesh with new vertexes, then you should also generate new wire data for that mesh.
     
  11. 3DJayC

    3DJayC

    Joined:
    Jul 29, 2014
    Posts:
    33
    Hi Arkhivrag,

    Did you update the shader to be control by an alpha map?

    J
     
  12. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    @3DJayC
    Update will be available next week.
     
    twobob likes this.
  13. 3DJayC

    3DJayC

    Joined:
    Jul 29, 2014
    Posts:
    33
    Ok thanks!

    Let me know when it's updated ;)

    J
     
  14. aopdenbosch

    aopdenbosch

    Joined:
    Sep 29, 2014
    Posts:
    5
    Hi Arkhivrag,

    I modified my dynamic mesh code so the vertices are not generated on every frame. I am simply updating their positions. But.......I am having some problems even before I even get to that part of the code. I am having some problems in your "Generate" method the first time I call it with my code generated mesh. Unity just hangs and starts allocating memory.

    Here is the code that I am using to generate my mesh on Awake(). Btw, I made sure that your code is called after this mesh is ready:

    ====================================================
    void Awake()
    {
    int gridSie = 128;
    MeshFilter myFilter = depthMesh.AddComponent<MeshFilter>();
    Mesh myMesh = myFilter.mesh;
    Vector3[] vertices = new Vector3[gridSize*gridSize];
    Vector2[] uv = new Vector2[gridSize*gridSize];
    Color[] colors = new Color[gridSize*gridSize];
    float inc = 1.0f / (float)gridSize;
    int i = 0;
    for( float y = 0.0f; y < 1.0f; y += inc )
    {
    for( float x = 0.0f; x < 1.0f; x += inc )
    {
    vertices = new Vector3( x,y, 0.0f );
    uv = new Vector2( x,y );
    colors = new Color(0.5f,0.5f,0.5f);
    i++;;
    }
    }

    myMesh.vertices = vertices;
    myMesh.uv = uv;
    myMesh.colors = colors;

    i = 0;
    int[] triangles = new int[gridSize * gridSize * 6];
    for ( int y = 0; y < gridSize - 1; y++ )
    {
    for ( int x = 0; x < gridSize - 1; x++ )
    {
    // First triangle
    triangles[i++] = ( y * gridSize ) + ( x );
    triangles[i++] = ( ( y + 1 ) * gridSize ) + ( x );
    triangles[i++] = ( y * gridSize ) + ( x + 1 );

    // Second Triangle
    triangles[i++] = ( ( y + 1 ) * gridSize) + ( x );
    triangles[i++] = ( ( y + 1 ) * gridSize) + ( x + 1 );
    triangles[i++] = ( y * gridSize ) + ( x + 1 );
    }
    }

    myMesh.triangles = triangles;
    //myMesh.RecalculateNormals();
    //myMesh.Optimize();
    }

    ==========================================================
    I was originally not generating the colors but I added them to see if that would help but it did not. Also the last two commented lines don't help either if I include them. So there seems to be a difference between a mesh created by editor and a mesh created in code when it comes to your code. Or, I am forgetting to add something crucial to my mesh before calling your generation code. May be you can help me out.
     
  15. Flickayy

    Flickayy

    Joined:
    Jan 20, 2013
    Posts:
    40
    Neat little asset, not sure how I would benefit from this, but I've added it to my watch list. Keep up the good work ^^
     
  16. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    @aopdenbosch
    Are you sure your mesh is correct?
    Add this lines at the end of your script to ensure that your mesh triangles are generated correctly
    Code (CSharp):
    1. for (int k = 0; k < triangles.Length; k += 3)
    2. {
    3.     if (triangles[k] == triangles[k + 1] ||
    4.         triangles[k] == triangles[k + 2] ||
    5.         triangles[k + 1] == triangles[k + 2])
    6.     {
    7.         Debug.LogError("Triangle " + k/3 + " is wrong!!!");
    8.     }
    9. }
    triangle can not have two same vertexes



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Dec 11, 2014
    twobob likes this.
  17. aopdenbosch

    aopdenbosch

    Joined:
    Sep 29, 2014
    Posts:
    5
    Hi Arkhivrag,

    Thank very much. The triangle array that I was allocating was bigger than it needed to be. Once I fixed that problem the wiremesh rendered correctly. It looks awesome.

    Thanks again for taking the time to look into this.

    Regards,

    -Augusto
     
  18. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    New version is available v1.3

    Poster_VertexColor.png

    Added:
    • Image Based Lighting
    • Vertex Color shaders
    • Wireframe texture transparency
    • Fresnel reflection
    • Wireframe generator and shader baking editor windows
    • ReadMe file​

    Improved:
    • Gradient is calculated per pixel
    • Gradient color can be solid or interpolated to Base texture
    • Cutout shadows support antialiasing
    • Material editor shows useful info about mesh​

    Changed:
    • Shader variable names have correct semantic (renamed)
    • Shader Optimizer replaced with Shader Baker
    • Removed scripts from assets menu, now they are accessible from material editor.​



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Feb 14, 2015
    twobob and gurayg like this.
  19. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Hi,

    Better and better. Can you add two option :
    a) The ability to display without drawing the wireframe. Yes, i know : this is a wireframe shader. :p
    b) The possibility to replace the grey color by another one.

    Imagine this image with the previous requirements. Will be cool no?! ;)

     
    Last edited: Dec 17, 2014
  20. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    @ZJP
    a) The ability to display without drawing the wireframe
    Check Wire Color parameter inside material editor. RGB defines wire color, A - its transparency.

    b) The possibility to replace the grey color by another one
    Check Gradient Color inside material editor. RGB defines gradient color, A - interpolates that color to Base texture.

    gradient.png



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Dec 17, 2014
    3DJayC likes this.
  21. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    My bad. It's a perfect example of the "RTFM" thing. :(

    :p
     
  22. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I actually was going to request bi-axial shading or capsule based... :\

    I surely would love to be able to shade in two axes.
    think "arm out to side" then "arm out in front."

    - that would also suit a radial/spherical solve hence my other comment about capsules. (might not be too computationally expensive for a pure sphere?)

    Anyways I can see you have been hard at it. Ill go check what you did before making ridiculous requests.

    @ZJP I actually was also going to ask for a "Transparent -> Wireframe -> Opague" variant.
    Took me two days to think it through and realise I could probably do that with that Alpha setting and the right texture.
    So, yeah, not alone.


    appreciate the update.

    Oh, I think I spotted a typo in the shader titles.
    "/Unlit/Additive"


    EDIT: I must admit I do Search Replace:
    VacuumShaders/The Amazing Wireframe/
    for
    Vacuum-Wireframe/
    in the shader code, as the extra click bocomes tiresome.

    Final question. This thing doesn't do shadows right?
    Just checking. I never see any.
    I suppose I could go check the code or unitys inspector analysis but never hurts to check.

    Many thanks and Thanks for the amazing shader.
     
    Last edited: Dec 18, 2014
  23. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Update v1.31 available
    Unity editor wireframe will not disturb any more, it can be hidden from material editor.



    VacuumShaders - Facebook Twitter YouTube
     
    twobob likes this.
  24. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Merry Christmas for everyone!

    Free voucher code: Redeemed!
    To redeem this code go to Asset Store - User Account page - Redeem Voucher.

    Be the first one to grab your free copy!



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Dec 24, 2014
  25. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Last edited: Dec 24, 2014
    twobob likes this.
  26. kulesz

    kulesz

    Joined:
    Jul 1, 2012
    Posts:
    140
    Looks like an awesome product - just (almost) something I need...
    I would buy instantly if there were quad support.
     
  27. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    struggling to get the new http://unity3d.com/unity/cloud-build system to swallow your shader mate, for the 5.0 web target.
    (yup, your latest code)

    Just comes up blank. With a "NOT SUPPORTED replacing with standard" error, tried every possible rendering path et cetera I could think of...

    Do you have access to the http://unity3d.com/unity/cloud-build system yet?
    Think you might have some headaches there is the future. Might be worth checking it out.

    Word to the wise.
     
  28. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Quads would be great, but it's beyond shader. Need some headache at the script side.


    @twobob
    I do not have access to the CloudBuild. Thanks, I take note.



    VacuumShaders - Facebook Twitter YouTube
     
  29. People-Pilot

    People-Pilot

    Joined:
    Aug 28, 2012
    Posts:
    18
    Thanks for the great shader Arkhivrag.

    I have a question about the WireframeManager class. In my code I need to destroy and recreate wire frames for particular meshes (I am modifying the vertices array). In a previous version you had the WireframeManager accessible, but it has now been moved to the dll.

    My code still works if I add WireframeManager back to TheAmazingWireframeGenerator.cs (my version of GetWire is called instead of the dll version), but I wonder if this will conflict with any other code that calls GetWire?

    Perhaps you can expose a DestroyWireframe(Mesh _mesh) function in a future version?
     
  30. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Update v1.32 available.
    Generating wireframe from script can be done by using
    1. WireframeGenerator.Generate() - Generates and returns wireframed mesh.
    2. WireframeManager.GetWire() - Generates(if it's necessary) and returns wireframed mesh. Also saves IDs of the meshes whose wireframe has been generated. If several meshes with same ID will require wireframe it will be generated only once for all of them.
    Added WireframeManager.RemoveMesh() to remove mesh ID from manager and WireframeManager.Clear()

    @People Pilot
    I think your own function and class will not conflict with Wireframe code.



    VacuumShaders - Facebook Twitter YouTube
     
  31. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Shader error in 'VacuumShaders/The Amazing Wireframe/One Directional Light/Gradient/Transparent': redefinition of 'unity_LightmapST' at Assets/VacuumShaders/The Amazing Wireframe Shader/Shaders/Wire.cginc(39) (on d3d9)

    Looks like it could be a name collision with

    https://www.assetstore.unity3d.com/en/#!/content/4243
    Amplify motion maybe.

    Will go hunt.

    EDIT: Hmm.. no obvious candidates...

    I did find this in one of the other shaders...
    // Upgrade NOTE: commented out 'float4 unity_LightmapST', a built-in variable
    // Upgrade NOTE: commented out 'sampler2D unity_Lightmap', a built-in variable

    Perhaps I can just elide this declaration?
    Is there such a thing as a concept of namespace in shaders? I guess not.
    It's been about 6 years since I touched them (Unity 2.5 era IIRC) Sigh, so much to remember, so little time.

    Will play, I did note yours is a half4 not a float4

    EDIT EDIT: I elided it. will see what damage that does. (It Now Builds Okay)

    wireframeMan.JPG

    Seems okay

    I personally am not using lightmapping with this project anyways at this point, nor probably going forward as it is procedural.
     
    Last edited: Jan 23, 2015
  32. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    @twobob
    Very little info to reproduce that "bug" on my side.
    redefinition of 'unity_LightmapST' - It can not be redefined (declared only once and only if Unity uses lightmaps) ?
    // Upgrade NOTE: - why did Unity upgrade shader and how it did that ?
    Shaders can not have name collision and namespaces.
    May be Unity has messed up something. If errors continues just let me know.



    VacuumShaders - Facebook Twitter YouTube
     
  33. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I just removed it. and now it works :\ ?

    the ONLY change I made was to add the Amplify Motion plugin.

    That is all the info I can give you?

    Sorry mate
     
  34. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Sorry to resurrect, but does this come with the model viewer?
     
  35. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    err I think it did.
     
  36. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Not a huge thing for me, I just really like the idea of having a model viewer for my personal portfolio, I have a few images up but images take time to do well, whereas model viewer is much nicer to have, plus it is interactive and potential employers can see the different texture layers used so they can see your workflow, which is a huge bonus in my books, and as that would be what I would mostly be using this for (and for temporary use in-game while on a build), this would be very useful, they seem very useful and not many people have them, I hate to steal the thread, so I made another one for this, if anyone knows how to adapt some code for a model viewer in 4.6, post in the link.

    http://forum.unity3d.com/threads/unity-4-6-model-viewer.294162/
     
  37. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Hi,
    Troll model is inside package.
    Web demo scene with options controlling from gui is not included (it is not necessary, all parameters can be changed from material editor)
    Camera rotation script for model view is not included. Script is inside Unity default packages "Mouse Orbit.js".



    VacuumShaders - Facebook Twitter YouTube
     
  38. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    Hello I have bought this very well done and awesome shader thinking that it could paint all the polygon wireframe and also only the ones that are only on the edges and do not paint the triangular wires inside the edges, here below I have put an example I have made in Photoshop. What I want is to get the result made on the THIRD image.
    Is there any possible to use this Wireframe shader to make the third result possible? How?

    Wireframe_Shader_paints_all_wires.jpg
    If it is not possible I would like to ask for a refund because if it ONLY paint ALL the wirframe polygons it is useless for me and I will not be able to use it.

    I also have other more complex 3D models that are buildings and other objects, and I would like that ONLY be painted the EDGES SHAPE and not ALL the polygon wires that makes the 3D model.

    I also would like to have a glow added to that wireframe line (I have Unity Pro) so I could get something like the logo name of the game Orborun
     
    Last edited: Feb 27, 2015
  39. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    The store handles refunds, you would be better sending him a PM as the author agreeing could make it all go a bit faster and no one wants to wash their underwear in public.

    You know, other than the "near" lines that last picture looks a bit like a Cartoon Shader (with a tight white outline).

    So you could draw that in a few passes (mesh read in sub-parts of the various directions) and shade it that way.
    You only show a single use case, so that is all I have to go on.
    EDIT: Okay I see you added another use case. Thank you.

    To be fair, the middle picture is the "Wireframe" picture, and the last one is more like a "Super Accurate Rim" shader or edge detection shader or something. :) I feel pretty sure someone asked this before, but I may be wrong.
     
    Last edited: Feb 27, 2015
  40. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    @SpaceRay
    Wireframe shader does what it is supposed to do. You are looking for edge detection shader, that feature is not available in Wireframe shader. I do not know how technically refund is done, but you can talk with Asset Store team and if they find refund reason valuable, they will give it.



    VacuumShaders - Facebook Twitter YouTube
     
    twobob likes this.
  41. nockieboy

    nockieboy

    Joined:
    Jul 7, 2012
    Posts:
    48
    First of all, apologies if this has already been requested or is already implemented - haven't had time to read the whole forum!

    Is there a possibility that this shader could do an effect similar to the 'scanning refresh' effect in, for example, the ship viewer on the Star Citizen website where the vertices are momentarily brightened as a 'scanline' passes through the model?

    Just realised - this post is a bit of a necro too!! Is this shader even still supported?
     
  42. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    @nockieboy I think I know what you are talking about, but could you provide a link?
    You will need to be a lot more specific to get an accurate answer, even if what you are looking for is what I am thinking.
     
  43. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    @nockieboy
    Wireframe shader is still supported. Can you provide the link of the effect you want, than I'll be able to answer.



    VacuumShaders - Facebook Twitter YouTube
     
  44. Scott-Curtin

    Scott-Curtin

    Joined:
    Mar 19, 2013
    Posts:
    14
    Was trying to flip a skinned mesh- Is that tricky?- using the Vertex Color/Unlit/Transparent/Wire Only 2 Sided?
    Tried renaming duplicate geometry and generating new vertex data on a negatively scaled skinned mesh root node.(human figure... was hoping to be able to get the memory benefits of duplicating and inverting)
     
  45. hampa

    hampa

    Joined:
    Nov 12, 2014
    Posts:
    5
    I just upgraded to 5.0 and I can no longer see it from the Downloads section in my Unity store.

    It seems to work fine though, any chance you can upgrade so it will be used in 5.0.

    If I go to the store it asks me to purchase it again.
     
  46. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    In the shader name symbol "2" means two/double not second. That shaders has no parameters like color and texture and just renders wireframe for as two/double sided.

    Unity 5 currently is not fully supported. I have 7 assets on the Asset Store and I need time to convert them all.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Mar 27, 2015
  47. dl_studios

    dl_studios

    Joined:
    Oct 14, 2012
    Posts:
    76
    The wireframe shaders works fine in Unity 5 except for when trying to make a windows standalone build. We get:

    Shader error in 'VacuumShaders/The Amazing Wireframe/Unlit/Transparent/NoTex 2 Sided': variable 'o' used without having been completely initialized at Assets/VacuumShaders/The Amazing Wireframe Shader/Shaders/cginc/Wire_Vertex.cginc(169) (on d3d9)

    Compiling Vertex program with V_WIRE_ANTIALIASING_OFF V_WIRE_IBL_OFF V_WIRE_LIGHT_ON V_WIRE_FRESNEL_ON


    and

    Shader error in 'VacuumShaders/The Amazing Wireframe/One Directional Light/Diffuse': variable 'o' used without having been completely initialized at Assets/VacuumShaders/The Amazing Wireframe Shader/Shaders/cginc/Wire_Vertex.cginc(169) (on d3d9)

    Compiling Vertex program with DIRECTIONAL SHADOWS_OFF LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF V_WIRE_ANTIALIASING_OFF V_WIRE_FRESNEL_OFF V_WIRE_LIGHT_OFF V_WIRE_IBL_OFF V_WIRE_TRANSPARENCY_OFF
     
  48. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Fixed. Download update v1.33



    VacuumShaders - Facebook Twitter YouTube
     
    twobob likes this.
  49. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Ah yeah, I meant to mention that... Fixed it in my local version and forgot.
    Nice one for the prompt fix-up.
     
  50. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    This an interesting little package... I was looking for ways to draw wireframes in game view and was directed to this. I was wondering if this would work with something like Alloy or the U5 standard shader