I came across this site, didn't look too deep into it, maybe it's what you're looking for. https://www.drone.org/tutorials/normal_maps.html