In [1]:
# raytracing tutorial
# 07- experiment with recursive rays function
In [4]:
# max depth for scene
max_depth = 3
# recursive ray function
def ray(depth):
print("depth = ", depth, "max_depth = ", max_depth)
# colour contribution
colour_contribution = 0.1/depth
# fire off new ray
if (depth < max_depth):
colour_contribution += ray(depth+1)
pass
return colour_contribution
In [5]:
ray(1)
Out[5]:
In [ ]: