Join Donovan Keith for an in-depth discussion in this video Setting up high-dynamic-range image (HDRI) lighting, part of Production Rendering Techniques in CINEMA 4D.
- View Offline
Image-based lighting using HDR images can give you really fantastic lighting with a minimum of effort. In my Picture Viewer, I have opened two images. They are both panoramas of the sky. The first is an 8-bit, image and don't let this name fool you, it's not an HDRI. It's just an 8-bit image. If I go into my Filter tab, what I can do is enable my Filter and adjust the exposure of this image, and as any one who has tried to play with Levels in Photoshop knows, I am going to be able to shift of this around, but at some point I am going to lose detail.
So if I bring my Exposure down what we will eventually see is that I am just darkening my entire image uniformly. The sun is just overexposed, and there is no salvaging in it. Now the underexposed areas I can increase the exposure on and do all right, but I am limited, and that's because this image is an 8-bit image, and that means that there are only 256 levels of possible brightness. Now if I go to a 16-bit or 32-bit image which is the standard for an HDR image, we end up with millions of levels of brightness.
So taking a look at this HDRI image if I go into my Filter and adjust its exposure, I can bring the Exposure up just like I did with the other, but I can also bring my Exposure down significantly. What you will see is I am not ten stops lower in brightness, and I still have image detail, and that's because of the way that HRDI images are taken. An HDRI image is actually composite of a number of different images. To get this panorama, somebody probably went out and used a panoramic head on a tripod and rotated it around 360 degrees taking a number of pictures.
But in addition to doing that just for the panorama, they also took pictures at different exposure levels by adjusting the shutter speed. This allowed them to capture an image with incredible levels of information about Brightness. These images were probably brought into the computer after the fact and taken into a program like HDR Shop which allows you to take these images and composite them to get together into a single finished .HDR file. Let's take a look at how we can use an image like this to light our scene.
The scene that I have right here is a simple MoGraph scene I have got. A CFL light bulb in the front and a few in the back. They have got a white material on them with a little bit of reflection. But we don't see any reflection, because they're in a black environment. Let's go ahead and add a Sky. Press and hold on the floor and select the Sky object and render again. We have that same cruddy automatic lighting, but we do have a little bit of interest now with the reflections on the edges of our objects. Still it's pretty boring. Now I might want to come in here and add a bunch of lights and really tweak those, but I don't have the time let's say.
Let's say we are under a deadline, and we need something that looks good quick. That's where HDRI lighting is really a hero. To get this set up for HDRI lighting let's grab an HDRI image. Now you can find them on the Internet, you can try and take them yourselves. I typically just go to the content browser where I have all of my presets from CINEMA 4D. Now to get to where I am now what I want you to do is if you have your Search Window open, close it, and if you haven't yet, click on this Presets ink well that will take you to the main Presets folder.
Inside of here are a number of different folders, but I like to use the Search functionality to find what I'm looking for. So click on Search and then just type in HDRI and hit Return. This is going to bring up a list of images and scene files that have the word HDRI in them and some of them are good candidates and others aren't. You want to avoid the ones that look like actual CINEMA 4D scenes as well as the ones that look like images and they especially avoid anything that ends with .jpg. It is certainly not a high dynamic range of image. What you will eventually find are these HDRI material previews.
These are pre-built materials with an HDRI map loaded into the luminance channel and frankly HDRI 001 has served me more times than not. So just go ahead and drag that over into the Materials browser down here and then drag the material on to your Sky object and render again. The image looks different, one, because we have got a background, and two, because if you look at the highlights on your object, what you are seeing is not a specular hit from a CINEMA 4D light, but an actual reflection of an incredibly bright light source, in this case, the sun.
Let's go ahead and use this image now to light our scene and the easiest way to do that is Global Illumination. So go to your render settings and turn on Effect > Global Illumination, and we are just going to leave it at the default. Now let's render again. What's happening is that each of these samples is looking outward from the surface of the object, and because the sky is so large and all-encompassing, each of those samples is really most likely to hit the sky as opposed to other object. So it's getting almost all of its lighting information from the sky. Now look at this render.
With basically no effort, we've got a series of objects that look perfectly integrated into their background. It's a beautiful look and really simple to achieve. Now let's see what happens when we try in just a different material. Go back to that content browser, and let's just go with HDRI3. I am picking that because it's got a slightly different color scheme. I am going to drag this on to my sky and render again. We can see that already this image has a bit more of a green cast, the one that came before, and it's perhaps a little bit darker.
Now it's got a little gray quality to it. It looks really great. If I open up my Picture view, I've also rendered out another image or two with different HDRI maps. So you can see just how drastically changing the image can change the quality of your lighting. Now what if you have something like this, but you don't want to see the HDRI map in the background? Well, the simplest solution is to use what's called a Compositing tag and to get that you want to right-click on your Sky, Choose CINEMA 4D Tags > Compositing. Go ahead and turn off Seen by Camera.
What this will do is take that image out of the equation. So now when we render it's only contributing to the light on our objects and nothing to the background. What if you wanted to swap in a background of a different color? Well, I would recommend using a background object, because it plays well with the sky object. So I am just going to pick a color. This one is rather hideous, but what I have done is created a simple material and thrown in on my Background object. Our pre-pass is rendering, and now we have a differently colored background.
The edges are gray, because that's going to be cropped off in our finished render. Now what if you wanted to have a higher resolution background still say mapped onto a sphere? You could certainly do that. But there are some things that you need to be aware off. We are going to use this sphere to be high background image. Let's pretend that this pink shader here is that image, and I am going to drag it on to my sphere. If I was to just render right now, I would get a scene that was completely black, and that's because this sphere is blocking out the sky.
So what I want to do is create a compositing tag for my sphere, and I want to turn off Seen by GI. Now another thing that I am going to want to turn off is Seen by Rays so that it doesn't show up in my Reflections either, and let's render again. All of our lighting is coming from the Sky object and none of it is coming from the sphere. So by simply using an HDRI map, you get highly realistic lighting that will allow you to easily integrate your objects into a real-world environment.
- Modifying depth of field
- Animating rack focus
- Using blurry transparency to create frosted glass
- Understanding global illumination
- Setting up HDRI lighting
- Optimizing render sampling settings
- Preventing over-/underexposure with color mapping
- Using negative lights to selectively darken parts of scenes