Home Technical Talk

Lighting Basics and You...

3 point lighting is your friend. There is a lot of reading to be found on the intertron, but I'll give you the skinny version. I'll mostly talk in terms of Max however most of this translates to just about any 3D app and most game engines you plan on using. This is geared toward people who have tried to light a scene and walked away with a headache.

3 Point Lighting: Actually 4 in some cases

Ambient or Fill lighting:
Normally comprised of a few lights that don't cast shadows, and just raise the ambient level of lighting to mimic the natural light bouncing around in your scene. Normally you have a set of lights that point at the ceiling and a set that point at the floor, and they are set at an angle that will include the walls. They use very soft lighting by turning the hotspot beam down and the fall off very high. A good start value for fill lighting varries by I normally start off with .25. The purpose of these lights is to lighten the shadows cast by the key light. Shadows are constantly bombarded with light bouncing off of objects and coming from other sources so they are very rarely 100% black, which is what Max/Maya will do if you don't wash the shadows out or lower their density. I personally use Direct Lights or occasionally Omni's but we'll get into light types later.

Key Light:
Normally this is your dominant light source and casts shadows. Often its just one light, such as the sun or moon if you are outside and a window or a light fixture if you're inside. The less lights you have casting shadows the better off you'll be. Shadows are by far the hardest thing for your CPU to render/calculate and it is best to start with all your lights set to NOT cast shadows and turn it on only when you need it.

Rim Light, Back Lighting or Bounce Light:
This is used to produce a thin outline around your character. Normally placed behind and above the character as a light placed directly behind will show very little if any at all lighting. Adding "fall off" to the self illumination map slot of characters material can go a LONG way in helping rim lighting.

Shadow Light:
Shadows cost processor time to calculate. Any light can be set to a negative number and it will subtract light from the scene, provided you set it to white, and turn off shadow casting. This is a good, cheap way to darken areas and fake shadows for non moving objects. It's important to remember that when you subtract light from a surface that you try to guess how much light is actually hitting the surface. Example if you have two lights hitting a cube both lights set to 2.0 and you wish to remove some of the light from the cube setting your shadow light to -1 will lower the total light hitting the cube to 1. Setting it to -2 will erase the lighting from the cube. This is good for some objects that seem to glow brighter then others. By setting the shadow light to only cast on the one object you can correct the light imbalance without effecting the entire scene.


Light Types:
- Spot lights: These produce light from a single point and it is directed in a specific direction. Unlike Direct Lights the light cast from a spot light fans out like a cone. Think of it as if you where using a pie shape to cast light. The wider the beam the rounder the tip. Under Directional Parameters you can change the beam from a circle to a rectangle giving you a true pie shaped light however the light will still arch between the two end points. You can use a spot light set to rectangle and adjust the fall off/hot spot beam to fan out. This works great for faking light coming in from a square source.

- Direct lights: work much the same, however instead of the light radiating from a point, you specify a circle or rectangle that emits light. These are good for Fill/ambient Lighting as they produce consistent lighting across large areas. You can also change this light from circle to rectangle, which is handy for illuminating an entire wall.

- Omni lights: This is a close approximation to a ball of light. Often the first thing someone new to lighting reaches for when it should be the last. These are actually 6 spot lights grouped together. Each light faces a different direction, up, down, left right, forward and back. Keep in mind for each Omni you place it equals 6 spot lights, Omni's really start to hit render times hard, if they are set to cast shadows. So ask yourself, "do I really need all 6 lights or can I do it with a few cleverly placed Direct/spot Lights?". Chances are 4-5 of the lights in an omni are sending out calculations you could care less about.


Emitting Light: Found in Directional Parameters Rollout
- Fall off and hot spot beams in Direct and Spot lights. The hot spot beam is light being cast at 100%, the fall off is where the light reaches 0%. Putting these two close together (default settings) will result in a sharp edged light. Setting them farther apart softens it.

- Use Far Attenuation much the same way to stop the light from casting lights/shadows infinitely across your scene. This basically tells your light, start here and end here, blend whats in between. This is pretty much the only way to control the fall off in omni lights.


