D
D
Documentation
Wireframe Shaders
Search…
⌃K
Links

How To Use

There are 3 types of wireframe rendering to choose from:

1) Dynamic Wireframe

To use, just create material from shader called DynamicWireframe, and drop it on the object. Dynamic wireframe utilizes geometry shader, so it needs at least shader model 4.0 to work. Note, that Metal, do not support geometry shaders, so this shader won't work on IOS or Mac.
You can drop this shader at any mesh, and it will draw only wireframe and unlit color, without textures or lighting.
Dynamic wireframe will always keep the same size, because of that, wireframes will remain sharp even when you are really close to it.

2) Wireframe baked inside mesh

To use it, you must bake barycentric coordinates into uv channel of the mesh. You can easily do this with Bake Into Uv Channel tool.
UvBakedWireframe node has also one parameter called Stable Thickness, it can be used to determine, whether or not, you want the wireframe to dynamically fade out , and remain the same size over distance from it. You should keep value of this parameter in the range 0 to 0,1.
You can find also Amplify Shader Editor version of this node.
Wireframe baked inside mesh will always remain sharp even when you are really close to it. If Stable Thickness is set to 0, wireframe will also, always keep the same size.
Example usage

3) Wireframe baked into texture (only URP)

You can generate wireframe, using Bake Into Texture tool, and then use this baked texture just as normal texture on any mesh, without baking wireframe inside mesh.
Becouse of the fixed size of the texture, you can see pixelated wiereframe, when you look close enough. So it is adviced, to use as big image size as you can, to accomplish satisfying effect. (in most cases 2048x2048 is enough)

Notes:

  • Each way of rendering wireframe is compatible with skinned meshes with animations and meshes with multiple materias (submeshes).
  • You can find examples of all shaders in the Demo scene.
  • If a mesh doesn't have uvs, wireframes won't work
  • Currently, HDRP do not support baking wireframe into textures.
  • Shader graphs included are just examples of usage of UvBakedWireframe node and baked wireframe textures. If you want to use one of these sample shaders, you should be aware that it must have normal and metallic textures. If you don't want to provide materials with these textures, you should create your own shader graphs variants, where you delete normal texture and/or replace metallic texture with slider.

Tips:

  • When you are rendering objects in transparent mode, you can change the materials render queue in URP, and sorting priority in HDRP, to specify the order of rendering these materials. Check Demo/Grenadier/Materials/Transparent for examples.

Sphere mask

Asset also includes an example of rendering wireframe with sphere mask, along with a script to control this behavior with a game object position.
You can choose between 2 versions of shader with sphere mask: UVBakedBRMask and UVBakedBRMaskBlend. First shader adds wireframe color on top of the object when within range of the sphere, second let's you supersede the object albedo texture with color.
Remember, to add materials you want to be occluded with sphere mask to List Materials With Sphere Mask. You can just drag and drop the materials from projects folder.

Parameters:

  • Radius - Radius of the sphere mask.
  • Hardness - Hardness of the sphere mask .
Both parameters are automatically set inside shaders when you modify them.