Cycles: add Ray Length output to Light Path node. This gives the distance travelled
[blender.git] / intern / cycles / kernel / svm / svm_light_path.h
index 1b13fd93a0fb967cfb90ac04cd142b104bdb2205..ebbcb5be61ff6953d6e6d57a380e60668eecd6fe 100644 (file)
@@ -33,6 +33,7 @@ __device void svm_node_light_path(ShaderData *sd, float *stack, uint type, uint
                case NODE_LP_reflection: info = (path_flag & PATH_RAY_REFLECT)? 1.0f: 0.0f; break;
                case NODE_LP_transmission: info = (path_flag & PATH_RAY_TRANSMIT)? 1.0f: 0.0f; break;
                case NODE_LP_backfacing: info = (sd->flag & SD_BACKFACING)? 1.0f: 0.0f; break;
+               case NODE_LP_ray_length: info = sd->ray_length; break;
        }
 
        stack_store_float(stack, out_offset, info);