Shader "Custom/WireframeURP" { Properties { _MainTex ("Texture", 2D) = "white" {} _LineColor("Line Color", Color) = (1, 1, 1, 1) _BGColor("Background Color", Color) = (0, 0, 0, 0) _LineWidth("Line Width", Range(0,0.1)) = 0.005 } SubShader { Tags { "RenderType"="Opaque" } LOD 100 Pass { Name "Wireframe" CGPROGRAM #pragma vertex vert #pragma fragment frag #pragma target 3.0 #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" struct appdata { float4 vertex : POSITION; float3 barycentric : TEXCOORD0; // Barycentric coordinates for wireframe }; struct v2f { float2 uv : TEXCOORD0; float3 barycentric : TEXCOORD1; float4 vertex : SV_POSITION; }; sampler2D _MainTex; float4 _MainTex_ST; float4 _LineColor; float4 _BGColor; float _LineWidth; v2f vert (appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = v.barycentric.xy; o.barycentric = v.barycentric; return o; } half4 frag (v2f i) : SV_Target { half3 bary = i.barycentric; bary = fwidth(bary) * _LineWidth + bary; half mask = step(1, abs(bary.x) + abs(bary.y) + abs(bary.z)); half4 col = lerp(_LineColor, _BGColor, mask); return col; } ENDCG } } }