Compatibility between Shader Graph nodes and Ray Tracing

Hello everyone,

I need to create some shaders compliant with Ray Tracing using Shader Graph, but I’ve found some incompatible nodes, for instance, the Rectangle node:

void Unity_Rectangle_float(float2 UV, float Width, float Height, out float Out)
{
    float2 d = abs(UV * 2 - 1) - float2(Width, Height);
    d = 1 - d / fwidth(d);
    Out = saturate(min(d.x, d.y));
}

Using this node with a Volume with any Ray Tracing feature enabled causes this error:

So, my questions are:

1.- Why is this node not compatible with Ray Tracing?
2.- Is there any documentation where we can see if a node is compatible or not?
3.- Is there any rule to know if some node is compatible with Ray Tracing?

Unity v.2020.3.34f1

Thanks.

According to documentation, the incompatible nodes are:

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

But, the Rectangle node is under Procedural > Shape

Finally, I did a custom function node replacing the Rectangle node and Ray Tracing works properly with standard Unity planes, but it doesn’t work with my procedurally generated meshes. Maybe, it is necessary to add some attributes to the meshes during creation, for instance, tangents or something similar.

I’ve done a room test with 6 planes and SSGI enabled with Ray Tracing, everything is correct, but when I use my generated meshes then SSGI doesn’t work.

Any ideas?

mesh.RecalculateTangents()

that’s it!