I have been trying to achieve this effect from Tim-C (which all seems to be outdated, even the fixes posted in the comments) with ShaderGraph (Unity 2019.3.0f3), but as far as I know you can’t do that within ShaderGraph, so after looking at this page on the ShaderLab documentation I came up with the following shaders that (try to) use a shader graph I made.
Using this shader displays the shader graph normally:
Shader "Custom/BlockPreview_WriteZ"
{
Properties
{
//Has the same name as 'Reference' in shader graph.
PreviewColor("Hologram Color", Color) = (0.90, 0.90, 0.90, 0.20)
}
SubShader
{
Tags {
"Queue" = "Transparent"
"RenderType" = "Transparent"
"RenderPipeline" = "UniversalPipeline"
}
UsePass "Shader Graphs/BlockPreview_Graph/Pass"
}
}
So I tried adding a ZWrite pass, but this shader will just display nothing at all (but the outline in the scene view still works like it’s there):
Shader "Custom/BlockPreview_WriteZ"
{
Properties
{
//Has the same name as 'Reference' in shader graph.
PreviewColor("Hologram Color", Color) = (0.90, 0.90, 0.90, 0.20)
}
SubShader
{
Tags {
"Queue" = "Transparent"
"RenderType" = "Transparent"
"RenderPipeline" = "UniversalPipeline"
}
Pass
{
ZWrite On
ColorMask 0
}
UsePass "Shader Graphs/BlockPreview_Graph/Pass"
}
}
I don’t really know much about ShaderLab so I haven’t been able to make this work. Any help would be much appreciated.

