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

► 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,972
    Wireframe data is generated per-vertex and depending on mesh triangle structure - vertex count may increase.
    Example of good triangle structure is plane mesh and wireframed mesh has same vertex count.
    While wireframe generator does its best to keep vertex count low some times it is not possible and if generated mesh vertex count goes beyond Unity limit 65000 it will return 'null' mesh (console window prints warning about that).
    Just split high poly mesh into two peace and generator will work.



    VacuumShaders - Facebook Twitter YouTube
     
  2. sameer-mirza

    sameer-mirza

    Joined:
    Nov 14, 2011
    Posts:
    36
    I'm using Assimp to optimize the meshes and I break them on vertex count 65535. I find the mesh generated by Wireframe Generator to be slightly less optimized (more verts/tris) than the one optimized by assimp. Is there a way to tell the generator to not modify the verts/tris and simply add the Wireframe data to existing structure?
     
  3. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    Wireframe data can not be just added to an existing mesh structure, it is generated for each vertex. And as I wrote above depending on triangle structure - vertex count may increase.
    Just break mesh not on 65535 vertex count but some low value, for example 40k or 50k and try generator on it.



    VacuumShaders - Facebook Twitter YouTube
     
  4. sameer-mirza

    sameer-mirza

    Joined:
    Nov 14, 2011
    Posts:
    36
    Please check your PM! Thanks! :)
     
  5. vj dudley smith

    vj dudley smith

    Joined:
    Jan 11, 2016
    Posts:
    2
    I planned to buy and use it, but I got the issue with constant pink shader in the demo scene.
    The parameter tab for the shader is perfectly blank, no options or parameter.

    What's the point ?
    Is the right file missing ? Am i failing something in my assets paths ?

    Thanks
    Seb
     
    Last edited: Jan 11, 2016
  6. vj dudley smith

    vj dudley smith

    Joined:
    Jan 11, 2016
    Posts:
    2
    After fresh install, it is ok.

    It looks great.
    Are the features transparent and the barycentric converter in the demo ? how can we see the content of the full package ?
     
  7. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    Example demo contains only one opaque shader and meshes with already generated wireframe data.
    Example demo is for testing shader on your device.



    VacuumShaders - Facebook Twitter YouTube
     
  8. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    Last edited: Sep 3, 2016
  9. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    One of the new features for v2.0 - Wireframe projector.


    Effect is achieved with Unity built-in projector, but with Wirefame shader.



    VacuumShaders - Facebook Twitter YouTube
     
  10. KeithT

    KeithT

    Joined:
    Nov 23, 2011
    Posts:
    83
    Trying to get the shader working with dynamic mesh creation. The 3 sequential images show the result with a default shader, the vacuum preview shader and then the vacuum transparent 2 sided no tex, (which is the one we want like the green troll in the examples) which shows nothing.

    The shader seems to be complaining that there is no buffer defined, although when the material has the preview shader attached it has color selected, but this then seems to disappear when the shader is change.

    The object selected in the Editor is the prefab that is dynamically loaded to create the mesh seen in the Game window

    Any suggestions gratefully received.............





     
  11. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    MeshFilters has no mesh attached, shaders will render nothing.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Jan 22, 2016
  12. KeithT

    KeithT

    Joined:
    Nov 23, 2011
    Posts:
    83
    Thanks, but as said in the original post, the mesh is dynamically generated and the images above show the set up of the prefab. When the prefab is instantiated the meshfilter has a mesh assigned. This approach is shown working in the first 2 images above which have the identical setup and where the meshes are rendered (including the 2nd example where the wireframe shader is in use with the preview material).

    Images below are examples where the prefab has been instantiated with the mesh being visible with the preview but nothing shown in the transparent 2 sided shader.

    Thanks in advance for any other suggestions why the transparent 2 sided shader does not work.........



     
  13. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    Can you test shader on simple mesh, for example on Unity built-in primitives (with generated wireframe data of course)?

    EDIT:
    Just tested on latest version of Unity and it works.
    May be problem is in your mesh? Does it have wireframe data generated and saved inside Color or Tangent buffers?
    transparent 2 sided.png


    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Jan 25, 2016
  14. KeithT

    KeithT

    Joined:
    Nov 23, 2011
    Posts:
    83
    The shaders work fine on the example project. Our problem is to try and get it working on the project we bought it for, which uses dynamic meshes.

    Our understanding from the docs is that we need to use the "TheAmozingWireframeGenerator" script for dynamic meshes. This we have done but the shader complains the buffer is not defined. Do we need to do something else to initialise it? See attached.

     
  15. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972

    That's what I am saying - shader works.
    Problem is in mesh you want to render using wireframe shader. Mesh must have barycentric coordinates saved inside Color or Tangent buffers, if mesh has no such data - it will not be rendered (or rendered with wrong/unpredictable effect).
    The simplest way to detect if mesh has wireframe data is:
    1. Material editor (in your images it displays "Buffer Not Defined" - means no wireframe data is available)
    2. Use simplest wireframe shader - (Preview) Color and Tangent

    TheAmizingWireframeGenerator is run-time script for wireframe data generating, it works when entering Play mode (check script source).
    To generate wireframed mesh inside editor use gear icon on the top-left side of material editor and choose Generate Wireframe Mesh.



    VacuumShaders - Facebook Twitter YouTube
     
  16. KeithT

    KeithT

    Joined:
    Nov 23, 2011
    Posts:
    83
    The mesh we want to use the shader on is dynamic i.e. it is created at run-time. The mesh and therefore any barycentric coordinates are therefore not available in the editor (before play/run-time is started). This is why we chose to use the AmazingWireframeGenerator script. Hence the question if there is anything else to do besides including the script on the prefab to tell the script which buffer to use and generate the barycentric coordinates.
     
  17. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    That's the only way.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Jan 25, 2016
  18. KeithT

    KeithT

    Joined:
    Nov 23, 2011
    Posts:
    83
    We are using the AmazingWireframeGenerator and it does not work. If you look at the posted images you can see it is on the gameobject, but nothing is rendered. That's why we are asking for support, to try and work out what the problem is.....
     
  19. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    1. Put AmazingWireframeGenerator script on mesh (try on Unity Built-in primitive) without your dynamic generator script.
    2. Assign wireframe shader.
    3. Enter Play mode.

    Does it renders proper wireframe?



    VacuumShaders - Facebook Twitter YouTube
     
  20. KeithT

    KeithT

    Joined:
    Nov 23, 2011
    Posts:
    83
    Yes that works, and the buffer on the shader is set to "Using Color Buffer" on Play mode,
     
  21. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    So both AmazingWireframeGenerator script and shader works!
    So problem is in your project, or scrips or in something else, and not in product that I offer.



    VacuumShaders - Facebook Twitter YouTube
     
  22. KeithT

    KeithT

    Joined:
    Nov 23, 2011
    Posts:
    83
    We have made some progress with this by calling WireframeManager.Generate() after make changes to the procedural mesh we are trying to get the shader working with. It now renders the mesh similar to when the shader is setup on a static mesh before going into PlayMode, but still refuses to populate the buffer variable.

    Do we need to call WireframeManager.RemoveMesh() before calling Generate?

    As a test, we saved the procedural meshes created at runtime and then manually applied the shader in the Editor. This worked fine, as can be seen below. So we therefore still think it's possible, we just need to sort out why the barycentric coordinates are not being updated at runtime when Generate is called.

    Any suggestions gratefully received.

     
    Last edited: Jan 26, 2016
  23. KeithT

    KeithT

    Joined:
    Nov 23, 2011
    Posts:
    83
    Scratch that, it works if you call RemoveMesh before Generate.
     
  24. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    @KeithT
    Note, run-time generator script was not designed to be used in every frame (Update function). It is too low for that and uses to much memory.

    For that purpose you will have to wait for v2.0. It has new redesigned fastest algorithm with 0 memory usage.
    v2.0 release date: about second half of the February.



    VacuumShaders - Facebook Twitter YouTube
     
  25. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    v2.0 has new fastest run-time wireframe generator and 0 memory usage.


    Edit
    Scene will be included in the package as an example.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Jan 28, 2016
  26. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
  27. julienrobert

    julienrobert

    Joined:
    Sep 15, 2014
    Posts:
    65
    Is it possible to get rectangular meshes instead of triangles ?
     
  28. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Email sent! :)
     
  29. Excelerator

    Excelerator

    Joined:
    Nov 14, 2013
    Posts:
    37
    I'd also be interested in the beta. (sent an email already)

    Not sure if this was a bug in Unity5, but I found something that looked pretty neat.
    http://explosivedrive.com/wp-content/uploads/2016/02/dgtl.png

    I noticed the fog doesn't work, so there's no hope in me darkening the mountains in that picture.
     
    Last edited: Feb 3, 2016
  30. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    Only triangles.

    Current version is done in Unity 4 and is not fully compatible with Unity 5, they may be some issues.
    Soon will be available new version that will fix all that problems.

    I'm working on beta version, will be available in two days.



    VacuumShaders - Facebook Twitter YouTube
     
  31. julienrobert

    julienrobert

    Joined:
    Sep 15, 2014
    Posts:
    65
    Can you explain me how to set the color value of the wire color with script?
    I tried GetComponent<Renderer> ().material.color; but I get the error Material doesn't have a color property '_Color'

    Thanks
     
  32. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    _V_WIRE_Color
    If you open shader file you will find there all variable names.



    VacuumShaders - Facebook Twitter YouTube
     
  33. julienrobert

    julienrobert

    Joined:
    Sep 15, 2014
    Posts:
    65
  34. julienrobert

    julienrobert

    Joined:
    Sep 15, 2014
    Posts:
    65
    Once the wireframe mesh is generated, the blendshapes keep working but the rotation (using the root bone) doesn't work. Is it normal? Is there something I can do about it?
     
  35. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    Is not root bone part of SkinnedMeshRenderer component?
    All mesh bones and bind poses remains untouched after generating wireframe.



    VacuumShaders - Facebook Twitter YouTube
     
  36. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    code-blep likes this.
  37. julienrobert

    julienrobert

    Joined:
    Sep 15, 2014
    Posts:
    65
    Thanks for clarification. I tested with the beta version. The bone works after the wireframe mesh generated. Now, it's the blendshapes that disappear as soon as I select the generated mesh...? If I reselect the original mesh, the blendshapes appear again... what am I doing wrong?
    (sorry of been newbie, my questions might be basic)
     
  38. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    Blend shapes have never been supported by Wireframe shader (it is the only one not supported feature), there just was now API available in Unity Engine until 5.3
    Unity just made blend shapes API public and I had no time to make research on it.
    Can not also guarantee that it will be added in Wireframe shader v2.0, may be in later version, can not say.



    VacuumShaders - Facebook Twitter YouTube
     
  39. julienrobert

    julienrobert

    Joined:
    Sep 15, 2014
    Posts:
    65
    I tried again with version 1 and the blendshapes work (as it always did) and, I don't how I did this, the problem with the rotation has gone...

    Found out that the rotation bones go away when I build the wireframe mesh with "use buffer tangent" selected. Am I wrong or the vertex shaders only work with a wireframe mesh built with tangent instead of color selected?
     
    Last edited: Feb 17, 2016
  40. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Any news about my beta! :)
     
    Last edited: Feb 9, 2016
  41. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
  42. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
  43. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    kenshin likes this.
  44. skullthug

    skullthug

    Joined:
    Oct 16, 2011
    Posts:
    202
    If I buy Wireframe Shader (1) will I get 2 for free? Or should I just wait for 2?
    I'd like to grab this for my Unity 5 project, but as you mentioned Unity5 support isn't quite there in the 1st version.

    FYI the free tryout package you list in the store description doesn't seem to work in Unity 5 (5.3.2p1). Pinktown.
     
  45. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    v2 will be free update.
    If you purchase asset now and send invoice to vacuumshaders@gmail.com you will get beta version of v2 too.

    As for free example shaders not work in Unity 5.3, I'll have access to the source only on Thursday and will look at it.



    VacuumShaders - Facebook Twitter YouTube
     
  46. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    will V2 stay at the same price in the asset store?
     
  47. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    Price will be the same.



    VacuumShaders - Facebook Twitter YouTube
     
    Hormic likes this.
  48. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    gurayg and Hormic like this.
  49. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,972
    v2.0 relesed
    • Unity 5 ready (5.3.2 and above)
    • Not compatible with previous version. Neither shaders nor wireframed meshes. Delete previous version before updating.
    • SM2 is not supported any more.
    • Wireframe data (barycentric coordinates) now are saved inside mesh UV0 buffer (under uv[2] and uv[3] indexes).
    • Color and tangent buffers are not used any more by shader.
    • Shader baking is not necessary any more. Removed.
    • Added mesh batch converter tool.
    • Added PBR shaders.
    • Added wireframe projector shader.
    • Wireframe color supports HDR.
    • Gradient feature replaced with new Dynamic Mask feature.
    • Added fast run-time (per-frame) wireframe generator.
    • Improved transparent and cutout shader quality.
    • New improved material editors.
    • Shaders are Curved World compatible.



    VacuumShaders - Facebook Twitter YouTube
     
  50. Hardwires

    Hardwires

    Joined:
    Jun 27, 2014
    Posts:
    4
    I updated to 2.0 and now I can't seem to get anything but pink:


    I've imported everything correctly. (Well, everything but the example scenes) I've also created a wireframe mesh for the object but since it's obvious that the shader itself isn't working, I guess that's a moot point. What should I do to try and fix this? Thanks.