Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

► Wireframe shader - The Amazing Wireframe shader ◄

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

  1. megapode

    megapode

    Joined:
    May 4, 2021
    Posts:
    10
    so that works as long as I only have 1 plane in the scene. I need to have this effect running on multiple groups but the wipe is at different speeds. The dissolve is working correctly with 2 planes moving at different speeds. However, wireframe wipe only seems to correspond to one of the planes, even though they have been set in the scripts and materials as plane1 and plane2 correctly...

    Which is all part of how shaders work... they are both adjusting the same keyword parameter... I need 2 shaders if I have 2 planes - study and learn...

    back to the drawing board for a bit... :D
     
    Last edited: Nov 8, 2021
  2. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    Do not modify included script, changes will affect other scenes and materials. Instead, invert plane mask from ShaderGraph - Plane (Mask) node has invert property, use value of 1 there.



    Amazing Assets - YouTube Facebook Twitter
     
  3. megapode

    megapode

    Joined:
    May 4, 2021
    Posts:
    10
    thanks and this is the difference between knowing how it works and hacking a solution :D
    I will revert the script to what it should be and try and understand the actual shader graph to make it work correctly.
    I will then explore further on the proper way to have more than one plane causing the wipe effect... It is something to do with the variable names, I can see that... Can I create a second instance of the effect and have a different variable name in the shadergraph? I think it is the .cginc script in reality?
     
  4. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    You can create as many materials as you need, each one with its own mask. Just update those masks and materials using separate MaksController scripts.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Nov 9, 2021
  5. megapode

    megapode

    Joined:
    May 4, 2021
    Posts:
    10
    Screenshot 2021-11-09 164525.png thanks for the swift response Arkhivrag, but I think I must be doing something silly then...

    I have 2 different materials and 2 different plane masks. I have 2 different mask controller scripts but because they both have the same line:

    materials.SetVector("_WireframeShaderMaskPlanePosition", maskObject.position);

    then the plane is set the same on both of them even though Plane1 and Plane2 move at different speeds...

    As you can see, the dissolve effect is correctly following the Plane location but the Wireframe is following the right side plane, even though the left wireframe controller is set to plane2 and the right one to plane1

    Do I need to set up the above variable as something like WireframeShaderMaskPlane1Position and then in the other shader/material I would set up a WireframeShaderMaskPlane2Position?

    sorry for the silly questions but also thanks for all the help!
     
    Last edited: Nov 9, 2021
  6. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    I have just re-checked shaders and it is definitely not possible to update multiple wireframe masks. Only one mask works.
    Something has been changed inside ShaderGraph (or rendering core files) since creating wireframe nodes for it and I need to re-write them.

    [Edit]
    Problem is in SRP, built-in RP works without problems.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Nov 9, 2021
    megapode likes this.
  7. megapode

    megapode

    Joined:
    May 4, 2021
    Posts:
    10
    Once again, thank you for the help. Glad to know that it is not just me doing something wrong :D Think I have a long winter ahead of me trying to understand the whole shader graph stuff!
     
  8. VeryBadPenny

    VeryBadPenny

    Joined:
    Jun 3, 2018
    Posts:
    19
    Hi - I have a very nice wireframe object (thank you Davit for this great set of assets!).

    I am using Standard (Wire Only With GI) shader.

    I would like to vary the Wireframe Thickness at run time in a simple script; is this possible and is there an example maybe? I have a feeling it might not be possible in a simple C# script... but always worth asking...

    Thanks in advance!
     
  9. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    Use Material.SetFloat().
    Name of thickness property is _WireframeShader_Thickness



    Amazing Assets - YouTube Facebook Twitter
     
  10. VeryBadPenny

    VeryBadPenny

    Joined:
    Jun 3, 2018
    Posts:
    19
    Still needs some tweaking but very cool, thanks for the simple & fast reply!

    TigerDeployment.gif
     
  11. ashwinoccupiedvr

    ashwinoccupiedvr

    Joined:
    Sep 16, 2021
    Posts:
    5
    Hello, I'm not able to generate a wireframe mesh using the mesh generator window. When I hit the run buttton, I get a prefab with the standard (cutout wire) shader and no matter which settings I change, it does not show up (object on the right in the image attached). Could you please tell me how to fix this?

    Engine: 2020.3.22f1
    HDRP: 10.7
     

    Attached Files:

    • fav.png
      fav.png
      File size:
      221.1 KB
      Views:
      115
  12. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    Standard (cutout wire) shader requires diffuse texture with alpha channel to render wireframe in the place of dissolved(cutout) pixels. Assign diffuse texture to the generated material or use other shader.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Nov 25, 2021
  13. ashwinoccupiedvr

    ashwinoccupiedvr

    Joined:
    Sep 16, 2021
    Posts:
    5
    I've tried all shaders in the pack and they only show a base color and no wireframe unfortunately
     
  14. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    Is problem with that particular model, or with others too? Are there any errors or warnings in the Console window?



    Amazing Assets - YouTube Facebook Twitter
     
  15. ashwinoccupiedvr

    ashwinoccupiedvr

    Joined:
    Sep 16, 2021
    Posts:
    5
    No warnings or errors. Tried with custom assets and Unity primitives
     
  16. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    Do included example scenes work?
    What about 6. Runtime example scene?



    Amazing Assets - YouTube Facebook Twitter
     
  17. ashwinoccupiedvr

    ashwinoccupiedvr

    Joined:
    Sep 16, 2021
    Posts:
    5
    They work fine in the example scenes as long as I don't touch any parameter in the materials. As soon as I change one of those, the wireframe disappears.

    Some shaders have a floating point division by zero error but the ones that do not still suffer from this issue
     
    Last edited: Nov 27, 2021
  18. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    It is very strange behavior.
    Contact me on the support email (support@amazingassets.world) with asset purchase invoice and will continue discussion there.



    Amazing Assets - YouTube Facebook Twitter
     
  19. sachithkp

    sachithkp

    Joined:
    Jun 7, 2021
    Posts:
    12
    I was using the Wireframe Shader in one of our projects. We are using Curvy Worl Asset also.

    When we take the WebGL output after making necessary changes inside Wireframe Shader to make it compatible with Curvy World a pink color is shown up.

    Could you please let us know how to tweak this?
     
  20. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    Was wireframe shader working in WebGL before you modified it?



    Amazing Assets - YouTube Facebook Twitter
     
  21. Wintermute-

    Wintermute-

    Joined:
    Sep 5, 2017
    Posts:
    45
    Hello,

    I ran into a problem with Wireframe Shader in HDRP using Unity 2021.2.7f1 in the sample scene the wireframe is not visible. I reimported the shader folders and also tried to save the shader again in shader graph, but it is still not appearing. I am using HDRP 12.1.2

    Could it be because of the HDRP version? I can move the project version back if necessary.
     

    Attached Files:

  22. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    Wireframe shader has not been updated for Unity 2021.2 yet, but it looks like ShaderGraph has lost Dynamic Mask property there after updating. Try, open shader and enable Exposed checkbox:
    upload_2022-1-6_14-35-26.png

    Save shader and inside material editor re-select Dynamic Mask keyword to be None.



    For any additional problems in unsupported Unity versions: Make sure wireframe is visible to a shader, check UV3 channel (here is saved wireframe data)
    upload_2022-1-6_14-42-3.png
    If mesh is rendered as in the image above, it means that mesh generator is working correctly and wireframe data is saved inside mesh.
    Now replace UV node with wireframe node (Create Node -> Amazing Assets -> Wireframe Shader -> Read Wireframe).
    Shader should render wireframe.
    upload_2022-1-6_14-42-45.png



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Jan 6, 2022
    Wintermute- likes this.
  23. sansari64

    sansari64

    Joined:
    Feb 15, 2014
    Posts:
    4
    Hi there @Arkhivrag

    Just using the shader pack in a Unity project and I'd like to programmatically change the color. I've done this using materialpropertyblocks in other shaders but I can't get it to work for The Amazing Wireframe/Mobile/One Directional Light/Addative/Simple/Wire Only

    The inspector looks like this:

    upload_2022-2-7_19-2-19.png

    and I want to change the "Color" which is currently blue to something else. I'm using this code:

    Code (CSharp):
    1.            
    2. props = new MaterialPropertyBlock();
    3. Color newColor = Color.red;
    4. newColor.a = 1;
    5. props.SetColor("Color", newColor);
    6. renderer.SetPropertyBlock(props);
    7.  
    but it doesn't do anything, can you or anyone else suggest a way to do this?

    Cheers
     
  24. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    Wireframe color property name inside shader is _Wireframe_Color
    Material property blocks may not work as they are not implemented. In this case you have to integrate wireframe effect manually inside any hand written shader or Amplify Shader, all info in manual file page 13.



    Amazing Assets - YouTube Facebook Twitter
     
  25. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    160
    hello.
    The store page says
    • Mobile, console and VR ready
    But the documentation says :
    • for the runtime shader you need geometry shaders to be compatible.
    But Metal for iOS doesn't support geometry shaders. So the runtime version doesnot work for iOS ?
     
  26. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    Package includes collection of geometry shaders that calculate and render wireframe directly from shader. Those shaders do not need anything to be baked inside a mesh, but require device with geometry shaders support.
    Those shaders are free addon for built-in RP and are not mentioned on the store page.

    Main shaders do require wireframe to be baked inside a mesh (as written on the store page). Those shaders work on any device, have no any requirements or limitations and can be integrated into ShaderGraph and Amplify Shader Editor.
    So if you are targeting iOS, bake wireframe inside a mesh and use 'non geometry shader'.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Apr 5, 2022
  27. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    160
    Thank you for the clarification. But I needed it at runtime for ARMeshing. I will find another solution. Thank you.
     
  28. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
  29. RFLG

    RFLG

    Joined:
    Feb 7, 2011
    Posts:
    127
    Hello, I'm having an issue with Curved 2020 and Amazing Wireframe shader. In essence, separately they both work great, but together I can't bend, twist or turn the wireframes.

    I might be wrong, but a while back this used to be a seamless operation, right? What am I missing?

    As for steps, I'm just changing a shader on the Curved 2020 examples to Amazing Wireframe--> Mobile--> Unlit. After this change, any objects that have it applied will no longer do any of the Curved modifications.

    Can anyone advise on this? Thanks!
     
  30. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    Did you activate Wireframe shaders from Curved World editor window -> Activate?



    Amazing Assets - YouTube Facebook Twitter
     
  31. RFLG

    RFLG

    Joined:
    Feb 7, 2011
    Posts:
    127
    Hello, I'm having an issue wit
    I think so, I used the activate tool targeting the Assets folder (where Wireframe is) and it said a bunch of files where activated. However the shader still didn't work.

    So, is it supposed to work out-of-the-box, correct?
     
  32. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    And which Unity version are you using?

    Do you have enabled proper Bend Type and Bend ID inside material editor of that wireframe shader?



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: May 4, 2022
  33. RFLG

    RFLG

    Joined:
    Feb 7, 2011
    Posts:
    127
    Hello, I'm having an issue wit
    I'm using Unity 2021.3 and I don't recall having the Bend Type and Bend ID options on the wireframe shaders, but I'll check again.
     
  34. Digimaster

    Digimaster

    Joined:
    Aug 8, 2017
    Posts:
    4
    But unfortunately it has limitations: "Those shaders require device with Shader Model 5.0 and GeometryShaders support. Currently dynamic wireframe rendering is supported only by Built-in render pipeline." (Manual of the wireframe shader package)
     
  35. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,750
    Run-time generated and baked wireframe does not need SM5 and has no limitations. It works on any device.
     
    Last edited: Aug 6, 2022 at 5:43 PM
unityunity