Quick answer: The most common cause is a render pipeline mismatch. If you created a Shader Graph for URP but your project uses HDRP or the Built-in pipeline, the preview renders black because the master node targets a pipeline that is not active.
Here is how to fix Unity shader graph preview black screen. You open a Shader Graph in Unity and the main preview sphere is completely black. Node previews may also be black or missing. The shader compiles without errors but nothing renders in the preview window. This is typically caused by a render pipeline mismatch, incorrect master node configuration, or precision issues that produce invalid values on your target platform.
Why Shader Graph Previews Go Black
Shader Graph previews use a mini rendering context that matches your project's active render pipeline. The preview compiles the shader, creates a temporary material, and renders a sphere or quad with that material. If any part of this pipeline fails silently, the result is a black preview. Unlike shader compilation errors which show pink, a black preview means the shader compiles but produces no visible output.
The three main causes are: the shader targets a render pipeline that is not active in your project, the master node surface settings produce an invisible result (like transparent with zero alpha), or precision mode creates NaN values that the GPU renders as black.
Render Pipeline Mismatch
This is the number one cause of black Shader Graph previews. Unity supports three render pipelines: Built-in, URP (Universal), and HDRP (High Definition). Each pipeline has its own Shader Graph target. A shader created for URP will not render in an HDRP project and vice versa.
Open your Shader Graph and check the Graph Inspector panel (top right). Under Graph Settings, look at Active Targets. This must match your project's render pipeline.
// Check which render pipeline is active in your project
using UnityEngine;
using UnityEngine.Rendering;
public class PipelineCheck : MonoBehaviour
{
void Start()
{
var pipeline = GraphicsSettings.currentRenderPipeline;
if (pipeline == null)
{
Debug.Log("Using Built-in Render Pipeline");
}
else
{
Debug.Log($"Using: {pipeline.GetType().Name}");
// UniversalRenderPipelineAsset = URP
// HDRenderPipelineAsset = HDRP
}
}
}
If your project uses URP but the Shader Graph targets HDRP, remove the HDRP target from Active Targets and add Universal. Click Save Asset after making the change. The preview should immediately start rendering.
If you recently upgraded your project from Built-in to URP, all existing Shader Graphs need their targets updated. Built-in Shader Graphs do not automatically convert. Use Edit > Rendering > Materials > Convert to match your new pipeline.
Master Node Surface Settings
The master node (Fragment output) has settings that control how the surface renders. Certain combinations produce valid shaders that output nothing visible.
Surface Type: Transparent with no Alpha connection. If the surface type is Transparent but nothing is connected to the Alpha input, the default alpha value is 0, making the entire surface invisible. Either connect a value to Alpha or switch Surface Type to Opaque.
Render Face: None. If Render Face is accidentally set to None (or the equivalent cull mode), both front and back faces are culled and nothing renders. Set it to Front, Back, or Both.
// Force a material to render correctly after fixing Shader Graph
using UnityEngine;
public class MaterialFixer : MonoBehaviour
{
public Material targetMaterial;
void Start()
{
if (targetMaterial == null) return;
// Check surface type (0 = Opaque, 1 = Transparent)
float surface = targetMaterial.GetFloat("_Surface");
Debug.Log($"Surface type: {(surface == 0 ? "Opaque" : "Transparent")}");
// If transparent, check alpha
if (surface == 1f)
{
Color baseColor = targetMaterial.GetColor("_BaseColor");
if (baseColor.a < 0.01f)
{
Debug.LogWarning("Base color alpha is near zero. Material will be invisible.");
baseColor.a = 1f;
targetMaterial.SetColor("_BaseColor", baseColor);
}
}
// Check cull mode (0 = Off/Both, 1 = Front, 2 = Back)
if (targetMaterial.HasFloat("_Cull"))
{
float cull = targetMaterial.GetFloat("_Cull");
Debug.Log($"Cull mode: {cull}");
}
}
}
Precision Mode Issues
Shader Graph has a Precision setting in Graph Settings: Float, Half, or Inherit. Half precision uses 16-bit floating point, which has a much smaller range (max ~65504) and lower precision than 32-bit Float. If your shader performs calculations that exceed this range, the values overflow to infinity or NaN, and the GPU renders black.
Common culprits are UV manipulation nodes that multiply UVs by large tiling values, time-based animations where _Time grows unbounded, and normal map calculations that combine multiple transforms.
Switch Graph Precision to Float in Graph Settings. If the preview starts working, you have a precision issue. You can then selectively set individual nodes back to Half for performance while keeping problematic nodes at Float by overriding their precision in the node settings.
// Detect potential precision issues in shader properties
using UnityEngine;
public class ShaderPrecisionDebug : MonoBehaviour
{
public Material mat;
void Update()
{
// Half precision max is ~65504
const float HALF_MAX = 65504f;
foreach (var propName in new[] { "_Tiling", "_Speed", "_Scale" })
{
if (mat.HasFloat(propName))
{
float val = mat.GetFloat(propName);
if (Mathf.Abs(val) > HALF_MAX)
Debug.LogWarning($"{propName}={val} exceeds half precision range");
}
}
}
}
Reimport and Cache Fixes
Sometimes the Shader Graph preview breaks due to a corrupted cache rather than a configuration problem. Unity caches compiled shader variants, and a stale or corrupt cache entry can produce a black preview even when the graph is correct.
Try these steps in order: Right-click the shader asset and select Reimport. If that does not work, close the Shader Graph window, delete the Library/ShaderCache folder, and reopen Unity. As a last resort, delete the entire Library folder and let Unity reimport the project.
If the preview is black but the material renders correctly in the Scene or Game view, the issue is specifically in the Shader Graph preview renderer. Restarting the Shader Graph window (close and reopen the asset) often fixes this. It is a known Unity editor issue that preview contexts can become stale after domain reloads or entering/exiting play mode.
Related Issues
If your shader renders pink instead of black, that indicates a compilation error rather than a preview issue. Check the Console for shader compile errors. If materials look correct in the Editor but wrong in builds, check that shader variants are included in Project Settings > Graphics > Shader Stripping. For texture sampling issues in Shader Graph, verify that your texture properties have default textures assigned.
Black preview usually means pipeline mismatch. Check Active Targets first before debugging anything in the graph itself.