sIBL based lighting in cycles

(meigo) #1

I was looking around for example of sIBL based lighting setup in blender and didn’t find any satisfying one. I put together following world node setup where I used several outputs of ‘Light Path’ node to separate images used for rendering background, reflections and transmissions. Test rendering seems ok to me (lower left on attached image), not entirely sure if that setup is correct in principle.


(abhaya) #2

It works nicely, I just added Texture Coordinate and Mapping to all textures to rotate maps.
Thanks for sharing!

(Atom) #3

Worked for me too. You can kind of use this like the angular map functionality of Blender Internal. (Only it looks better).

Attachments

263_sIBL_cycles_setup.blend (400 KB)

(ravel) #4

Meigo, you’re awesome for putting together this node tree, it’s just what I’m looking for!!

Atom, you’re awesome for replying to my thread, directing me here, and posting a blend file of the set up!!.

Here is a program for generating your own sIBL sets of you don’t already have it.

http://www.hdrlabs.com/sibl/sibl-edit.html

Tim

P. S. Atom, by any chance have you ever lived in Calgary?

(comeinandburn) #5

Hi Atom,

I’m familiar with a lot of your scripting work, so I think you’re the right person to ask. How difficult and how much beer money would it take for you to script a loader for sIBL:)? I’ve been interested in this for quite some time and according to HDRlabs website http://www.hdrlabs.com/sibl/index.html the loaders (automatic texture assignment script) is written in python and “easy” to achieve. Unfortunately I’m not able to script, this is why I ask.

BTW if for some reason there are limitations with Cycles, would it be possible with another renderer, maybe Yafaray?

(bashi) #6

@comeinandburn: This is not really difficult to do as Script.

A typical .ibl file looks like:

[Header]
ICOfile = "DS360_3DWorld_07_Thumb.jpg"
Name = "Dutch Light 360 - 3DW - 007"
Author = "Bob Groothuis"
Location = "Scheveningen | The Netherlands"
Comment = "Sunrise, early morning, plain trails, blue sky"
GEOlat = 52.100856
GEOlong = 4.268611
Link = "http://www.bobgroothuis.com/"
Date = "2011:04:08"
Time = "06:50:00"
North = 0.40
Height = 1.550000


[Background]
BGfile = "DS360_3DWorld_07_Bg.jpg"
BGmap = 1
BGu = 0.000000
BGv = 0.000000
BGheight = 4000


[Enviroment]
EVfile = "DS360_3DWorld_07_Env.hdr"
EVmap = 1
EVu = 0.000000
EVv = 0.000000
EVheight = 180
EVmulti = 1.000000
EVgamma = 2.200000


[Reflection]
REFfile = "DS360_3DWorld_07_Ref.hdr"
REFmap = 1
REFu = 0.000000
REFv = 0.000000
REFheight = 500
REFmulti = 1.000000
REFgamma = 2.200000


[Light1]
LIGHTname = "Sun"
LIGHTcolor = 255,185,155
LIGHTmulti = 1.000000
LIGHTu = 0.518000
LIGHTv = 0.404000

for the GeoLat/GeoLong, i think the Sun Addon can do this, so there might be code to use.

