Is there a technique for making a sun lamp line up with hdri sun???

Is there a technique for making a sun lamp line up with hdri sun??? I use a clear blue sky hdri with a nice sun but want a little more sun so add sun lamp to give hard shadows and strong light. To get the sun adjusted to the same rotation azumeth?? as the sun in the hdri?? Just cranking up the world brightness is too much skylight, thats why I want to add sun lamp.

You could use sIBL-Edit [1] to convert your bare HDR to a sIBL set. Among other useful things that would allow you to mark the sun, or other direct lamps, on the HDR. Your sIBL set can then be imported in to Blender using sIBL-GUI and the sIBL-GUI addon [2]. That will give you a fully controllable rig with a pre-built world HDR node setup and any direct lights you created back in sIBL-Edit.

If you don’t want to add all of that overhead, you can do some math and figure out where your sun lamp should be. Assuming you have a standard Equirectangular HDR its pretty simple as the x and y pixel coordinates map directly to latitude and longitude. If you’re using a raw mirror ball image I’m afraid I don’t know off the top of my head what projection that is.

[1] http://www.hdrlabs.com/sibl/sibl-edit.html
[2] http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/sIBL_GUI

Thanx I allready also tried a method where I switchto top view and then use viewport rendering alternating between the sun on and off and hdri on and off to match the shadow that is cast by the hdri. Its easy on hdrs that have strong sun.

For simple setups where I simply want to match the sun position (rotation in fact), this is what I do:
Add new camera, reset its location and rotation and then rotate it (looking through it) until I see the sun in the middle of the screen.
Then I simply add sun. copy rotation of the camera to the sun which gives me “opposite” to what I need, so I “R-X-X 180” (rotate 180 along local X) and done.
Remember that location of the sun lamp doesn’t matter, but if you want to you can always move it using it’s local Z axis.

Hi, maybe a bit late but I just released an addon that does exacly this, see: