a not working 3d pencil beam implementation