Light Dome

This application is pretty old.
It is for Mental Ray only.
And nowadays you probably use environment maps for the global illumination as the machines got way faster.

Idea of this project:
I have searched for a way for an easy illumination of a scene with a light probe, including shadows and specular highlights.
A: Final gathering does not create specular highlights.
B: A very low reflection to fake the specular does not create shadows and "blurred" highlights take a lot of time to render with reflection raytracing.
C: Some scripts that exists to create a light rig need a lot of lights to get a nice result, the lights are aligned on some kind of grid, they have a fixed distance, not taken into account that there are dark and bright areas.

I choosed to optimize C.

What is BA_LightDome:
LightDome is a standalone application that reads HDRI light probe images and creates a light rig from that image. The idea behind BA_LightDome is to analyse the picture and create only lights if it is necessary. It starts with about 650 light points on the image and reduces them to less than 75.
Then it exports all lights in a script file. You have to load and execute that script file into your 3D Application (At the moment only XSI is supported, but if anyone would like to write a simple script example of his prefered 3d software, I could implement this script language).
It creates area lights with shadow and the bright lights with specularity enabled. After you have loaded it into your 3D application you can fine-tune the intensity, saturation, distance to origin...


>>>BA_LightDome v1.3.05
>>>BA_LightDome v1.2 Now with Maya export!
>>>BA_LightDome v1.1
>>>BA_LightDome v1.0.6

Possible input file formats are .TGA (8-bit), Mental images .CT (8-bit, 16-bit, float) and Radiance .HDR (float)


Example A:

Main light sources are a window in front of the camera and a light bulb on the right side.
The reflection ball was shot from the desk under the light bulb. The ball itself was directly on the ground.
I composed the images (shot with different shutter speeds) in Shake (simple brightnes nodes and expands to get a mask for copy nodes), saved it as Mental images .ct file and loaded the float format longitude map into BA_LightDome:
BA_LightDome shows overwhites with a color gradient. e.g. Cyan is for values 16+. The window and the light bulb are far out of range. I choose to chnage no setting of BA_LightDome and directly hit 5. >Optimize points>
BA_LightDome automatically executes 2. and 3. before optimizing. 4. is optional and not used this time (read next Example).
It takes about a minute to search for optimizations. After it finished, I choosed the first optimization from the list, executed 7. >Collape points> and 7. >Reduce lights> (default settings). If you like you can try to skip "Collape points" to get fewer lights in your scene. Then I exported the script file.

I loaded the script into XSI and executed it. I created a grid and a sphere, the sphere got gray phong and the grid XSI's shadow material. I used my background image as a rotoscope image to set my 3D camera to the rough position of the real camera. I disabled "premultiply" in render region options, set render region to RGB+Alpha, hided all 3d geometry in the camera viewport and rendered a region. The result was just fine. Nothing to tweak. I rendered an image of it and composed in over the background. The final Image:

Ok Ok, I know some of you have doubts on the result: "It was too easy, no setting changed? no problem at all? Just a very simple composite with an over node?" The secret behind this miracle that there was no problem, nothing changed... is that this was the test image I used to develop BA_LightDome. That's why no setting was changed.

After I got this result, I wanted to be sure that it works with other locations:

Example B:

Main light sources is the sun at late afternoon and the blue sky.
The reflection ball was shot about 1,50m over the ground. While I shot the ball with lower shutter speeds I realized that my little digital camera is perhaps not able to shoot that high range that I need to darken the sun. The lowest value was shutter speed 1/2000s (with the most closed stop possible, a 8.0) and the sun had still a little glow on the ball.
I composed the images in Shake, loaded it into BA_LightDome:
And there I read that I had a maximum brighness of 3.0 at the sun (mouse location)! The light bulb in the test before had a luminosity of 21! I applied the color (3.) and now "4. Increase luminance at highlights" is used. It increased the luminance at the points that are near the maximum luminance of all points. The sun should be very bright, so I moved the slider "Inc. value" to the maximum. The next important setting is the Highlight color. If I take a look at the image the sun light is orange, which is right cause I had set my camera to "cloud color temerature". The default color is just right for this case. Then I hit the 4. >Increase max Luminance> button. I liked the result and leaved it that way.
If you have a similar problem with low highlights you have to test the values, check the result with the mouse on the image and redo "3. Apply color" if you are not satisfied with the result.
Then 5. >Optimize points>, 7. >Collape points>, 7. >Reduce lights> (default settings) and export to script file.

I loaded it into my old XSI scene and changed the camera to fit to the new background image. The first render region preview was too bright and I got some highlights from the sky on my sphere. I opened the Light_CTRL PPG and changed "Multiply Intensity" to 0.7 and "Light Is Specular If Image Intensity Was Higher" to 3.
This is the result I get. On the first view it looks very nice, but there are some problems. First the shadow. Take a look at the sphere shadow and the real shadow on the background image. The real shadow is a bit blue. That is because it is only lit by the blue sky. XSI's shadow material is only gray. No colored shadows from colored lights.
That was the point I wrote my own shadow shader. You can donwload it as a part of the "Binary Alchemy Shader collection". It renders a white image with darker and colored shadow areas. You have to multiply it with the background.
The new result. It is a very little difference, but important. A direct comparison of the 2 shadows. As the stones on the ground are very "grainy", it is hard to see the difference. The best would be to download the 2 images above and flip them in your image viewer.
Next Problem: if you take a look at the images above (this one is fixed), the ball is very bright on its bottom, but directly under the ball there is ground, which does not emit/reflect that much light on this little area under the ball, and it has dark shadows of the ball. The reason for this problem is that the reflection ball was shot 1.5m above the ground. 1.5m above the ground, a bigger area of ground was reflecting light and there was no shadow under the ball. A probaly solution for this problem could be an ambient occlusion pass between sphere and ground. I this example I have simple reduced the light intensity from below by unchecking the "diffuse" parameter of one light at the bottom.

First Conclusions:

Limitations found: This lightning model does not support multiple light situations like in the sun/ in the shadow on the same location. (Next step would be a new light shader that supports multiple reflection balls...) Things to remember the next time on location: 1. Get some ND filter for your camera if it does not support enough range to capture the sun intensity with color information. 2. Be careful where you place your reflecion ball depending where your object is placed into.

I will use this app in my next two projects (feature film and a series). Lets see how it works outside the test environment...