Analysis of nanopatterning through near field effects with femtosecond and nanosecond lasers on semiconducting and metallic targets