allow assigning materials even if no material slots are found.
bug fix: some caustics-generating paths were still followed even when caustics were disabled.
simplified code.