├── .gitignore ├── Assets ├── Rainbow.png ├── Rainbow.png.meta ├── Wireframe.mat ├── Wireframe.mat.meta ├── Wireframe.meta ├── Wireframe │ ├── UCLA GameLab Wireframe Double Sided.shader │ ├── UCLA GameLab Wireframe Double Sided.shader.meta │ ├── UCLA GameLab Wireframe Functions.cginc │ ├── UCLA GameLab Wireframe Functions.cginc.meta │ ├── UCLA GameLab Wireframe Shaders.cginc │ ├── UCLA GameLab Wireframe Shaders.cginc.meta │ ├── UCLA GameLab Wireframe.shader │ ├── UCLA GameLab Wireframe.shader.meta │ ├── UCLAGameLabWireframeMaterialEditor.cs │ └── UCLAGameLabWireframeMaterialEditor.cs.meta ├── example.unity └── example.unity.meta ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NavMeshLayers.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset ├── README.md └── docs └── example.png /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | 8 | # Visual Studio 2015 cache directory 9 | /.vs/ 10 | 11 | # Autogenerated VS/MD/Consulo solution and project files 12 | ExportedObj/ 13 | .consulo/ 14 | *.csproj 15 | *.unityproj 16 | *.sln 17 | *.suo 18 | *.tmp 19 | *.user 20 | *.userprefs 21 | *.pidb 22 | *.booproj 23 | *.svd 24 | *.pdb 25 | 26 | # Unity3D generated meta files 27 | *.pidb.meta 28 | 29 | # Unity3D Generated File On Crash Reports 30 | sysinfo.txt 31 | 32 | # Builds 33 | *.apk 34 | *.unitypackage 35 | -------------------------------------------------------------------------------- /Assets/Rainbow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/Assets/Rainbow.png -------------------------------------------------------------------------------- /Assets/Rainbow.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: faaa1865305d9b140ba4982f6ccd8035 3 | timeCreated: 1501254465 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /Assets/Wireframe.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/Assets/Wireframe.mat -------------------------------------------------------------------------------- /Assets/Wireframe.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 719be562b0ce63940b88c95be7af890c 3 | timeCreated: 1501357249 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Wireframe.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ab661d46cca98843a46828d313d4129 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Wireframe/UCLA GameLab Wireframe Double Sided.shader: -------------------------------------------------------------------------------- 1 | Shader "UCLA Game Lab/Wireframe Double Sided" 2 | { 3 | Properties 4 | { 5 | _Color ("Line Color", Color) = (1,1,1,1) 6 | _MainTex ("Main Texture", 2D) = "white" {} 7 | _Thickness ("Thickness", Float) = 1 8 | _Firmness ("Line Firmness", Float) = 1 9 | 10 | [HideInInspector] 11 | _ZWrite("_ZWrite", Float) = 1.0 12 | 13 | [HideInInspector] 14 | _Cull("_Cull", Float) = 2.0 15 | } 16 | 17 | CustomEditor "UCLAGameLabWireframeMaterialEditor" 18 | 19 | SubShader 20 | { 21 | Tags{ "RenderType" = "Transparent" "Queue" = "Transparent" } 22 | 23 | // Render back faces first 24 | Pass 25 | { 26 | Name "BACKSIDE" 27 | 28 | Blend SrcAlpha OneMinusSrcAlpha 29 | ZWrite[_ZWrite] 30 | Cull Front 31 | 32 | CGPROGRAM 33 | #include "UnityCG.cginc" 34 | #include "UCLA GameLab Wireframe Shaders.cginc" 35 | #pragma target 5.0 36 | #pragma vertex UCLAGL_vert 37 | #pragma geometry UCLAGL_geom 38 | #pragma fragment UCLAGL_frag 39 | #pragma shader_feature UCLAGL_CUTOUT 40 | #pragma shader_feature UCLAGL_DISTANCE_AGNOSTIC 41 | 42 | ENDCG 43 | } 44 | 45 | // Then front faces 46 | Pass 47 | { 48 | Name "FRONTSIDE" 49 | 50 | Blend SrcAlpha OneMinusSrcAlpha 51 | ZWrite[_ZWrite] 52 | Cull[_Cull] 53 | 54 | CGPROGRAM 55 | #include "UnityCG.cginc" 56 | #include "UCLA GameLab Wireframe Shaders.cginc" 57 | #pragma target 5.0 58 | #pragma vertex UCLAGL_vert 59 | #pragma geometry UCLAGL_geom 60 | #pragma fragment UCLAGL_frag 61 | #pragma shader_feature UCLAGL_CUTOUT 62 | #pragma shader_feature UCLAGL_DISTANCE_AGNOSTIC 63 | 64 | ENDCG 65 | } 66 | } 67 | 68 | SubShader 69 | { 70 | Tags{ "LightMode" = "ShadowCaster" } 71 | 72 | Pass 73 | { 74 | Name "SHADOWS" 75 | 76 | CGPROGRAM 77 | #define UCLAGL_CUTOUT 1 78 | 79 | #include "UnityCG.cginc" 80 | #include "UCLA GameLab Wireframe Shaders.cginc" 81 | #pragma target 5.0 82 | 83 | #pragma vertex UCLAGL_vert 84 | #pragma geometry UCLAGL_geom 85 | #pragma fragment UCLAGL_frag 86 | 87 | ENDCG 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /Assets/Wireframe/UCLA GameLab Wireframe Double Sided.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf65339624d9ffc46bd34050d17c8f58 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Wireframe/UCLA GameLab Wireframe Functions.cginc: -------------------------------------------------------------------------------- 1 | // Algorithms and shaders based on code from this journal 2 | // http://cgg-journal.com/2008-2/06/index.html 3 | // http://web.archive.org/web/20130322011415/http://cgg-journal.com/2008-2/06/index.html 4 | 5 | #ifndef UCLA_GAMELAB_WIREFRAME 6 | #define UCLA_GAMELAB_WIREFRAME 7 | 8 | #include "UnityCG.cginc" 9 | 10 | // For use in the Geometry Shader 11 | // Takes in 3 vectors and calculates the distance to 12 | // to center of the triangle for each vert 13 | float3 UCLAGL_CalculateDistToCenter(float4 v0, float4 v1, float4 v2) { 14 | // points in screen space 15 | float2 ss0 = _ScreenParams.xy * v0.xy / v0.w; 16 | float2 ss1 = _ScreenParams.xy * v1.xy / v1.w; 17 | float2 ss2 = _ScreenParams.xy * v2.xy / v2.w; 18 | 19 | // edge vectors 20 | float2 e0 = ss2 - ss1; 21 | float2 e1 = ss2 - ss0; 22 | float2 e2 = ss1 - ss0; 23 | 24 | // area of the triangle 25 | float area = abs(e1.x * e2.y - e1.y * e2.x); 26 | 27 | // values based on distance to the center of the triangle 28 | float dist0 = area / length(e0); 29 | float dist1 = area / length(e1); 30 | float dist2 = area / length(e2); 31 | 32 | return float3(dist0, dist1, dist2); 33 | } 34 | 35 | // Computes the intensity of the wireframe at a point 36 | // based on interpolated distances from center for the 37 | // fragment, thickness, firmness, and perspective correction 38 | // factor. 39 | // w = 1 gives screen-space consistent wireframe thickness 40 | float UCLAGL_GetWireframeAlpha(float3 dist, float thickness, float firmness, float w = 1) { 41 | // find the smallest distance 42 | float val = min(dist.x, min(dist.y, dist.z)); 43 | val *= w; 44 | 45 | // calculate power to 2 to thin the line 46 | val = exp2(-1 / thickness * val * val); 47 | val = min(val * firmness, 1); 48 | return val; 49 | } 50 | #endif -------------------------------------------------------------------------------- /Assets/Wireframe/UCLA GameLab Wireframe Functions.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fae11a358e6184143864aff7322aa72a 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Wireframe/UCLA GameLab Wireframe Shaders.cginc: -------------------------------------------------------------------------------- 1 | #include "UnityCG.cginc" 2 | #include "UCLA GameLab Wireframe Functions.cginc" 3 | 4 | // DATA STRUCTURES // 5 | // Vertex to Geometry 6 | struct UCLAGL_v2g 7 | { 8 | float4 pos : POSITION; // vertex position 9 | float2 uv : TEXCOORD0; // vertex uv coordinate 10 | }; 11 | 12 | // Geometry to UCLAGL_fragment 13 | struct UCLAGL_g2f 14 | { 15 | float4 pos : POSITION; // fragment position 16 | float2 uv : TEXCOORD0; // fragment uv coordinate 17 | float3 dist : TEXCOORD1; // distance to each edge of the triangle 18 | }; 19 | 20 | // PARAMETERS // 21 | 22 | float _Thickness = 1; // Thickness of the wireframe line rendering 23 | float _Firmness = 1; // Thickness of the wireframe line rendering 24 | float4 _Color = {1,1,1,1}; // Color of the line 25 | float4 _MainTex_ST; // For the Main Tex UV transform 26 | sampler2D _MainTex; // Texture used for the line 27 | 28 | // SHADER PROGRAMS // 29 | // Vertex Shader 30 | UCLAGL_v2g UCLAGL_vert(appdata_base v) 31 | { 32 | UCLAGL_v2g output; 33 | output.pos = UnityObjectToClipPos(v.vertex); 34 | output.uv = TRANSFORM_TEX (v.texcoord, _MainTex); 35 | 36 | return output; 37 | } 38 | 39 | // Geometry Shader 40 | [maxvertexcount(3)] 41 | void UCLAGL_geom(triangle UCLAGL_v2g p[3], inout TriangleStream triStream) 42 | { 43 | float3 dist = UCLAGL_CalculateDistToCenter(p[0].pos, p[1].pos, p[2].pos); 44 | 45 | UCLAGL_g2f pIn; 46 | 47 | // add the first point 48 | pIn.pos = p[0].pos; 49 | pIn.uv = p[0].uv; 50 | pIn.dist = float3(dist.x, 0, 0); 51 | triStream.Append(pIn); 52 | 53 | // add the second point 54 | pIn.pos = p[1].pos; 55 | pIn.uv = p[1].uv; 56 | pIn.dist = float3(0, dist.y, 0); 57 | triStream.Append(pIn); 58 | 59 | // add the third point 60 | pIn.pos = p[2].pos; 61 | pIn.uv = p[2].uv; 62 | pIn.dist = float3(0, 0, dist.z); 63 | triStream.Append(pIn); 64 | } 65 | 66 | // Fragment Shader 67 | float4 UCLAGL_frag(UCLAGL_g2f input) : COLOR 68 | { 69 | float w = input.pos.w; 70 | #if UCLAGL_DISTANCE_AGNOSTIC 71 | w = 1; 72 | #endif 73 | 74 | float alpha = UCLAGL_GetWireframeAlpha(input.dist, _Thickness, _Firmness, w); 75 | float4 col = _Color * tex2D(_MainTex, input.uv); 76 | col.a *= alpha; 77 | 78 | #if UCLAGL_CUTOUT 79 | if (col.a < 0.5f) discard; 80 | col.a = 1.0f; 81 | #endif 82 | 83 | return col; 84 | } -------------------------------------------------------------------------------- /Assets/Wireframe/UCLA GameLab Wireframe Shaders.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a63fcacfd6edfa14da2810825ef68e62 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Wireframe/UCLA GameLab Wireframe.shader: -------------------------------------------------------------------------------- 1 | Shader "UCLA Game Lab/Wireframe" 2 | { 3 | Properties 4 | { 5 | _Color ("Line Color", Color) = (1,1,1,1) 6 | _MainTex ("Main Texture", 2D) = "white" {} 7 | _Thickness ("Thickness", Float) = 1 8 | _Firmness("Line Firmness", Float) = 1 9 | 10 | [HideInInspector] 11 | _ZWrite("_ZWrite", Float) = 1.0 12 | 13 | [HideInInspector] 14 | _Cull("_Cull", Float) = 2.0 15 | } 16 | 17 | CustomEditor "UCLAGameLabWireframeMaterialEditor" 18 | 19 | SubShader 20 | { 21 | Tags{ "RenderType" = "Transparent" "Queue" = "Transparent" } 22 | 23 | UsePass "UCLA Game Lab/Wireframe Double Sided/FRONTSIDE" 24 | } 25 | 26 | // TODO: UsePass didn't seem to be working here? 27 | SubShader 28 | { 29 | Tags{ "LightMode" = "ShadowCaster" } 30 | 31 | // UsePass "UCLA Game Lab/Wireframe Double Sided/FRONTSIDE" 32 | Pass 33 | { 34 | CGPROGRAM 35 | #define UCLAGL_CUTOUT 1 36 | 37 | #include "UnityCG.cginc" 38 | #include "UCLA GameLab Wireframe Shaders.cginc" 39 | #pragma target 5.0 40 | 41 | #pragma vertex UCLAGL_vert 42 | #pragma geometry UCLAGL_geom 43 | #pragma fragment UCLAGL_frag 44 | 45 | ENDCG 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Assets/Wireframe/UCLA GameLab Wireframe.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 935249386717a0f4eb4857ea0c9b0700 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Wireframe/UCLAGameLabWireframeMaterialEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | using UnityEngine.Rendering; 4 | 5 | // Custom Material Editor for the UCLA Game Lab Wireframe Shader 6 | // Enables toggling "cutout" and "double-sided" rendering modes 7 | public class UCLAGameLabWireframeMaterialEditor : ShaderGUI 8 | { 9 | const string DOUBLE_SIDED_SHADER = "UCLA Game Lab/Wireframe Double Sided"; 10 | const string SINGLE_SIDED_SHADER = "UCLA Game Lab/Wireframe"; 11 | 12 | const string DISTANCE_AGNOSTIC_KEYWORD = "UCLAGL_DISTANCE_AGNOSTIC"; 13 | const string CUTOUT_KEYWORD = "UCLAGL_CUTOUT"; 14 | 15 | public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) 16 | { 17 | base.OnGUI(materialEditor, properties); 18 | 19 | Material mat = materialEditor.target as Material; 20 | 21 | EditorGUI.BeginChangeCheck(); 22 | 23 | bool cutout = EditorGUILayout.Toggle("Cutout", mat.IsKeywordEnabled(CUTOUT_KEYWORD)); 24 | bool distanceAgnostic = EditorGUILayout.Toggle("Screenspace Thickness", mat.IsKeywordEnabled(DISTANCE_AGNOSTIC_KEYWORD)); 25 | bool doubleSided = EditorGUILayout.Toggle("Double Sided", mat.shader.name == DOUBLE_SIDED_SHADER || mat.GetFloat("_Cull") == (float)CullMode.Off); 26 | 27 | if (EditorGUI.EndChangeCheck()) 28 | { 29 | if (cutout) 30 | { 31 | mat.EnableKeyword(CUTOUT_KEYWORD); 32 | mat.SetInt("_ZWrite", 1); 33 | mat.renderQueue = 2000; // Geometry render queue 34 | 35 | // Use the single pass shader if we're trying 36 | // to render double-sided && cutout because 37 | // cutout will write to depth 38 | mat.shader = Shader.Find(SINGLE_SIDED_SHADER); 39 | mat.SetInt("_Cull", (int) (doubleSided ? CullMode.Off : CullMode.Back)); 40 | } 41 | else 42 | { 43 | mat.DisableKeyword(CUTOUT_KEYWORD); 44 | mat.SetInt("_ZWrite", 0); 45 | mat.renderQueue = 3000; // Transparent render queue 46 | 47 | // Use the double pass shader if we're 48 | // trying to render double-sided 49 | mat.shader = Shader.Find(doubleSided ? DOUBLE_SIDED_SHADER : SINGLE_SIDED_SHADER); 50 | mat.SetInt("_Cull", (int) CullMode.Back); 51 | } 52 | 53 | // Toggle 54 | if (distanceAgnostic) mat.EnableKeyword(DISTANCE_AGNOSTIC_KEYWORD); 55 | else mat.DisableKeyword(DISTANCE_AGNOSTIC_KEYWORD); 56 | } 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /Assets/Wireframe/UCLAGameLabWireframeMaterialEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91d9f73ac2c17a3478aebe05790dbc04 3 | timeCreated: 1501294739 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/example.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/Assets/example.unity -------------------------------------------------------------------------------- /Assets/example.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52b07531d14f47548aab43af60fc70f2 3 | timeCreated: 1503258460 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshLayers.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/NavMeshLayers.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2017.1.0f3 2 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # unity-wireframe-shader 2 | ![example](/docs/example.png) 3 | 4 | Unity wireframe material using Geometry Shaders built for the [UCLA Game Lab](http://games.ucla.edu/resource/unity-wireframe-shader/) and [Unity Asset Store](https://assetstore.unity.com/packages/vfx/shaders/directx-11/ucla-wireframe-shader-21897) in 2013. 5 | 6 | Based on work from [this paper](http://cgg-journal.com/2008-2/06/index.html) (which is no longer available -- a web-archive version is available [here](http://web.archive.org/web/20130322011415/http://cgg-journal.com/2008-2/06/index.html)) 7 | 8 | ## Use 9 | Renders a line along every edge between every vertex. Requires Geometry Shaders, so this only works on DX11. 10 | 11 | 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. 12 | 13 | ### Requirements 14 | 15 | This material uses the geometry shader, which is only available with DirectX in Unity. 16 | 17 | ## Wireframe Options 18 | #### Thickness 19 | How thick the wireframe line is. 20 | 21 | #### Line Firmness 22 | How firm the edges of the wireframe line are when rendering _without_ cutout enabled. 23 | 24 | #### Cutout 25 | Whether or not to discard pixels outside the wireframe, creating a harder and aliased edge, but can draw to depth in a single pass. 26 | 27 | #### Screenspace Thickness 28 | Whether or not the wireframe line should be a consistent thickness in screenspace while the camera moves. 29 | 30 | #### Double Sided 31 | Whether or not to draw the back faces with wireframe or not 32 | 33 | ## Extending and Reuse 34 | 35 | The functions used to generate the wireframe are available in the [UCLA GameLab Wireframe Functions.cginc](Assets/Wireframe/UCLA%20GameLab%20Wireframe%20Functions.cginc) so they can easily be added to and used with other shaders and functions. 36 | -------------------------------------------------------------------------------- /docs/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkjohnson/unity-wireframe-shader/130faf4f6e3828819ac1f16d43e576e3640ddccf/docs/example.png --------------------------------------------------------------------------------