Search Unity

  1. We are looking for feedback on our SRP Rendering APIs through this Survey.
    Dismiss Notice
  2. Unity 2020.2 has been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Bug Simple Shader Graph does not generate a Visual Effect shader

Discussion in 'Shader Graph' started by florianhanke, Nov 24, 2020.

  1. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    410
    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).

    Screenshot 2020-11-24 at 21.05.45.png

    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!
     
    Last edited: Nov 29, 2020
  2. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    410
    Forgot to add the SG version: 10.1.0 on URP 10.1.0.
     
  3. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    410
    I'm probably missing something in the manual, since I see these code snippets in the Inspector:

    Screenshot 2020-11-25 at 15.07.28.png

    But the generated shader looks like this:
    Code (CSharp):
    1. Shader "Fire1"
    2.     {
    3.         Properties
    4.         {
    5.             [HDR]_MainTexColor("MainTexColor", Color) = (1.54717, 0.482621, 0, 1)
    6.         }
    7.         FallBack "Hidden/Shader Graph/FallbackError"
    8.     }
    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.
     
  4. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    410
    Update: Getting an error when explicitly pressing "Save Asset":
    Code (Text):
    1. Assertion failed on expression: 'ins.second || ins.first->second == artifactID || (ins.first->second == CircularDependencyArtifactID() && !artifactID.IsValid()) || GetPathFromAssetGuidV2(key.GetGUID()).ends_with(".cs")'
    2. #0 GetStacktrace(int)
    3. #1 DebugStringToFile(DebugStringToFileData const&)
    4. #2 AssertImplementation(int, char const*, int, int, char const*)
    5. #3 AssetResolveTracker::Track(ArtifactKey const&, AssetDatabase::ArtifactID const&)
    6. #4 AssetResolver::CalculateAssetState(ArtifactKey const&)
    7. #5 EditorAssetResolver::ResolveAsset(ArtifactKey const&, AssetDatabase::ImportSyncMode, bool*)
    8. #6 ResolveArtifactV2(ArtifactKey const&, AssetDatabase::ImportSyncMode)
    9. #7 GetImportedMetaInfo(UnityGUID const&, dynamic_array<unsigned char, 0ul>&, AssetDatabase::ImportSyncMode)
     
  5. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    410
    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.
     
  6. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    410
    Case 1295389.
     
  7. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    410
    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.
     
  8. Ulnari

    Ulnari

    Joined:
    Feb 9, 2014
    Posts:
    8
    I have the same issue, what did you do in order to generate the shader graph for VFX?
     
  9. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    410
    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.
     
  10. Scarlett4869W

    Scarlett4869W

    Joined:
    Sep 20, 2019
    Posts:
    1
    Did you solve this problem? I have this issue too
     
  11. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    410
    @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.

    1. According to QA, this PR should result in a preview being shown: https://github.com/Unity-Technologies/Graphics/pull/1340
    2. 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.
    3. Expose them all and set them explicitly.
     
unityunity