Waveguide effect during photoetching of semiconductors