It is better to do Surya Namaskar in front of the sun as the rays may emit positive energies and benefit your body (1).