Search Unity

Resolved Shader Graph Preview Works But Scene Render Doesn't

Discussion in 'Shader Graph' started by skwsk8, Jun 11, 2020.

  1. skwsk8

    skwsk8

    Joined:
    Jul 6, 2014
    Posts:
    35
    Posting this here in case it helps save anyone some time. If you've created a shader graph which has a working preview, but it doesn't render in the scene, then it might be due to an unexposed/non-exposed property. It may not solve every case where this sort of thing might happen, but simply checking the "Exposed" checkbox under the property resolved the one I was running into. Hope this helps!
     
    xodion413 and Everpeachy like this.
  2. skwsk8

    skwsk8

    Joined:
    Jul 6, 2014
    Posts:
    35
    Update that I received a response back from Unity about this bug, and they said it was not going to be fixed due to how the material system functions, and that the un-exposed properties don't use the inputted default value and are designed to be used for graph testing in the editor window only.
    Given that, it seems that "exposed" is an inaccurate description of the variable. It seems that the checkbox should default false and be described as "preview graph only" and contain a warning that "does not retain the input default value at runtime, but instead uses the primitive default". This way properties will start as exposed, and only become mismatched between the graph and runtime when the user explicitly marks the property's variable "preview graph only" so they can see the warning. Otherwise, the pattern goes against long standing programming convention and could lead to needle-in-a-haystack type bugs in an area that is already difficult to debug.

    Agree? Disagree? I'd be curious to hear your thoughts. Maybe we can get someone from Unity to implement this change and save people some time and headache!
     
  3. xodion413

    xodion413

    Joined:
    Apr 9, 2016
    Posts:
    1
    Oh my god, this was the problem with a shader that I was working on that stumped me all night. Thank you for the fix!

    And yeah, I feel like they really should change the name to something more descriptive.
     
  4. Squizzie6

    Squizzie6

    Joined:
    Nov 15, 2019
    Posts:
    1
    this was not to clear for me. In what part of the shader or project do I need to check as default on? I am still a beginner
     
  5. chrisheld

    chrisheld

    Joined:
    Apr 15, 2013
    Posts:
    8
    upload_2022-6-21_15-30-52.png

    Perhaps here?
     
  6. SWF-Games

    SWF-Games

    Joined:
    Dec 18, 2021
    Posts:
    2
    I am having an issue where my shader previews render, but my actual shader appears as black or extremely bright or distorted when applied to an object in a scene. I at first thought it was because HDRP doesn't support shader graph, but it turns out that it does. Is this the reason why it doesn't work, or are you guys talking about objects actually not rendering at all in the scene?
     
  7. Kropensaft

    Kropensaft

    Joined:
    Sep 23, 2022
    Posts:
    1

    Same, not a single post mentioning this, had to deep-dive forums because tutorial i was following is year old.
     
  8. megatapka

    megatapka

    Joined:
    Feb 10, 2023
    Posts:
    1
    I have the same problem but "exposed" is checked >_< Any other possible reasons?
     
  9. BuildersRejected

    BuildersRejected

    Joined:
    Apr 19, 2016
    Posts:
    2
    Make sure the Property is set on your Material?
     
  10. BuildersRejected

    BuildersRejected

    Joined:
    Apr 19, 2016
    Posts:
    2
    This was the fix for me. I Copied & edited an existing shader graph. I removed a bunch of properties and set one as not exposed as they were getting in the way of my purpose. Almost 3 years later and it's still the same way...tsk tsk
     
  11. Ben_Grange

    Ben_Grange

    Joined:
    Jan 21, 2017
    Posts:
    4
    Check your camera, as the camera is going to be what renders your shader graphs (this is why you can see it in scene view but not game view, as game view is rendering the scene through the camera). Make sure "Post Processing" is checked under the "Rendering" menu.
     
  12. marcospgp

    marcospgp

    Joined:
    Jun 11, 2018
    Posts:
    194