Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

WARNING: Shader Unsupported with no explanation

Discussion in 'Shaders' started by aepstein824, Aug 26, 2016.

  1. aepstein824

    aepstein824

    Joined:
    May 18, 2013
    Posts:
    3
    Hello,
    After tuning my shader in the editor, I decided to test out a build. Alas, once of my shaders was apparently unsupported. All the other posts I've seen have shown errors about vertex passes or whatever, but all I have is this:

    WARNING: Shader Unsupported: 'Custom/sum' - Setting to default shader.

    I would greatly appreciate any advice, but specifically, I would like to find some resources on how to make check shader compatibility and diagnose what features are pushing it over the edge.

    BTW, not only does the shader work in the editor, several other shaders based on the noise cginc work fine in the build and the editor.

    I've uploaded the shader, an include, and the output log.

    Thanks!
     

    Attached Files:

  2. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,495
    You generally should get the needed feedback to know when something is going over the edge. This shader gave me a few errors, which were simply related to the .cginc not being included properly. You for some reason have #include "../perlinnoise.cginc" when you should have #include "perlinnoise.cginc".

    When a shader isn't working (it will display pink if so), and you don't see errors in Unity output, then click on the actual shader and look in the inspector and you'll see a secondary output window for shader compilation details that will tell you more info about what went wrong.
     
  3. aepstein824

    aepstein824

    Joined:
    May 18, 2013
    Posts:
    3
    Well, in my assets directory, perlinnoise.cginc is one directory above sum.shader, so that's how I wrote my include. Please try with the correct include for your directory structure. Next time I will upload for a flat structure as a convenience for testers, my bad.

    Of course, I had to fix quite a few errors while writing it, but now that it's done and works in the editor, I'm confused as to why it is unsupported in the build.

    Thanks for the reply
     
  4. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,495
    I did fix it for my structure, but that's not how CG shaders work, you don't need specify the directory where the CGINC is, I'm not sure how it's even working for you like that, as it would be seeing the ../ as just part of the file name.
    The shader works for me, no errors. What platforms are you building for?
     
  5. aepstein824

    aepstein824

    Joined:
    May 18, 2013
    Posts:
    3
    I had tried reimport, rebuild, restart, but I hadn't tried reinstall. I updated from 5.3 to 5.4 to match the version on my laptop, which I was setting up to give myself another view on this problem, and no longer see a pink shader in the build.

    As for the path, as soon as I remove ../ I get errors related to not being able to find the include file. Should my cginc be somewhere besides my assets folder? Honestly, I'm not even sure that cginc is the correct extension.

    So, this might have been a bug or some kind of dirty cache or something (I did try cleaning the shader cache), but I still don't know what I would do if it wasn't, besides binary searching the shader code to figure out what wasn't supported. Can I use pragma target to test with the restrictions of an older card?

    Thanks for the help.
     
  6. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,495
    .cginc is the proper extension, and it can be in any folder in your Assets and it should work with just including the name.
    And yeah Unity can be funky with shaders sometimes in unexplainable ways...

    What do you mean by test restrictions, you mean test to see if it will work on older hardware? If so, you can use:
    #pragma only_renderers d3d11 glcore etc... to force whatever old API you want to see if it will run. As well as #pragma target 2.0 to test pretty old hardware. But really there isn't much reason to target anything below 3.0 these days.

    http://docs.unity3d.com/401/Documentation/Components/SL-ShaderPrograms.html
    https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html