12 August 2010

Basic Lighting in 3D Max


This is my first little tutorial I'm posting here in my portfolio. I'm going to try explaining you how to get some better rendering results in 3D Studio Max. I'm using the 2008 version, since the others don't work well with Vista, but it should work fine in other versions too. Of course, there are many aspects when it comes to improving your renderings. You can get your models to look better, improve your textures, get better animations, ... but what I'm going to talk about is the lighting of your scene. Although it may sound like an unimportant thing, lighting is a crucial part of your rendering. I suggest we start of immediately.

As you can see, I've set up a little scene over here. The scene contains a ground plane, a few boxes and some text, to make sure I use all kinds of geometry. This means, there are no hidden elements that could improve the renderings later, making it easier for you to follow along. I'll try mentioning all steps, to make it easy for you. So, after setting up the scene, I immediately hit the render button, and this is what will pop up. Well, actually I moved the camera too, but that won't influence the rendering much either. This means, there are no lights, materials, ...whatsoever in the scene. By default, 3D Studio Max will use an ambient light to light the scene. The thing is... the chances of this light being exactly the light you want for your scene are very small. So, the first things we're going to do is add some lights! I prefer working with omni lights since they give your scene a natural look. While when you're using something like a spot, you'll get a hotspot and a falloff zone, which you don't have in real life. Omni's make your light scatter nicely.


Okay, this is looking a tad bit different. What have I done here? Well, I added one omni behind the camera (meaning, in front of the scene). I just left the settings to default, since it looked okay in my case.But, depending on your scene you may want to change some of the settings, depending on the look you're after. Eg. in a desert scene, you may want to add a tad bit of a yellowish color to the light. While in an underwater scene you'll want to go for a blue color. I just left the settings as they were over here. But to be honest... it still looks aweful, no? These are the kind of rendering people who work with 3D programs for the first time usually get. When you're outside and look out of the window, looking at something like a house, is it only are only 2 sides of the house lighted? No... or you're house is rather weird. In real life, light can be deflected, meaning the light will diffuse over a large area, also lighting the walls not pointing towards the sun. At the moment, only the polygons pointed towards the light source will be lit. A simple way tosolve this, only using omni lights would be to add a light in the back of the scene. This way, the other sides of our boxes and text will also be lit. Make sure you set the intensity a bit lower then the front omni though, since that will be our primary light source!


There we go, one omni added in the back of the scene. I used the default settings once again, only thing I changed is the intensity, I set it from 1 to 0.75. Now we are getting somewhere right? Everything seems to be lit naturally, and we don't have the massive contrast problems we had before. The thing is, it still doesn't look natural at all. All light is divided pretty much equally over the surfaces right now, which is not how it works in reality. In real life, there are areas's the light can't reach, and they will cause shadows. Luckily, shadows are no problem in this age of 3D technology.


What we need to do now is find the best shadow solving system. As you can see in the screens up here, there are 3 main systems that can be used (mental ray excluded). Shadow Map and Ray Traced both look brilliant, while the Area
Shadows looks like it could use some work. What will we choose? You may call me crazy but I'm going for the Area Shadows, to show you what a little bit of tweaking can do. So, access both of your omni lights, check the box in front
of "Shadows" and choose "Area Shadows". You may also want to check "Use Global Settings" for both of them. This way you only need to change the settings once in case you want to adapt something later. After that, hit the
render button once again and something like this should pop up.


Not looking too good is it? But it IS actually the most realistic render we've got until now. The only thing left to do is some tweaking in the settings for the shadow system. What I want you to do is change the shadow integrity to "15", set the quality to "8", change the jitter to "8" and change length and width both to "50". This will cause the shadows to appear more diffused over the surfaces of the objects in your scene.

As you can see, everything looks way smoother and even pretty realistic, compared to the first render we got. Using this technique you have a lot of control over the positioning of your lights, intensity, color, and much more, making it quite a good system to use for shadows. To prove it, here is a render of the exact same scene, with the color of the back light changed to a pretty dark blue color, the front light with a near-white-blue color and the material for the text to a purple color.

Download Scene File here.

Still looks quite good no? That's basically all you need to know to get your scene well-lit. Of course, you can add more lights, move them, different colors, intensities, ... it'll always look good. But, there are some other lighting solutions I'd like to show you. First of all, a solution to shadows even better than this one, but with less control.

As you can see, the amount of light in the scene had significantly increased. This is because I added a skylight on top of the scene (hovering in the center of the world, and a bit above the scene). After doing that, I checked "Cast Shadows" and used 20 Rays per Sample and a ray Bias of 0.005. This gives for a nice overall lighting of your scene as you can see. Also, depending on the Rays per Sample you use, the solution will overall be way better than the solution you get using omnis. The only problem is, that you're shadows won't show up that well anymore and that all objects will already have some kind of "lightness" to them. You can decrease the intensity, but the surfaces will always be lighted a tad bit. It does look way better though!


In this render, I turned off our omni lights and as you can see the scene looks pretty good. It is equally lit everywhere and shows shadows where needed. It doesn't use any of the information of our previous lights though. In some renders, this may be the look you're looking for. Up to now, I've been telling you we were working on the lighting, but actually we have been working on the opposite all the time: the shadows. Of course, these 2 things are actually the same, since shadows are created by light. But, we only made the dark spots look right for now. Another thing 3D Max will allow us to do, is to calculate how the light will be scattered all over the surfaces. This process is called radiosity. I'll show you a quick example of it.


Here is a render where I used radiosity. To be honest, it's not pure radiosity. I turned off the skylight, turned the omni lights back on and made 3D Max calculate the scene's radiosity. This can be done by going to "Rendering" -> "Advanced Lighting" -> "Radiosity". There, you can specify the quality and perform the calculations. I chose to go with the default: 85%. You may be wondering... "You said Radiosity is a solution for the lighting distribution, not a shadow system, then why am I seeing shadows?" Well, I kept the shadow settings for the omni light activated. This means, we are using both a system for lighting distribution and one for shadow calculation at once, making this probably the most accurate shadows we can get in this scene. Of course, you can still improve the quality, by adapting the settings for both solvers.



Here, I changed the radiosity quality to 98% and changed the shadow quality to 15. As you can see, it's just a minor improvement, and when you are looking for a decent render speed, you don't want to go for this. But it may just give your scene that extra bit of detail you are looking for. Those are pretty much the basics of getting your scene well lit in 3D Studio Max. Of course, these same principals can be used for any kind of scenes. You'll just need to adjust the settings accordingly to get everything to look right. Also, when you are making test renders, you may want to reduce the quality of the solutions, inorder to be able to render frequently at a decent speed. For your final render, you'd best go with the best settings your computer can handle.

No comments:

Post a Comment

Apply to be a Chitika Publisher!
Follow on Buzz