HDRI Sun Aligner v1.5

Can it be sychnronised with real sun position on the sky?
Like in sun position plugin?

Thanks

Currently only the features described in the OP and on the GitHub readme.

Version 1.3 is up on GitHub with the following fixes and improvements:

  • Fix problem with processing large HDRI’s (8k, 16k)
  • Implemented driver that can be added to any object to align z-rotation with HDRI mapping node z-rotation (see previous discussion)

Can it be used in lower versions. Not planning to shift to 2.8 soon.

1 Like

Hi, I’m only maintaining a version for Blender 2.8 (this is my first addon and I focused on learning the API for Blender 2.8).

My sun came in at my world origin and was pointing west. I moved the sun to the south side of the house pointing north to shine into a south kitchen window. I then adjusted the longitude to 90 to hopefully turn the hdri 90 degrees clockwise. I then set latitude to 10 for a sun low in the horizon. Am I doing things right or all wrong? Thanks

Hi, some comments from my side:

  1. A new sun is created at origo; you can move it to any position but note that the light is not affected by position, only rotation (only applies for light source of type sun).

  2. The latitude and longitude means “sun position in the sky”. Latitude goes from -90 (south pole, light directly from below), 0 at the equator and +90 (north pole, light shining straight down). The longitude goes from -180 to 180. E.g. using +45 for latitude will correspond to the sun half way between the horizon and zenith. Then you can adjust the longitude for the direction (i.e. from “Southwest”). Using a latitude of +10 should give you a low sun.

  3. Regarding rotation, by using the “Add rotation driver”, the sun position (longitude) will be driven by the rotation of the HDRI if a mapping node is used in the world setup. This allows to HDRI to be rotated and keeping the correct sun position.

Please let me know if something is unclear or if you have any further questions.

Thank you akej74 for your generous reply. I will see if I can figure it out.

I’ve been using Blenderguru’s Pro Lighting pack, with which this addon does not work. But I’m very happy to discover that it works well with Easy HDRI (which essentially as good as Pro Lighting Skies minues the HDRI pack), so thanks for this plugin! I am going to include in an upcoming video for addons for architecture

I am just wondering if there is a way to improve the usability by not having to open an image editor window to align the sky?

Also it would somehow be great if the work from HDRI sun aligner and Easy HDRI could be combined

Hi, thanks for the feedback, I like to make the addon more user friendly. The preview of the sun position that is displayed in the image editor is not required, I will look into making this a separate function, e.g. a new button “Display sun position preview” or similar. This will allow for the sun position to be calculated without having a image editor open.

What I would like to have is a similar preview as in “Easy HDRI”, that shows the preview with sun position as a small image in the panel. I haven’t been able to figure out how to do this with an internal image, only using images in disk (as it’s done in Easy HDRI). My sun position preview image is created internally and not stored on disk. Of course, it would be possible to save it as a temp-file on disk, but I would like to avoid that if possible.

Maybe someone in the community can help me with some ideas on how to show an internal image in a preview window (or similar)…? The only way I have found to show the image is using the image editor, but that requires a manual step by the user in case no image editor is open.

New version (1.4) is up on GitHub with the following changes:

  • Added a new “Preview” operator that opens a new window to display the preview of the sun position
  • Sun position can be calculated without having an Image Editor open

Please let me know how this new version works for you.

7 Likes

hello i hope you add support for 2.81
the mapping node was changed and rotation driver doesn’t work unfortunately
or

is there a workaround a line text change at HDRI sun aligner to make it work for 2.81

2 Likes

Thanks for the bug report, it’s now fixed and I have published version 1.5 on GitHub, please have a look. This new version works for both 2.80 and 2.81.

I had to change the code as follows (in operators.py), as the mapping node attributes has changed in 2.81.

if mapping_node:
    # Check for mapping node attributes in Blender 2.80
    if hasattr(world_nodes[mapping_node], 'rotation'):
        # Path to HDRI mapping node z-rotation value
        data_path = f'node_tree.nodes["{mapping_node}"].rotation[2]'            
            
    # If not, assume Blender 2.81 mapping node attributes
    else:
        # Path to HDRI mapping node z-rotation value
        data_path = f'node_tree.nodes["{mapping_node}"].inputs[2].default_value[2]'
1 Like