Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug ShaderGraph error on simple transparent shader

Discussion in 'HDRP Ray Tracing' started by highlyinteractive, Oct 27, 2021.

  1. highlyinteractive

    highlyinteractive

    Joined:
    Sep 6, 2012
    Posts:
    116
    I'm getting the following error with a simple transparent shader (lit and unlit):



    Any clue as to the cause and/or a workaround?

    Code (csharp):
    1. Shader error in 'Shader Graphs/Test': Opcode DerivCoarseY not valid in shader model lib_6_3(anyhit). Opcode DerivCoarseX not valid in shader model lib_6_3(anyhit). (on d3d11)
    2.  
    3. Compiling RayTracing program with TRANSPARENT_COLOR_SHADOW _BLENDMODE_OFF _DISABLE_DECALS _DISABLE_SSR_TRANSPARENT _REFRACTION_OFF _SURFACE_TYPE_TRANSPARENT
    4. Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
    5. Disabled keywords: SHADER_API_GLES30 UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_VIRTUAL_TEXTURING _ADD_PRECOMPUTED_VELOCITY _BLENDMODE_ADD _BLENDMODE_ALPHA _BLENDMODE_PRE_MULTIPLY _DISABLE_SSR _DOUBLESIDED_ON _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN _TRANSPARENT_WRITES_MOTION_VEC
    6.  
     
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    760
    Thanks for pointing it out.
    As It turns out Ellipse node uses a function called "fwidth" which does this:
    Code (CSharp):
    1. abs(ddx(x)) + abs(ddy(x))
    And raytracing does not support ddx / ddy / ddxy (derivatives) functions unfortunately.
    However, maybe it should fail more gracefully than this.
     
  3. highlyinteractive

    highlyinteractive

    Joined:
    Sep 6, 2012
    Posts:
    116
    Seems like quite a lot of the procedural nodes have the same/similar issue. Which is a shame because raytraced shadows through animated alpha channels look really cool!

    Is there any way to find out which nodes are unsupported, or is it going to need a brute force approach to testing?
     
  4. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    Derivative based node are not supported for ray tracing, it is mentionned in the doc for ray tracing
    https://docs.unity3d.com/Packages/c...@13.1/manual/Ray-Tracing-Getting-Started.html

    Unsupported shader graph nodes for ray tracing
    When building your custom shaders using shader graph, some nodes are incompatible with ray tracing. You need either to avoid using them or provide an alternative behavior using the ray tracing shader node. Here is the list of the incompatible nodes:

    • DDX, DDY and DDXY nodes.
    • All the nodes under Inputs > Geometry (Position, View Direction, Normal, etc.) in View Space mode.
    • Checkerboard node.

    Ellipse node is a relatively new node and the person who added it didn't take into account ray tracing, doc needs to be updated with this.
     
    highlyinteractive likes this.
  5. highlyinteractive

    highlyinteractive

    Joined:
    Sep 6, 2012
    Posts:
    116
    Thanks, that's really helpful
     
  6. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    highlyinteractive and chap-unity like this.
  7. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Is there a way to create shader in SG that will switch some nodes depends on RTX on/off? I would like to use ddx in SG for rasterization and do not want to switch shader when RTX is enabled.
     
  8. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
  9. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168