All in all it’s (just) a matter of importing the right images, set up the Nodes, and Set the Sun (and Lights for ibl 2.0). For someone fluent in Python i think a matter of couple hours to 1-2 Days. For Phython learners, like me, maybe a couple Days up to a week or two. (Not the programming itself, but to figure out where and how to do this stuff :wink:

It just has to do someone…

Edit: This is about importing the .ibl directly, not about sIBL-GUI connection.

(bashi) #7

It might be better to make a sIBL-GUI Python Addon. I think this might be more future proof, but someone with more experience should look at it (atom?).

The sIBL-GUI Python Addon for Maya:

#!/usr/bin/env python
# -*- coding: utf-8 -*-


"""
**sIBL_GUI_For_Maya.py


**Platform:**
    Windows, Linux, Mac Os X.


**Description:**
    Maya sIBL_GUI Helper Script for Maya 2011 and higher.


**Others:**


"""


#**********************************************************************************************************************
#***    External imports.
#**********************************************************************************************************************
import maya.cmds as cmds
import maya.mel as mel
import os
import platform
import re
import sys


#**********************************************************************************************************************
#***    Module attributes.
#**********************************************************************************************************************
__author__ = "Thomas Mansencal"
__copyright__ = "Copyright (C) 2008 - 2012 - Thomas Mansencal"
__license__ = "GPL V3.0 - http://www.gnu.org/licenses/"
__maintainer__ = "Thomas Mansencal"
__email__ = "[email protected]"
__status__ = "Production"


__all__ = ["HDRLABS_URL",
        "WINDOWS_RELEASE_URL",
        "DARWIN_RELEASE_URL",
        "LINUX_RELEASE_URL",
        "APPLICATION_THREAD_URL",
        "openPreferences",
        "launchApplication",
        "executeLoaderScript",
        "deleteSmartIblNodes"]


HDRLABS_URL = "http://www.hdrlabs.com"
WINDOWS_RELEASE_URL = "http://kelsolaar.hdrlabs.com/?dir=./sIBL_GUI/Repository/Builds/Windows"
DARWIN_RELEASE_URL = "http://kelsolaar.hdrlabs.com/?dir=./sIBL_GUI/Repository/Builds/Darwin"
LINUX_RELEASE_URL = "http://kelsolaar.hdrlabs.com/?dir=./sIBL_GUI/Repository/Builds/Linux"
APPLICATION_THREAD_URL = "http://www.hdrlabs.com/cgi-bin/forum/YaBB.pl?num=1271609371"


#**********************************************************************************************************************
#***    Module classes and definitions.
#**********************************************************************************************************************
class Environment(object):
    """
    This class provides methods to manipulate environment variables.
    """


    def __init__(self, variable=None):
        """
        This method initializes the class.


        :param variable: Variable to manipulate. ( String )
        """


        self._variable = variable


    def getValue(self):
        """
        This methods returns given environment variable value.


        :return: Variable value. ( String )
        """


        if self._variable:
            return os.environ.get(self._variable)


def _setExecutablePathOptionVar():
    """
    This definition sets **executablePath** optionVar.
    """


    _setOptionVar("sIBL_GUI_executablePath", cmds.textField("Executable_Path_textField", query=True, text=True))


def _setLoaderScriptPathOptionVar():
    """
    This definition sets **sIBL_GUI_loaderScriptPath** optionVar.
    """


    _setOptionVar("sIBL_GUI_loaderScriptPath", cmds.textField("Loader_Script_Path_textField", query=True, text=True))


def _setCommandPortOptionVar():
    """
    This definition sets **sIBL_GUI_commandPort** optionVar.
    """


    _setOptionVar("sIBL_GUI_commandPort", cmds.intSliderGrp("Command_Port_intSliderGrp", query=True, value=True))


def _setOptionVar(name, value):
    """
    This definition stores given optionVar with given value.
    
    :param name: OptionVar name. ( String )
    :param value: OptionVar value. ( Object )
    """


    cmds.optionVar(sv=(name, value))


def _openUrl(url):
    """
    This definition opens given url.


    :param url: Url to open. ( String )
    """


    cmds.launch(web=url)


def _Executable_Path_button__command(state=None):
    """
    This definition is triggered by **Executable_Path_button** widget.


    :param state: Button state. ( Boolean )
    """


    fileName = cmds.fileDialog2(ds=2, fileFilter="All Files (*.*)", fm=(not platform.system() == "Darwin" and 1 or 3))
    fileName = fileName and fileName[0] or None
    if not fileName:
        return


    if fileName.endswith("sIBL_GUI.exe") or re.search("sIBL_GUI[\d ]*\.app", fileName) or fileName.endswith("sIBL_GUI"):
        cmds.textField("Executable_Path_textField", edit=True, text=fileName)
        _setExecutablePathOptionVar()
    else:
        mel.eval("warning(\"sIBL_GUI | Chosen executable path is invalid!\");")


def _Executable_Path_textField__changeCommand(value):
    """
    This definition is triggered by **Executable_Path_textField** widget.


    :param value: Value. ( String )
    """


    if os.path.exists(value) and \
        (value.endswith("sIBL_GUI.exe") or \
        value.endswith("sIBL_GUI.app") or \
        value.endswith("sIBL_GUI")):
        _setExecutablePathOptionVar()
    else:
        mel.eval("warning(\"sIBL_GUI | Chosen executable path is invalid!\");")


def _Loader_Script_Path_button__command(state=None):
    """
    This definition is triggered by **Loader_Script_Path_button** widget.


    :param state: Button state. ( Boolean )
    """


    fileName = cmds.fileDialog2(ds=2, fileFilter="All Files (*.*)", fm=4)
    fileName = fileName and fileName[0] or None
    if not fileName:
        return


    cmds.textField("Loader_Script_Path_textField", edit=True, text=fileName)
    _setLoaderScriptPathOptionVar()


def _Loader_Script_Path_textField__changeCommand(value):
    """
    This definition is triggered by **_Loader_Script_Path_textField** widget.


    :param value: Value. ( String )
    """


    if os.path.exists(value):
        _setLoaderScriptPathOptionVar()
    else:
        mel.eval("warning(\"sIBL_GUI | Chosen Loader Script path is invalid!\");")


def _Command_Port_intSliderGrp__changeCommand(value):
    """
    This definition is triggered by **Command_Port_intSliderGrp** widget.


    :param value: Value. ( Float )
    """


    _setCommandPortOptionVar()


def _Command_Port_button__command(state=None):
    """
    This definition opens the command port.


    :param state: Button state. ( Boolean )
    """


    try:
        cmds.commandPort(name="127.0.0.1:" + str(cmds.intSliderGrp("Command_Port_intSliderGrp", query=True, value=True)))
    except:
        mel.eval("warning(\"sIBL_GUI | Command port is already open or can't be opened!\");")


    _setCommandPortOptionVar()


def _Get_Application_button__command(state=None):
    """
    This definition opens Online Repository.


    :param state: Button state. ( Boolean )
    """


    if platform.system() == "Windows" or platform.system() == "Microsoft":
        url = WINDOWS_RELEASE_URL
    elif platform.system() == "Darwin":
        url = DARWIN_RELEASE_URL
    elif platform.system() == "Linux":
        url = LINUX_RELEASE_URL


    _openUrl(url)


def _HDRlabs_button__command(state=None):
    """
    This definition opens HDRLabs thread.


    :param state: Button state. ( Boolean )
    """


    _openUrl(HDRLABS_URL)


def _Application_Thread_button__command(state=None):
    """
    This definition opens sIBL_GUI thread.


    :param state: Button state. ( Boolean )
    """


    _openUrl(APPLICATION_THREAD_URL)



NOT including last part of script here, since “to big to post”. look here for download full.

(comeinandburn) #8

Thanks for your input bashi,

I’m just happy to see someone that’s even considered this. I see huge benefits to having this in place, just the fact that you can match real world lighting, and fast, is huge! Not to mention the benefits it would bring when compositing 3d renders with footage.

All I can say is, that it would be great if someone were to take a stab at it:) I really need to start learning python! unfortunately I think I’ll have to trade in my current brain for one that is more logical… ha ha.

