Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. We are looking for your feedback about Templates! Tell us about your experiences by taking our survey.
    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

Help Wanted Output value 'vert' is not completely initialized

Discussion in 'Shader Graph' started by CDF, Oct 19, 2019.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,072
    Don't know what I'm doing wrong, but every shader I create with shader graph (in any version). I always get this error:

    grid.png

    Then I hit "save asset" a couple of times and it goes away. When I re-open Unity it's back again.

    Here's a simple shader that just repeats a texture based on a grid size:
    It looks fine to me, but no matter what, "Output value 'vert' is not completely initialized" warning keeps popping up.

    gridShader.png

    What am I doing wrong?
     
  2. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    349
    Same here in 2019.3. Just multiply 2 colors and plug it into the emission, presto, error. Pressing Save Asset a few times gets rid of it again.
     
  3. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    1,355
    Just want to weight and say this is also a regular occurrence for me in 2019.3. Fortunately it's not a pressing issue, but evidently something is wrong.
     
  4. Robber33

    Robber33

    Joined:
    Feb 22, 2015
    Posts:
    52
    same here 2019.3.0b12
     
    DanilKozub likes this.
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    9,782
    You’re not doing anything wrong, and there’s nothing you can do to fix it. This is Unity’s bug.
     
  6. ioesten

    ioesten

    Joined:
    Feb 19, 2018
    Posts:
    12
    This fixes it:

    v2f vert(appdata_base v)
    {
    //initialize 'o'...
    v2f o;
    UNITY_INITIALIZE_OUTPUT(v2f, o);
    ..........
     
  7. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    9,782
    Yep. That is indeed something they could add to the generated shader code to fix the problem.

    As an aside, while I know the above line is common in a lot of built-in Unity shaders, I'm strongly against its use in my own shaders. That warning is useful information and means there's either a bug in your shader or an optimization you could be making. If the vertex output isn't completely initialized it means you either forgot to set a value that should be set which might explain some visual issue you might see, or it means you're passing extra unused data to the fragment shader which could be removed to make the shader faster.
     
    zch1234qq and ioesten like this.
  8. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    550
    where do I put this?
     
    vipinsoni38 likes this.
  9. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,072
    Are there actually any Unity devs on this shader graph forum?

    Would be great to know this is a known issue and is being worked on.
     
    newguy123 likes this.
  10. vipinsoni38

    vipinsoni38

    Joined:
    Jan 2, 2020
    Posts:
    4
    can you please tell me where to put this. I am having the same issue
     
  11. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    9,782
    No where. This isn't something for you to fix. Reporting the bug using the in editor "Report a Bug..." dialog is how you get it fixed.


    The "fix" @ioesten posted would be for hand written vertex fragment shaders, not for Shader Graph shaders. Infact the existing shaders already do something very similar. The macro referenced in his example code does this:
    Code (csharp):
    1. #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0;
    That initializes all values of a struct to be zero. If you look at the code in PBRForwardBase.hlsl where the error is being reported, it's already doing the same thing.
    Code (csharp):
    1. PackedVaryings vert(Attributes input)
    2. {
    3.     Varyings output = (Varyings)0; // here
    4.     output = BuildVaryings(input);
    5.     PackedVaryings packedOutput = (PackedVaryings)0; // and here
    6.     packedOutput = PackVaryings(output);
    7.     return packedOutput;
    8. }
    The problem is those
    BuildVaryings
    and
    PackVaryings
    functions are overriding the struct, and those functions (which are generated by the shader graph and are unique to each shader) don't properly initialize all values. Since the functions are just overriding and not modifying the existing struct, the fact it was originally zeroed out doesn't matter. Really, the bug is there are values being included in the struct that shouldn't be there, not that it's not being initialized to zero, so it's a deeper bug they should fix.

    So, what can you do?
    Have you reported the bug with an example project using the in-editor Report Bug dialog? If not, no. No one is working on it. This forum is a community forum. There are real devs who sometimes come by to help out, or sometimes to try and find more information about bugs that have been reported, but they are not supposed to work on issues not in the tracker and vetted by their test team.

    If you want a bug fixed, report it, then post here.



    Technically if you want to fix the issue locally you can take every Shader Graph you make that has the problem, right click on the master node and select "Show Generated Code", save that to a new .shader file, and find this line:
    Code (csharp):
    1. PackedVaryings output;
    And replace it with:
    Code (csharp):
    1. PackedVaryings output = (PackedVaryings)0;
    Then delete your Shader Graph shaders and hand modify the shader code when you want to make changes.

    Or you can report the bug and ignore the warnings for now.
     
    Last edited: Jan 2, 2020
    kinmenhans and valentingurkov like this.
  12. alexandral_unity

    alexandral_unity

    Unity Technologies

    Joined:
    Jun 18, 2018
    Posts:
    162
    Hi, if you have an issue that is an actual bug, please check if it exists on the issue tracker or file a bug yourself. Like Ben said, it really helps us to have a formally filed and tracked bug with our test team to resolve issues. c:
     
  13. Sean2212

    Sean2212

    Joined:
    Jun 9, 2017
    Posts:
    6
    I am also getting the same error in 2019.3.0f3. I couldn't find a bug logged for it so I logged one.
     
    VenandiVatis likes this.
  14. Sean2212

    Sean2212

    Joined:
    Jun 9, 2017
    Posts:
    6
    Unity has acknowledged the issue and sent it to their dev team:

    From: Gytis Zasciurinskas <bugs@unity3d.com>
    Date: Mon, 20 Jan 2020 12:54:01 +01:00

    Hi,

    We successfully reproduced this issue and have sent it for resolution with our developers.

    We highly appreciate your contribution. If you have further questions, feel free to contact us.

    Thanks,
    Gytis
    Customer QA Team
     
    bgolus likes this.
  15. wwwholmiz

    wwwholmiz

    Joined:
    Aug 18, 2013
    Posts:
    5
    Any news about this? I just upgraded to 2019.3.1f1 and the "Output value 'vert' is not completely initialized" is still a problem...
     
  16. CrocsxG

    CrocsxG

    Joined:
    Jan 2, 2018
    Posts:
    3
    I have the same exact problem, I also reportedd, but just seen that it is in progress. so I guess I'll wait

    https://prnt.sc/r7h62f
     
    Last edited: Feb 25, 2020
  17. alexandral_unity

    alexandral_unity

    Unity Technologies

    Joined:
    Jun 18, 2018
    Posts:
    162
    Hi, the fix for this has already landed for 7.2.0. There's a hotfix to ensure all values are zero initialized, and there's a larger fix in the works to ensure that only necessary data is generated in the structs.
    Unfortunately even after this fix you may still see this error on older graphs due an unrelated bug where the warnings on the shader/material do not clear from cache correctly. This warning shouldn't be breaking your graphs, and you haven't done anything in your graph wrong. It's more of a visual nuisance than anything.
     
  18. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    349
    What is 7.2.0?
     
  19. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    9,782
    Shader Graph version 7.2.0

    You don't download the Shader Graph package directly, but rather it's updated along with whatever SRP you're using. So you need to update your URP or HDRP to 7.2.0 or better (URP doesn't have a "7.2.0" release, only 7.2.1, but that'll work too). You can do so through the Package Manager window in the editor. Note the fixed version of the URP may not be available for the version of the editor you're using. For example, URP 7.2.1 requires Unity 2020.1.
     
    VoxellStudios and Innovine like this.
  20. VoxellStudios

    VoxellStudios

    Joined:
    Oct 8, 2019
    Posts:
    20
    URP 7.2.1 is now available in 2019.3.2.f1
     
  21. gputhread

    gputhread

    Joined:
    Dec 7, 2018
    Posts:
    28
    http://sorumi.xyz/posts/unity-fur-shader/
    want to use this on 2019.3 hdrp, how to fix?


    Output value 'vert_surface' is not completely initialized
    Compiling Vertex program
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR
     
  22. ArtOfWarfare

    ArtOfWarfare

    Joined:
    Sep 28, 2013
    Posts:
    23
    Which version should we actually use? I see 6 different versions listed in Package Manager ranging from 7.1.7 to 8.0.1 and all of them say "Release Details (Current)".
     
  23. zch1234qq

    zch1234qq

    Joined:
    Dec 24, 2019
    Posts:
    5
    it's absolutely the best answer that make people understand instantly.
     
  24. disuperguy

    disuperguy

    Joined:
    Nov 6, 2019
    Posts:
    7
    when will they fix
     
  25. disuperguy

    disuperguy

    Joined:
    Nov 6, 2019
    Posts:
    7
    ok I tried this in the 2020 version and its still not fixed, if anyone has got around this bug Tell Me please.
     
unityunity