Skip to content

gkjohnson/unity-wireframe-shader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unity-wireframe-shader

example

Unity wireframe material using Geometry Shaders built for the UCLA Game Lab and Unity Asset Store in 2013.

Based on work from this paper (which is no longer available -- a web-archive version is available here)

Use

Renders a line along every edge between every vertex. Requires Geometry Shaders, so this only works on DX11.

Only renders wireframe. Two passes can be rendered to render wireframe on top of another solid material or shader can be easily modified to render both in the same pass.

Requirements

This material uses the geometry shader, which is only available with DirectX in Unity.

Wireframe Options

Thickness

How thick the wireframe line is.

Line Firmness

How firm the edges of the wireframe line are when rendering without cutout enabled.

Cutout

Whether or not to discard pixels outside the wireframe, creating a harder and aliased edge, but can draw to depth in a single pass.

Screenspace Thickness

Whether or not the wireframe line should be a consistent thickness in screenspace while the camera moves.

Double Sided

Whether or not to draw the back faces with wireframe or not

Extending and Reuse

The functions used to generate the wireframe are available in the UCLA GameLab Wireframe Functions.cginc so they can easily be added to and used with other shaders and functions.