the problem is, when you use the ray mask on solid bodies. When the camera "looks through" different "invisible" objects, you'll recognize the intersections.
but if you only use a single surface (not thickened), then the camera would look perfectly through the wall, that causes shadows and reflections. So the challenge is to build one surface that represents several materials like glass, paint and metal.
Sorry for the short form.