Simple Shader Graph does not generate a Visual Effect shader

Hi all,

I’d be grateful for a quick sanity check to see if what I want is possible. I have the following shader graph, with target Visual Effect (Unlit, Alpha Clipping).

Should it be possible to get a preview in the Main Preview or am I assuming that is possible when it isn’t?

When I add a Universal target, the preview appears and I can choose a mesh. I can also choose a mesh with only the VFX target, but nothing is visible. I disabled Alpha clipping, but no dice.

Thanks in advance!

Forgot to add the SG version: 10.1.0 on URP 10.1.0.

I’m probably missing something in the manual, since I see these code snippets in the Inspector:

But the generated shader looks like this:

Shader "Fire1"
    {
        Properties
        {
            [HDR]_MainTexColor("MainTexColor", Color) = (1.54717, 0.482621, 0, 1)
        }
        FallBack "Hidden/Shader Graph/FallbackError"
    }

Is this expected? What am I doing wrong?

Note: It’s been a year since I last used shader graph, so I’m probably a bit rusty.

Update: Getting an error when explicitly pressing “Save Asset”:

Assertion failed on expression: 'ins.second || ins.first->second == artifactID || (ins.first->second == CircularDependencyArtifactID() && !artifactID.IsValid()) || GetPathFromAssetGuidV2(key.GetGUID()).ends_with(".cs")'
#0 GetStacktrace(int)
#1 DebugStringToFile(DebugStringToFileData const&)
#2 AssertImplementation(int, char const*, int, int, char const*)
#3 AssetResolveTracker::Track(ArtifactKey const&, AssetDatabase::ArtifactID const&)
#4 AssetResolver::CalculateAssetState(ArtifactKey const&)
#5 EditorAssetResolver::ResolveAsset(ArtifactKey const&, AssetDatabase::ImportSyncMode, bool*)
#6 ResolveArtifactV2(ArtifactKey const&, AssetDatabase::ImportSyncMode)
#7 GetImportedMetaInfo(UnityGUID const&, dynamic_array<unsigned char, 0ul>&, AssetDatabase::ImportSyncMode)

Update 2: Managed to avoid the error (by renaming the file, shrug). Anyway, with Universal target I am getting a nice shader, and with Visual Effect target I’m getting the small piece above.

Case 1295389.

Update: It does generate a shader, but the generated shader can only be previewed in the generated VFX graph shader (it is contained within). It would be great to be able to preview it in the shader graph also, but is not as necessary anymore for me personally.

Also, it’s perhaps obvious to others but it wasn’t obvious to me that I cannot use non-exposed shader graph input defaults in the VFX graph. I needed to make them all exposed and pass in the values explicitly.

I have the same issue, what did you do in order to generate the shader graph for VFX?

It is generated, but you can only view it when viewing the generated shader in the VFX graph (see my message above). My actual issue was that one cannot use non-exposed default inputs. I needed to expose them all in the SG and set them in the VFXG. I hope that helps!

P.S: Even if you can’t see the generated graph, you can insert it into the shader slot of a VFXG output block.

Did you solve this problem? I have this issue too

@Scarlett4869W Unsure which issue you mean, so I’ll just list the three issues I had in the course of this post:

  1. No preview with VFX.

  2. Show generated shader broken.

  3. Cannot use non-exposed default inputs.

  4. According to QA, this PR should result in a preview being shown: [VFX/SG] Workflow improvement with SG by PaulDemeulenaere · Pull Request #1340 · Unity-Technologies/Graphics · GitHub

  5. Not sure if anything is done re the generated shader. But you can see it if used in a VFX graph and then looking at the generated shader there.

  6. Expose them all and set them explicitly.