This would be a great learning experience for any budding scripters… hint hint.

(ravel) #9

I think it’s cool too,

But I can’t figure out how to use it :-?

I’m pretty sure I understand the node tree itself, but I haven’t figured out a way to integrate it into my start up scene / user preferences.

I’d like it to be there and ready when I open up Blender because I can’t see any reason I wouldn’t want to use sIBL in all my renders.

I can set it as the start up scene no problem, but I’m still confused about appending files into it.

I went both ways:

Open this node tree first, then add the scene, I,m not sure which file/s to add.

And, open my scene then append the node tree, which doesn’t appear as a node tree file inside the .bend file, so I’m also not sure how to proceed :frowning:

When I do either it’s just not clear what I have to append, everything or select files, in which case which files do I add?

Thanks in advance,
Tim

(yaniv) #10

ravel, you can open a new project and build the node setup, after that press Ctrl+U so it will save on the startup setup file.
now, when you press Ctrl+N for a new project you will get the setup ready.

Is there any progress about the script?

(yaniv) #11

I’m just test the node setup and found a mistake, after fixing and adding some enhancement I came to this setup:


it’s suppose to make the Render faster but instead of that it make it slower :o.

(elbrujodelatribu) #12

Thanks @yaniv, your setup works perfectly with glass material.

(moony) #13

Isnt there already one?

http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/sIBL_GUI