Shadows: General parameters & Shadows (Default off)
- Density: Found under Shadow Parameters Rollout
Adjust the density of your shadows to make them less dark. This also helps to fake light bouncing in washing out the shadows. Since Max/maya don't actually bounce light unless you use some fancy settings that just eat up your time and give mixed results.

- Shadow Map: When selected it has its own Params Rollout.
Uses bitmaps to create shadows. You can decrease the render time by using a small bitmap size and blurring the edges to hide any pixel aliasing that might be showing up. They are good at producing soft shadows which is pretty much the work horse of any shadow scheme. Shadow maps are not great for highly detailed shadows or shadows that cover large areas.

- Ray Trace: When selected it has its own limited Params Rollout
It will cost you CPU time, in a major way but can be highly detailed. There is a point that your shadow map might be so big and detailed that you might as well render with ray tracing. It is not good at blurring the edges of the shadows so this is pretty much a one trick pony.

- Advanced Ray Trace: When selected it has its own Params Rollout
Same as above but at the cost of MORE CPU time you can blur the edges of the shadow by having it sample the edges.

- Area: When selected it has its own Params Rollout
Like shadow map this produces nice soft shadows with the exception that the farther the shadow gets from the object the lighter and fuzzier the shadow gets. This does a GREAT job of producing shadows that are washed out by bounce lighting. However it could end up costing you just as much render time as Ray Tracing.

Organization:
It helps to start out in passes, creating one type of light specific for that pass. I find it helpful to label the lights the pass they belong to as well adjust their line color to reflect their purpose, paying close attention to change the color slightly for lights that cast shadows. (See example image below)
It can also be helpful to put the different lighting passes on separate layers.


Links: I'm sure we can grow this section, these are just the few I have bookmarked on this machine. I remember reading way more then just these.
http://en.wikipedia.org/wiki/Three-point_lighting
http://www.warpedspace.org/lightingT/part1.htm
http://tutorialoutpost.com/view/4605/basic-lighting/
[ame]http://www.amazon.com/Essential-Lighting-Techniques-3ds-Max/dp/024052022X[/ame]

Files:

LIghtingExample01.jpg (Max2008)

Anyone else have any tips, tricks, links, example files?

