Layer thickness calculation