add refraction effect, fix #1460
logging sides
save unit directions
fix bug