Replies

  • Wells
    Offline / Send Message
    Wells polycounter lvl 18
    Thank you.

    lighting scenes I can poke around in are a great help.
  • Phobos
    Offline / Send Message
    Phobos polycounter lvl 18
    Good stuff. Lots of good info in there.
  • Valandar
    Offline / Send Message
    Valandar polycounter lvl 18
    *starts scribbling notes*

    I have a bad habit of over-complicating the lighting in a scene... meh...
  • Jaco
    Offline / Send Message
    Jaco polycounter lvl 17
    Thank you, some great info

    Somebody posted this image a while ago, it might be usefull:

    pc_lights_01.jpg
  • Eric Chadwick
    Nice write up Vig. I find radiosity faster to setup and adjust than manually placing bounce and negative lights, but it is nice to have options.

    Some more lighting links
    http://www.3drender.com/light/3point.html
    http://book.hourences.com/booklighting.htm
    http://www.youtube.com/watch?v=4NEMY8qP6eo (quickie radiosity in Max)
  • Saidin311
    Offline / Send Message
    Saidin311 polycounter lvl 11
    Hey Vig, thanks big time for helping me on my last couple of pieces and also for this in depth writeup! I've been doing a lot of reading on lighting and this has been most useful and motivating!

    Actually, I have a couple of questions.

    What is the difference between Near and Far Attune? And whats the difference between Decay and the above?

    I've been using Decay with high radii to give me decent fills and ambients, I have played with Attunements to get similar effects. But I really don't know the difference.
  • Mark Dygert
    Valandar, just remember that adding more lights that only cast light won't add too much to render times. Its the shadow casting lights (especially omni lights) that will start to really lengthen render times. Some "basic" lighting set ups in order to get a natural feel, look like chaotic messes. Just try and put some method to your madness by using passes, layers, labels and colors to keep things straight. Keep those shadows under control and you'll render quickly =)

    Jaco, thats a great illustration!

    Eric, shushh you'll spoil my next few threads heh =P Good links, thanks!

    Saidin311, Glad I could help.
    Near Attenuation is just like far but deals with the gradient ramp up from the center most point of the light to the 100%. So the light actually starts at 0% (instead of 100%) and ramps up to 100% and then once it encounters the far Attenuation rings starts to head back down to 0% again. It actually creates a dark area near the center of the light, but to see the effect you need to adjust the start value above 0.
    Attenuation.jpgNearAttenuation.jpg

    As for Decay this lets you set a starting point the light will start to decay, much like attenuation. However it can be added to attenuation to put in place another gradient that helps fade the light over the distance of the light being cast. Know that Decay alone without far attenuation (a stopping point) will continue infinity causing more calculations you might not care about. Most of the time you can handle the lighting without turning Decay or Near Attenuation on, they area rare case setting, but can be handy to know about.
    Decay.jpg
    On the bottom example I moved the Decay closer to the light so its effect would be more noticeable.
  • Vailias
    Offline / Send Message
    Vailias polycounter lvl 18
    just curious: where did you find/read that an omni/point light is equivalent to six spotlights?

    I have no idea why it would be treated that way as it would be much harder to code.

    Every piece of code dealing with lighting I've ever seen, be it Cg, HLSL, or C++ refers to an omni/point light as one of the simplest types of lights to render against, following a directional/distant light.
    distant light = constant vector, no attenuation.
    Point light = alterable position, with attenuation
    spot light = alterable position with heading, with attenuation

    The only reason I can think of that an omni would take longer to calculate than a spot would be if you have ray tracing on and a high ray count per light, or are solving for a radiosity solution. IN which case there are simply more points lit in the scene per omni light that need to have separate calculations done. Maybe this is what you were trying to say?
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 18
    The Omni light only is 6 spotlights, when needing shadowmaps. Otherwise its indeed one of the mathwise simplest/cheapest/fastest form of a lightsource, cept for infinite distant light, as Vailias suggests.

    But as shadowmapping is used in many games, and no-raytrace stuff is around, omni in realtime shadow situation is slow. Be aware that many games will have like no realtime-shadows at all for many omni lights (or baked via lightmaps, in which case the rendering base is raytracing which means omni is fastest). Or omni shadows are approximated (dual hemispheric).

    nevertheless they can be approximated with those 6 spotlights for proper shadowmaps. I just havent seen that in a lot of games, mostly UT3 & Crysis. In stencil shadow games, omni also is not equivalent to 6 spotlights either. As for baking times, it indeed depends on how much light energy is being "spent" in the scene, but that depends greatly on the topology as well.
  • Eric Chadwick
    Nice illustrations Vig!
  • Vailias
    Offline / Send Message
    Vailias polycounter lvl 18
    CB thanks for that explanation. I didn't realize that was the case for shadow mapping.
  • Mark Dygert
    I'm talking about basic CG lighting techniques nothing advanced and not really engine specific, if it happens to apply to engines or other applications, then great.

    I came to the conclusion that omni lights are less efficient at casting shadows after doing quite a bit of test renders in 3Ds Max on big scenes. Lets be clear about my position on Omni lights, they are great for casting light, but lousy at casting shadows the farther away from the light you get. Onmi's shadows quickly degrade the farther you get due to their radial nature and the spread of rays. The farther you get the higher the ray count and the higher the chance that it will spend your shadow map in areas it shouldn't.

    For me it is best to send rays and shadow map pixels to a specific location and make the most of them. Rather then send that info all over and hope enough of it lands where I need it to.

    Obviously Omni's have their place otherwise they wouldn't be in every app. For me and others in the same line of work we spend most of our time trying to get soft edged shadows in key areas with low render times. Yes there are times using shadow casting omni's are the best option. But I've found them to be the exception not the rule. I also find that people new to lighting like to over use them and then complain their scenes are taking too long to render or they have uneven lighting.

    Long render times leads to less changes you can make quickly which cuts down on your futz/tweak time. If you can get to the same results quicker then its a win.

    I strongly urge everyone to find out what works best for their scene, their hardware and their time constrains. I hope that everyone takes the time to experiment with lighting as if it was an extension of their artistic abilities and not just an after thought. Starting with a firm foundation in the basic terms and settings will greatly increase their ability to succeed with the more advanced features.
  • rybeck
    Thanks for sharing great writing.
    Shouldn't it be sticky? smile.gif
Sign In or Register to comment.