Decal shader: z-fighting when camera axis is parallel to normal axis

I’ve created a basic decal shader (see below; it’s just the default new shader with a couple modifications). It usually works well, but if the camera axis is parallel to the normal axis of the polygon(s) the material using the decal shader is applied to, z-fighting occurs when the camera moves.

Example (z-fighting when camera axis is parallel to normal axis of plane; fine otherwise):
97349-decaltestdemo-smaller.gif

Here’s a simple project (used to record the GIF above) that demonstrates the issue:

[97346-decaltest.zip|97346]

I’m wondering if this might be related to my video card rather than the decal shader itself or Unity, so attempts to replicate using the demo project would be appreciated! (For what it’s worth, my video card’s drivers are up-to-date, but the card itself is a few years old at this point.)

Decal shader for reference:

Shader "Custom/DecalShader" {
	Properties {
		_Color ("Color", Color) = (1,1,1,1)
		_MainTex ("Albedo (RGB)", 2D) = "white" {}
		_Glossiness ("Smoothness", Range(0,1)) = 0.5
		_Metallic ("Metallic", Range(0,1)) = 0.0
	}
	SubShader {
		Tags { "RenderType"="Transparent" "ForceNoShadowCasting"="True"}
		LOD 200
		Offset -1, -1
		
		CGPROGRAM
		// Physically based Standard lighting model, and enable shadows on all light types (added decal:blend)
		#pragma surface surf Standard fullforwardshadows decal:blend

		// Use shader model 3.0 target, to get nicer looking lighting
		#pragma target 3.0

		sampler2D _MainTex;

		struct Input {
			float2 uv_MainTex;
		};

		half _Glossiness;
		half _Metallic;
		fixed4 _Color;

		void surf (Input IN, inout SurfaceOutputStandard o) {
			// Albedo comes from a texture tinted by color
			fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
			o.Albedo = c.rgb;
			// Metallic and smoothness come from slider variables
			o.Metallic = _Metallic;
			o.Smoothness = _Glossiness;
			o.Alpha = c.a;
		}
		ENDCG
	} 
	FallBack "Diffuse"
}

What is your depth buffer range? (what’s your near and far clipping values?)

The Offset parameter can only help to avoid z-fighting but can’t prevent it when the numbers are to high.

So try to increase your near-clipping plane or decrease your far-clipping plane. Alternatively you can increase your Offset in your shader, mainly the second parameter:

Offset -1, -2