Blender addon to setup image based lighting (IBL) nodes in Cycles

setting up image based lighting (IBL) in Cycles isn't all that difficult but creating a versatile setup requires a lot of repetitive actions that lends itself well to automation. In this article I present a simple add-on that may be accessed from the Add menu in the node editor to quickly set up all the nodes for environment lighting.
Note: as of 2015/03/13 a bug fix release is available on GitHub.

The SIBL archive

One of the resources I find myself using quite often is the SIBL archive. Each archive is basically a directory (commonly packed as a .zip file) that contains both a high resolution backplate and HDR environment and reflection maps. It also contains an .ibl file that documents the resources available in the .zip file. The add-on uses this .ibl file to create all necessary nodes and references to the images. I am not sure how widely accepted the SIBL format is, but the add-on can also be used by simply selecting a .jpg and a .hdr file instead of a .ibl file so you are not restricted to just SIBL files.

Installation


Download the add-on
It is available on Github as a single file sibl.py. You can directly save it to your download directory via this link.
Install in Blender
Open the add-ons section of Blenders User Preferences and click Add external add-on. Select the downloaded file and click install. After installation you may find it in the Node section where you can activate it.

Usage

With a SIBL archive

Enable the add-on
In the add-ons section of the user preferences. It sits in the Node category.
Download a SIBL archive
Unzip the archive
Go to the World nodes
Click the world icon in the node editor.
Click Add -> Sibl Environment Setup
Select the .ibl file
Click Add Environment

With separate files

Enable the add-on
In the add-ons section of the user preferences. It sits in the Node category.
Go to the World nodes
Click the world icon in the node //editor.
Click Add -> General Environment Setup
Select one or two files
If you select more than one file, a file with a .hdr extension will be used as the environment lighting and the other one as the backplate.
Click Add Environment
After selecting the files the node setup will be displayed in the node editor. If there were any issues with the .hdr or backplate images the corresponding environment texture node is colored red. This may happen if the file is unreadable for some reason or if the the .ibl file points to non existing files.

Options

When the file selector is opened to allow you to select a file, some options are available in a panel on the left of the list of files:
Use reflection map
This one is only present when opening a .ibl file. It selects a higher resolution environment map suitable for glossy reflections (if available). You probably should only use this if you want to see the environment reflected in glossy surfaces because a reflection .hdr uses a lot more memory than a low resolution .hdr environment map.
Clear node tree
Uncheck this if you want to keep any existing nodes in the world node tree. If unchecked a world output node will be reused if present, as are any texture coordinate and light path nodes. Other nodes are untouched.

Implementation details

While developing this add-on I noticed that the [Environment] section in some .ibl files was spelled without an n. This is probably a bug but this add-on accepts both spellings. (An .ibl file is formatted as an .ini file, a common file format on windows and easily parsable with Python's configparser module.
All meta-data in .ibl files is ignored. This means any sun or additional key lights defined in the file are ignored. Also, all image files are currently assumed to be spherical (a.k.a. equirectangular or LatLong format, Blender's default mapping for environment textures). This means that light probe maps are currently not supported.

8 comments:

  1. Hi,

    I use the latest Blender 2.78c and was able to install sibl.py. It shows up in the Node Editor but when I select either of the two options for adding environment it doesn't do anything. I don't get any error messages but simply nothingness.

    Is this still a valid addon for Blender or is it obsolete?

    Thanks

    ReplyDelete
    Replies
    1. It should work I guess but i didn't test it w. 2.78 I'll try it out as soon as i can

      Delete
    2. seems to be working ok with my 2.78a and the Newport Loft set. I'll download 2.78c later this week and see if it behaves the same.
      What OS are you on? (i am testing it on Ubuntu)

      there are no error messages in popups but are there maybe error messages on the console?

      Delete
  2. Replies
    1. tested it with 2.78c (on Ubuntu) and it works without an issue. So I am afraid I need a little bit more information to help you out. Especially anything that shows up on the console might be helpful

      Delete
  3. I will do some more testing tonight and will check if any errors show up in the console and post it here. Thanks again.

    ReplyDelete
  4. Good news (and some little bad news). I was using "shift+a" shortcut to add the environment nodes and it definitely doesn't work from there. I wasn't getting any error message in the console and thought it was odd.

    For fun, I used the menu item "Add" in the node editor and selected "Add Sibl Environment" and it worked! (it does also work for "Add General Environment" from the menu).

    Notes:

    1) If I delete a newly added node "Add Sibl Environment" (added from the "Add" menu), I can subsequently add another "Add Sibl Environment" from the shortcut "shift+a".

    2) However, if I delete a newly added "Add General Environment" (added from the "Add" menu), I can not add another from the shortcut "shift+a".

    For some odd reason, the context is remembered only for "Add Sibl Environment" when adding subsequent nodes with "shift+a".


    I can live without the option of adding the two nodes from the shortcut (even though I use it all the time to add node but that's quite alright).

    Anyway, thanks for your great little add-on - it saves me time!

    :)

    PS: Sorry for making you waist time testing - My operating system is Windows 10 Pro x64

    ReplyDelete
    Replies
    1. Glad to hear it works :-) Shortcuts are a bit of a strange beast in Blender, never gave them much thought for this add-on. Might have a more in-depth look in general and I'll keep this behaviour in mind.

      Delete