Help - Search - Members - Calendar
Full Version: Lighting Tutorial
Hash, Inc. Forums > Technical Direction and Development (Learning Animation:Master) > A:M Rendering, Compositing and Special Effects > Texturing, Lighting and Effects
Pages: 1, 2
ypoissant
<span style='font-size:14pt;line-height:100%'>Lighting Tutorial Part I</span>

<span style='font-size:12pt;line-height:100%'>IMPORTANT NOTE: All the renders for this tutorial have been corrected with a Gamma of 2.2.</span>

While answering some questions about radiosity projects here. I observed that there are a few things about lights that needs better coverage. So I decided to create this tutorial. I will cover basic and not so basic light properties settings in A:M for ray-tracing renders.

Ray-tracing is an important part of the Photon Mapping algorithm so setting the lights right for raytracing should be the first step in setting up a scene for radiosity.

This tutorial will also serve as a starting point for the next tutorial which will use the same basic scene to setup a realistic radiosity render.

When I started this tutorial, I thought of using an already existing scene suitable for radiosity so that I would not have to spend time modeling a whole room. So I selected a scene readily available which is the Thanksgiving Diner scene modeled and choreographed by Cindy Grove who did a good job particularly with the food models. This scene can be found on Hash Free Model Web page. On this page, select the "Scenes" icon in the right pane and then download the first downloadable scene you will find on this page.

Decompress that in its folder and then download and decompress those add-ons in the same folder. The add-ons comprises a project file reorganized so that each model is in its separate file. There are a few models too for which surface attributes and materials had to be slightly modified. By placing all the models in separate files, it will allow me to post new choreographies and models to be included without posting entire choreographies.

In A:M, open the project "Thanksgiving Diner Ori.prj" project file and render.




This is what you should get.

This scene was theatricaly lit. By this I mean that lights where placed and oriented in such a way to spotlight some important objects in the scene just like it is done in theater lighting. However, the goal of this series of tutorial is to explore realistic lighting. So let's just discard the theatrical lights from the scene and replace them with candle lights to illuminate the scene as if it was illuminated from the chandelier lights above the table.
  • First save the choreography under a new name "Default Candles.cho".
  • Then delete all lights from the choreography.
  • Create a new bulb light in the models container.
  • Drop 5 instances of this new light in the choreography and position each of them at the center of each chandelier bulbs.
  • Set the light width to 15cm so that it just covers the chandelier bulb and leave all the other light properties at their default values.
  • Set the options to "cast shadow" for the chandelier in the choreography to OFF.
Rendering at this point will give you this:


That's it for this first part of the tutorial. I will let you meditate on the results and I will continue exploring ways of settings the lights to improve the lighting results in the next part to come shortly. My goal is to find a setting that will produce an illumination that is very similar to radiosity but without actually using radiosity. And I will explain the implications of the different lights properties that I will modify during the course of this search.

l8r
luckbat
Yves is love!
frankH
Thanks Yves,
i always feel that lightning is the most important point in creating Images, and now for the first time there are wonderful tutorials from an insider.
While you planing your tutorials, is the different reaction of surfaces to light a part of it?
Looking forward for more.
Greetings
Frank
Hutch
Thanks Yves! Lighting is something I would really like to learn more about. The main reason I don't know much of anything about it is that I am too impatient to wait for renders only to find out I don't care for the results.

As an example, I wanted to dim the lights in the candle lit dinner scene a bit. I did a few quick renders of small areas to see if the change was what I wanted. It seemed good. So I rendered the entire image and 30 minutes later it didn't seem as nice as I thought.

I like the results on most of the room. I just don't really like the shadow of the chandelier on the wall and the over all lighting of my turtle. When you added your candles, you left the fall-off at 500cm? Would reducing the fall-off have been a better way of reducing the over all brightness of the room for me?

Thanks again for doing these tutorials!
ypoissant
QUOTE (frankH @ Dec 8 2004, 02:53 AM)
While you planing your tutorials, is the different reaction of surfaces to light a part of it?

You are right, understanding how different types of surfaces react to light is also very important for realistic renderings. The current tutorial will not touch that aspect.

There is enough material to cover concerning surface properties that it is worth a whole tutorial by this topic alone. This is something I definitively plan to do.

In the meantime feel free to open a discussion about that topic if you have any questions.
ypoissant
QUOTE (Hutch @ Dec 8 2004, 04:31 AM)
I like the results on most of the room. I just don't really like the shadow of the chandelier on the wall and the over all lighting of my turtle. When you added your candles, you left the fall-off at 500cm? Would reducing the fall-off have been a better way of reducing the over all brightness of the room for me?

Oups! I forgot to give the following instruction :

In the choreography -> Shortcut to Chandelier -> Options, set "Cast Shadows" to OFF.

It is better to do that in the choreograghy than on the model itseld so that the model stays untouched for later possible reuse.

As for light adjustment, you basicaly have two choices: Reduce the light intensity or reduce the light falloff distance. You will get very different effects from one or the other. This is precisely what I will cover in part II. In the meantime, you may experiment to see what results you get.

What is it that you don't like about the turtle lighting?
Zaryin
I'm glad you started this tut, Yves. Wouldn't leaving the chandelier's shadow on be realistic? Why would you take that off if you wanted a realistic scene?
ypoissant
It is a compromise thing. The chandelier shadows does not contributes much to this scene except trouble getting rid of the shadows. The chandelier model is so near the lights that it cast really ugly crisp shadows on the walls looking like mack bands. And if you set multi rays, you get bad cases of noise everywhere. In this case, the trouble of keeping the chandelier shadows outweighted by far the realism that it shadows would have provided. There are much more important factors contributing to the realism of this scene.
ypoissant
Click to view attachmentClick to view attachment<span style='font-size:14pt;line-height:100%'>Lighting toturial part II</span>
<span style='font-size:12pt;line-height:100%'>Relation between light intensity and falloff distance</span>

So we left with a scene that looked like that:


Obviously, there are too much light which is kind of normal because we have 5 lights with 100% intensity where we would normally put only one. So lets reduce the light intensity to 1/5 which is 20%. So together, we will have 5 times 20% = 100% intensity. Adjust the intensity on the light model. Not on the light shortcut in choreography. And render.

You should get something like this:


Note how everything look flat. The walls are almost uniformly red with no shade gradients. The table is also uniformly brown. Apart from the obvious perspective, there is no depth to this picture.

This is because the light falloff distance is large enough to enclose all the objects in the room including the room itself. as can be seen in this :


The light falloff distance defines the volume around the light where light intensity is constant. What we just did is define a light where the light intensity will be 20% everywhere inside the falloff sphere. Hence the flat shading. Every object in this scene is illuminated with exactly the same intensity no matter its distance from the light.

This is not what natural lights do in reality. In reality, light intensity decreases as the distance from light increases. Actually, if you increase distance by 2 times, lets say from 5 feet to 10 feet, then the light intensity the object will receive is 4 time weaker. This is called the inverse square law for light attenuation.

Lights in A:M also follow the inverse square law but only starting from the falloff distance. So in the case of our 500cm falloff light and 20% intensity, an object at 500cm from light will receive 20% light intensity. Double this distance, at 1000cm, the object will receive only 1/4 of 20% = 5% intensity. Triple the distance, at 1500cm the object will receive 1/9 of 20% = 2.22% intensity.

Using falloff distance, in A:M, allows you to control light intensity for far off objects without having to specify a huge intensity value for the light. And you don't have to figure the correct intensity value by trial and error too.

The procedure is very simple. You know that at the falloff distance you have the specified light intensity and from that distance and away, light attenuation behaves in a normal way. So if you want to light a scene, you just need to set the falloff distance of each light to a distance where it just touches the first object that it needs to light in a realistic way. Once this is done, you simply adjust the light to its proper intensity. 100% intensity is a good starting value.

So the next step is to do just that :

On the light model,
- Set the intensity to 100%
- Set the falloff distance to 100cm so that it just gets near the turkey on the table.

If you render, you should get something like that:


I'll let you meditate on this one. Next time, I will review how we can control the appearence of indirect lights to fake radiosity a little without adding more lights but simply by adjusting more properties of the candle lights.

l8r
wwoelbel
Let me see if I understand. When using the ray-trace renderer, light intensity is constant within the fall-off distance of a given light and is equal to the intensity set for that light. This is different from the implementation under photon-mapping? I was under the impression that with the PM renderer, that the inverse square law was applied across the entire light path and that the fall-off distance specified the intensity of a light source at that distance. No?

Bill
ypoissant
Photon Mapping is an algorithm that uses raytrace at the end. So when raytracing is called, this constant illumination within falloff does apply.

However, the first part of Photon Mapping, which consist of shooting photons in the scene and then collecting the irradiance from those photons, this part does not use raytracing and thus cannot work the same way.

Photons do not attenuate. The inverse square law is only a consequence of the dispersion of photons as they leave their emiting source. When we do raytracing, we actually compute the effect of this dispersion with the inverse square law formula. But because this is a formula and not a simulation, we can play tricks with it as we need (We'll see more of those tricks further away in the current tutorial).

For the photon shooting and collecting part, however, we do a simulation. This is not a formula. So we cannot play the same tricks.

This is the reason why, when you setup a scene for radiosity, you must set your light falloff so that it does not touch any important objects in the scene. This way, the illumination as computed by the raytracing part is compatible with the illumination as computed by the photon simulation part for all important objects in the scene.
wwoelbel
That makes sense. Understanding *how* something works, for me anyway, helps me to be able to better use it. Thanks for explaining.

Bill
ZachBG
Wow. Thank you, Yves, this is really helpful!

(former theatrical lighting designer speaking, who has never quite figured out lights in a CGI world.)
Drakkheim
QUOTE
Photons do not attenuate. The inverse square law is only a consequence of the dispersion of photons as they leave their emiting source

So does this mean that when i adjust the fall off of a light or it's intensity (color even?) and don't recalculate radiosity the resulting image is still valid for visualization purposes?

I done that in the past but never convinced myself that it was valid and went ahead and made more changes and recalculated anyway.

-simon

-ps What does Precompute Irradiance do? (aside for take forever wink.gif )

Thanks for these tut's which are really helping to shed some light on the subject!
(sorry couldn't resist, but the sentiment is sincere)
ypoissant
If you change something on your light, you should recompute radiosity. If you change anything on your light, it will necessarily affect the radiosity calculation. So if you don't recalculate radiosity, you risk making incorrect adjustments because the render will not reflect the true result.

Precompute Irradiance: In reality, there are huge number of photons hitting everywhere. It is obviously not possible to do that without spending very long calculation time. To reduce radiosity calculation time, we shoot a limited number of photons and estimate the resulting irradiance by computing photon density in the whole scene.. When you set photon samples to some numbers, then the density estimation is made by taking that numbers of photon into account.

If you want to control the Precompute Irradiance calculation time, you can either reduce the number of photons in the scene or the number of photon samples.
vf124
QUOTE
I observed that there are a few things about lights that needs better coverage. So I decided to create this tutorial. I will cover basic and not so basic light properties settings in A:M for ray-tracing renders.


Yves,

Man, you are really something wink.gif THANK YOU for sharing ...
wwoelbel
QUOTE
you should recompute radiosity


I am now going to show how dumb I am!

What do you mean by recompute radiosity? When I do a radiosity render all I do is turn radiosity on, set the parameters underneath the radiosity bit, hit the render to file button, and provide lots of cooling for the CPU.

Did I miss a key point?

Bill
Drakkheim
Right click on the chor and there is an option for calculate radiosity. After that runs you can use the progressive renderer (shift q, right click n drag marquee) for a quick 'spot check' for tweaking your settings without having to render the entire thing.

-simon
wwoelbel
Aha!!! This will reduce the number of sighs when I come upstairs in the morning only to find out that AM did not read my mind when arranging the lighting for the scene. I had been tweaking my lighting and then sending off a full render before going to bed. Who would have thought that software might actually do nice things and save time!

<sheepish grin>
ypoissant
Yes. This right-click choreography option is to allow you to do test renders without going to render to file.
ypoissant
Lighting Tutorial part II-b
Why the Inverse Square Law

The Inverse square law is difficult to figure with abstract descriptions so I did this little animation to accompany the following description :

In this anim, there is a light source which emits photons hitting a square panel. The tiles on the floor each have 50cm sides. So the panel is located 100cm fron the light source. As it is at the start of the animation, it receives 36 photons (in the real world, it would obviously receive way much more than that and they would not be organized in such a regular way. But the theory still hold the same).

Once photons leave a light source, they travel in a straight line until they hit a surface. The illumination intensity on the surface is equal to the total number of photons (this is a simplification of course).

So at start, the panel receives 36 photons as the panel moves away from the light source, it receives less and less photons. At 200cm, it now receives only 9 photons. 200cm is 2 times the distance as 100cm and 2² = 4 so the number of photons at 200cm is 1/4 it was at 100cm. 36/4 = 9.

When the panel have reached the end of its movement, it is now at 300cm from the light source and now recveives only 4 photons. 300cm is 3 times 100cm, 3²=9 and 36/9 = 4.

This is where the inverse square law comes from.

I'd like to get feedback on this animation, I'd like to know if this animation makes the concept clear.
Rodney
Yves,
Excellent description.

I wonder if the animation might be more clear if there was something present to tell the eye that the tile is moving away from the light.

As it stands (my eye) isn't sure if the tile is changing size or something else is going on.

I guess what I'm saying is that a reference point might make the animation more clear.

After rereading your description the animation made perfect sense.

-Rodney

Edit: Your updated animation perfectly shows the concept. Thanks Yves!
ypoissant
So the checkered floor is not clue enough for the panel motion? Is it because the floor is too dark? Maybe I should put a back wall too?
Ron_Jones
I think the animation really helps.

I think the camera should to be static so that the distance relationship between the light source and the square panel over time is more obvious.

aaver
Yves,

I know you point it out in the text, but I'm not sure if it's obvious from the animation that the angles between the light rays are constant in time. The suggestion to keep the camera static might help with that.

Also I think it might be easier to understand this if the missing rays did not disappear, but I'm not sure.


Since the Inverse Square Law only holds for point sources or for other sources in the far field, I always try to use two concentric spheres with the light source in the centre when I try to explain this. One sphere with the radius 1 and the other with the radius 2. Every ray will pass both the spheres but since the larger one has a surface area that is 4 times (2*2) the area for the smaller sphere, the intensity (or the number of photons per area unit) will be 4 times as high on the smaller sphere.

I guess that explanation also needs an animation to go with it wink.gif



ypoissant
I think you are right. Keeping the camera static in this case would very probably help in seeing that the rays angles are constant. I will do that and repost the change the animation.

Thanks.

Edit: I've updated the movie. The new one is with a static camera. See the post above.
Ron_Jones
Yves,

Much better! It clearly illustrates your point.


-Ron
ypoissant
Anders,

QUOTE (aaver @ Dec 10 2004, 02:35 PM)
Since the Inverse Square Law only holds for point sources or for other sources in the far field, ...

I see your point. But the inverse square law fundamentally hold for any type of source. It only get more complicated to figure as the light takes on different morphology.

For instance. It is obvious that the inverse square law holds for one point light source. It also hold if we put two point light sources, one next to the other at the same distance from the illuminated object. And it also hold if we put 4 light sources next to one another at equal distance from the object. In fact it still hold if we put an infinite number of light sources at equal distance from the object. That basically what is a flat light source.

Of course, if the light sources are all at a different distance from the object, like a neon tube with the object moving near and along the tube, then the result of the inverse square law if more complex to compute with a formula but it can be done (I trust you can come up with the integral smile.gif ). However, in CG, the difference is irrelevent because we use Monte-Carlo integration anyway and thus the light source, watever its shape, is considered as a collection of multiple sub-light sources all behaving according to the inverse square law.

But for the purpose of those tutorials, I don't want to go over the board with these abstract issues.

QUOTE
... I always try to use two concentric spheres with the light source in the centre when I try to explain this. One sphere with the radius 1 and the other with the radius 2. Every ray will pass both the spheres but since the larger one has a surface area that is 4 times (2*2) the area for the smaller sphere, the intensity (or the number of photons per area unit) will be 4 times as high on the smaller sphere.


I understant very well your demonstration. For regular users, that would probably be best understood with either a picture or an animation though. I'd be interested to know which demonstration is the most helpfull in comprehending the concept from regular users. For my part, I remember I really had the Ah-ha epiphany when I figured the example I'm trying to demonstrate.
Hutch
Yves, if I am comprehending this correctly, as the object gets farther away, fewer photons are hitting it because their angle remains constant and so some of them miss the farther object by going over the top or the sides. If this is not correct, please disregard my suggestion. If it is correct the video would seem to make more sense if the center 4 photons were the last ones remaining at the end rather the 4 at the right corner. Unless the object is not only moving away from the light but also moving to the right...
ypoissant
QUOTE (Hutch @ Dec 10 2004, 06:02 PM)
... the video would seem to make more sense if the center 4 photons were the last ones remaining at the end rather the 4 at the right corner. Unless the object is not only moving away from the light but also moving to the right...

Good suggestion. I had thought about that too but hoped nobody would notice. So I made the change and post it.

Thanks.
ypoissant
Lighting Tutorial part II-c
The Lambert cosine falloff law

The idea is simple. When a surface faces a light, it receives the maximum direct illumination from the light. As the surface turns away from the light, it gradually receives less and less direct illumination until when the surface is completely flaring with the light, it receives no direct illumination at all.

The following animation will help understand the principle:
The cosine falloff

When the surface is facing the light, it receives a certain quantity of photons. But as the surface turns away from facing light, it receives less and less photons untill it receives no photons at all.

As seen fron the light source, the surface appears to reduce in size according to the cosine of the angle between the light direction and the surface normal. Hence the name cosine law. This law was first published in 1760 by Johann Heinrich Lambert.

The default Phong diffuse shader that is used in every 3D applications including A:M is based on the Lambert Cosine law.

However, the cosine law is true for the quantity of light that reaches a surface but it is not a complete shading model because it does not take into account the viewer position.

As a shader, the cosine law is plausible for surfaces that are perfectly smooth and non-specular at the same time. A set of surface properties which cannot be found in nature nor on man-made objects because perfectly smooth and non-specular is a contradiction. A perfectly smooth surface would necessarily be highly specular. Nevertheless, the Phong diffuse shader is pervasively used in computer graphics and still produces very nice renders.

A good alternative to the Phong shader is the Oren-Nayar shader which is a more complete shader since it takes into account the light and viewer position relative to the surface. And it can model different levels of surface roughness.
ypoissant
<span style='font-size:14pt;line-height:100%'>Lighting Tutorial part III</span>
<span style='font-size:12pt;line-height:100%'>Faking radiosity without adding lights</span>

I left the last tutorial step with this render:


As it is now, the render looks a liitle unnatural because of the lack of indirect illumination coming from light bouncing around on objects, walls, floor and ceiling. The objects in the room are strictly illuminated according to the inverse square law.

The previous setting with light falloff distance encompassing the whole room produces the opposite effect with all objects receiving the same illumination because light intensity is constant within the falloff radius.

By setting the light falloff to encompass all objects in the scene, we don't have any control on light attenuation. But by setting the light falloff distance so that it doesn't touch any important object in the scene, we can control the light attenuation.

We can do that with the light "Attenuation" property. At 100% attenuation, we have the standard inverse square attenuation. At 50% we have a linear attenuation. That is light intensity decreases linearly with distance. In other words, it decreases much more slowly. And at 0%, light intensity is constant just as if the whole scene was enclosed inside the light falloff distance. And of course, any values between 100% and 50% produces an attenuation which is slower than inverse square but faster than linear and any value between 50% and 0% produces a falloff which is yet slower than linear.

For instance, setting the candle light attenuation to 50% (linear) will produce this render:


Raytracing renderers compute only direct illumination coming from lights. They do not compute indirect illumination coming from surrounding objects. In the real world, illumination comes not only from light but also from surrounding objects which produces seemingly much more slowly varying attenuation than pure inverse square attenuation.

It would be possible to add more lights in the scene to simulate bouncing lights but a much cheaper solution is to modify light attenuation first. Then, if need is still there, adding well positionned bounce lights can come as nice complement.

Reducing light attenuation will make the scene illumination less harsh and more pleasant. More comfy too because it does not give the impression that the scene is located in the void anymore.

The previous render produces a little too slow attenuation for my taste. So I set the attenuation to 66% and re-rendered to get this:


That is much better.

What is now missing is the reddish contribution from the walls. This can be easily taken care of by applying a redish color to the candles. An RGB color of Red:239, Green:184, Blue:143 on Windows (or 94%, 72%, 65% on the Mac) will result in this render:


This is not bad. But I find the table, chairs and credence a little floaty over the floor. That is because the shadows are not dark enough. Shadows are an important cue in perceiving depth and spatial relationships, in particular when an object is seated on another object. This is the case for the table, chairs and the credence.

In the next part of this tutorial, I will explore different ways of controling the shadows, their darkness and their softness.
JohnArtbox
Fantastic tutorial.
I need to follow from the beginning again to absorb it all.
Good to see this concentration on what's probably the least understood section of AM.
frankH
yves,
you show and explain light the way i never thought about it. It is realy wonderful. I will try the lightningsetup and i can´t wait to get more of these brilliant informations.
Thanks
Frank
pancho simpson
it all seems awesome but on avg, how long are these images taking to render? is there a way to achieve realistic lighting that still renders fast?
ypoissant
The images I posted here took around 20 to 30 minutes to render at 9 passes on a 2.6mHz P-IV. They were actually rendered at 640 x 480 and downsized for posting here.

If what you want to achieve is realistic lighting, then you must expect some cost in render speed. You cannot simulate realistic lighting and continue to use traditional CG tricks that render fast. I mean, you could but the other price to pay is very high level of technical expertise to use the tricks in a way they weren't really meant to be used. You must have the technical expertise to compensate for the shortcoming of the cheap CG tricks. You must know the technical ins and outs of each CG tricks in a way that you can make them sing. And you end up with a scene with a lot of different lights for different realistic effect, even negative lights etc. And in the end, you still get slower render times. A lot of talented and skilled CG artist have actually done that for years.

If the most important aspect of your production is render speed, then you will have to go for artistic or theatrical lighting. Not for realistic lighting. There is nothing wrong with that but this is not the subject of the current tutorials.

This said, I believe, if you follow those tutorial, you will end up with a better technical understanding of lighting and you will be better equiped to make your lights sign. Even for artistic lightings.
ypoissant
<span style='font-size:14pt;line-height:100%'>Lighting Tutorial part IV</span>
<span style='font-size:12pt;line-height:100%'>Different tricks to adjust the shadows</span>

Continuing from the last render in part III. We had 5 lights for the chandelier with 80% shadow darkness and raytraced shadows :


With the shadow darkness set to its default of 80% we get a rather light shadow everywhere. Here again, this is a Computer Graphics trick to compensate for the fact that raytracer renderer does not compute indirect illumination. Normally, a traditional raytracer would produce pure black shadows. But by using this trick, it is possible to simulate somehow the effect of indirect illumination.

And it is possible to control this indirect illumination effect by increasing or decreasing the shadow "darkness" property.

Some examples:


It can be observed that increasing the shadow darkness does not change the shadow quality. It really only change its darkness. The shadow quality, or its softness, comes mostly from the 9 passes that were used to render this picture.

The other important property that affects shadows is the light width. When rendering in multipasses, the light width will determine the quality, or softness, and the darkness of the shadows.

Here are a set of renders with shadow darkness set to 100% but with different light widths:


A light width of 0 will produce very sharp shadows typical of traditional raytraced renders. And note also, that the shadows are black just like traditional raytraced renders. A light width of 0 is called a "point light source". Remember that there a actually 5 lights in this scene.

As the light width increases, not only does the shadow softness increases but darkness also decreases. And this even though we set the shadow darkness to 100%. This is particularly noticeable under the table. At 100 cm width, there is almost no perceivable shadows under the table. And the shadows is so soft that it is almost unnoticeable except on nearby objects like under the plates and on the chair seat.

Not surprisingly, the best light width for this scene is 15 cm. This is actually the size required for the light to overlap the modeled candle bulb. 30 cm width is not bad too but still too soft and thus not realistic enough for my taste. I would probably choose a width between 15 and 30 cm to get the best and most believable results. I would guess that 20 cm is the best bet.

So it is important to remember that the light width will also control the shadow darkness in addition to the shadow softness. And the shadow softness as well as the shadow darkness is in direct relation with the distance between the shadow casting object and the shadow receiving object. This is an aspect of the shadows I will cover in an upcoming tutorial in this series.

It is possible to have the light width control only the shadow softness and adjust the shadow darkness exclusively with the shadow "darkness" attribute instead of having it dependent on the light width. To get that, simply set the number of rays cast to any number higher than 1.

Here are a set of renders with light's shadow darkness set to 100% but with different light widths and 2 rays cast:


Notice how the shadows are always black except in their softness areas. Increasing the light width only affects the shadow softness. That is because by setting more than one ray cast from the light, it is equivalent to setting several point-light sources per light. By using a 9 pass render, we actually get 18 point light sources per light.

Important:
When preparing a scene for radiosity, it is extremely important to have black shadows. The shadows should be soft but black. That is because we don't want the raytracer to contribute any indirect illumination approximations. We want the radiosity to be alone in contributing the indirect illumination.

In the next tutorial, I will explore a few more shadow behaviors and a little overview of z-buffered shadows.
mediaho
I finally had a chance to go through this. This is an excellent tut. Thanks for this, Yves!
ypoissant
Important note:

I just updated all my renders for my tutorials. They are now corrected with a Gamma of 2.2.

Why ?

When I saw the last set of comparative renders, up here, with the different light widths, on my wife computer, I was abashed that all the renders looked exactly the same. That is because she does not Gamma correct her monitor as I do.

So it hit me that the vast majority of the computers that are used out there are not calibrated properly. In fact most of them are just used as delivered by the manufacturer. That is for Windows computer, no gamma correction at all and for the Macintosh, a Gamma correction of 1.8.

That lead me into a lenghty research about Gamma correction: How? How much? When? Where? and Why? Which is why I didn't post here for a while.

The short conclusion is that for anyone interested in producing professionally looking renders, one extremely important aspect to take care of is the display system and its proper calibration.

But simply calibrating ones monitor is not good enough. If the produced renders is to be posted on the Web, then those renders must be gamma corrected so that the vast majority of Web visitors will see the render as the producer intended it. And this is where the theory breaks down. On a theorically well calibrated system the gamma corrected images will all look way too washed out. So, we are in a catch-22 situation.

But there are solutions. And I plan that my next set of tutorial will be about workstation setup and calibration. This have nothing to do with A:M per se but I see this as a prerequisite for any other rendering or radiosity tutorials if I want them to be as efficient as possible.

I shall complete the currently running lighting tutorial though, before I start this calibration tutorial. There is not much left to go though.
jesshmusic
That is the absolute most frustrating thing about working with the Web. I gave up on web design because people always want their stuff to look the same everywhere and it never does! Maybe some tuts on how to calibrate one's monitor would be useful? I know on Mac it is a very simple process. On a Windows computer I would be clueless!


J
Paul Forwood
Great idea, Yves! I look forward to any ideas that you can come up with for calibrating monitors.

I know that Photoshop has some calibration features but have never tried using it for fear of getting lost and ending up with a display that is worse than it was to start with.

I have some calibration utility on disc somewhere which was pretty good but relied on placing a blue-grey card on the monitor and matching the screen tones to that, depending on the lighting conditions of the room that you are working in. Of course lighting conditions vary throughout the day and night so it is not always correct. Anyway, I can't find the card so any suggestions would be welcome!

I believe that I have always set my pc monitors' gamma to 1.8.

Anyway, that is a brilliant lighting tutorial also!

Thanks smile.gif
ypoissant
<span style='font-size:14pt;line-height:100%'>Lighting Tutorial Part V</span>

<span style='font-size:12pt;line-height:100%'>z-buffered shadows</span>

z-buffered shadows works by computing a depth buffer of all objects in the scene as viewed from the light source point of view. The name z-buffer comes from the fact that the distance from light source is computed along the camera local Z axis.

Then, at render time, when a pixel is rendered, we can determine if it is in shadow by comparing its distance to the light source from the depth data contained in the z-buffer.

z-buffer shadows can be faster to compute because the depth calculation is done once for each light source at the begining of render while for ray-trace shadows the depth calculation is done at least once for each pixel and for each light source.

However, even though a z-buffer shadow map is computed only once, this calculation is done for each pixel in the z-buffer. So a 512x512 z-buffer will require 262 thousand depth calculation. And a 2kx2k z-buffer will require 4 million. So there is a tradeof in speed.

With z-buffer shadow, the shadow quality is mainly determined by the z-buffer map size and by the light cone angle. Increasing the light cone angle almost certainly necessitates that the z-buffer map size be increased also.

z-buffer shadows are not easy to use. They produce all kind of artifacts and the shadows produced don't take distance from shadow casting object to shadow receiving object into account which makes it difficult to get really convincing soft shadows. See Light properties section of the on-line technical Reference Manual for more detailed description of their shortcomings and how to use them.

And here is an example of the same Thanksgiving scene rendered with z-buffer shadows:


For those reasons I don't recommend their usage. They may look faster but for really nice result, large shadow maps are necessary and they take considerable time to render. In the end, it may take as long as soft ray-traced shadows with very large maps.

Here is a quick analysis of some of the z-buffer shadows artifacts:


In the top image, there are no shadows at all. Notice how the plates and the utensils seem to be part of the table. There is no shadows under them to provide a sense of volume and height.

In the center image, even though the shadow map was 2k x 2k and the light size was reduced to 5cm to get as sharp shadows as possible, it is still not possible to get nice shadows all around. We can distinguish some form of shadows under the plates (1) and under the glasses (2) but the shadow is so soft that they don't provide that feeling of depth. the plates still seem to be part of the table. Also, the utensils are so small compared to the shadow map pixel size that they don't even cast any shadows. Even the turkey dish, which actually cast shadow, seems to float above the table because the shadow is way too soft.

Compare that with the bottom image, where all the shadows provide the proper sense of height and depth.

On the next installment, I will show how the Thanksgiving scene can be enhanced with additional lights to fake radiosity.
ypoissant
Click to view attachment<span style='font-size:14pt;line-height:100%'>Lighting Tutorial part VI</span>

<span style='font-size:12pt;line-height:100%'>Radiosity or Faking it?</span>

Here is the render as we basically left it last time.


This light setup is with 5 lights of 15cm diameter each, positionned at the chandelier lights positions, slightly yellowish colored, casting 2 rays each and with 100% darkness for shadows.

The goal now it to get a more realistic look all over. As it is now, there are no indirect lighting coming from the environment. We could use 1 ray per light and thus use the shadow falloff feature to improve the light details under the table and under the chairs. But we would still get black shadows behind the chairs.

The first option that comes to mind is to activate the radiosity:


This was rendered with 1 000 000 photons and 300 Final Gathering samples.

Although it doesn't look like it, there is actually indirect lighting going on in this render. If you were to increase the gamma correction of this render, you would notice it. But it certainly is not what we could have expected. Why?

Here is a very important set of issues to consider when using radiosity: Radiosity will produce realistic renders only in a scene setup with realistic objects, props and textures, even if those props and objects and texture may not be visible from the camera point of view. This is very different than with simple raytracing where only what is actually visible is important.

In the Thanksgiving scene, for instance, all the walls and the ceiling are red. The red color is composed of Red @ 50%, Green @ 0% and Blue @ 0%. Meaning that all photons hitting the walls and the ceiling have their Green and Blue energy completely absorbed the first time they hit a wall or the ceiling. And the Red energy is absorbed 50% each time it hit a wall or the ceiling. So after just a few bounces around, the photons are left with very little energy. Not much to contribute indirect lighting.

When using Radiosity, all colors should have some of each of the red, green and blue channels in them. Pure colors like this red used on the walls here are almost nonexistant in real life. Every surface reflects at least a little of each channels. For instance, even the black Mackbeth color reflects about 3% on each channels.

The other issue with this scene, is that there are no objects in the scene that could reflect more light back. Because this scene was designed for ray-tracing render, there were no furnitures added apart from those that are directly visible in the camera frame. The room could benefit from drapes around the windows, frames on the wall, etc.

Another quick fix, also would be to set the ceiling color to white. As can be seen, there would be a lot of work to add to get a realistic lighting from radiosity.

The other option is to fake rasiosity. By adding lights in the scene, it is possible to simulkate the indirect light coming from the ceiling, the walls and any other objects that would be in the scene.

Here is the way I setup the lights :


There are 10 more lights. All huge klieg lights 100cm in diameter, 180° cone angle and a falloff at 100cm, intensity at 100% the kliegs mounted on the walls have the same color as the walls to simulate light bouncing from them and the kliegs mounted in the ceiling have a white color.

The lights are mounted in such a way that they are flush to the walls and the ceiling, just protruding inside by a few millimeters. There are 2 bounce lights on the ceiling and 2 on each walls.

This is the result:


This render already have a more radiosity feel than the real radiosity render. The indirect light is much more visible on the back of the chairs.

Faking radiosity in this way adds the advantage on much more control on the overall look. For instance, I could add white bounce lights to simulate lights bouncing from a white ceiling even though the ceiling is still very red. Even though this scene is very darkly textured,it is nevertheless possible to boost the radiosity look by playing with the bounce light intensities.

For instance, boosting the wall bounce lights to 150% intensity and reducung the ceiling bounce liughts intensities to 50% will produce this render:


This example shows very basic and mechanical bounce lights placements. It is very possible and is actually the case in production situation, to add several bounce lights judiciously positionned and oriented to add illumination spots here and there and even add negative intensity lights to add shadows. Artistic use of lighting like that have produced stuningly realistic lighting for years before radiosity became fashionable.


That is the last part of this Lighting toturial. I was planing to continue on another tutorial starting essentially where I left here. That is, taking the basis of this scene and exploring the numerous little details, both in modeling, texturing and scene setup, that can make this scene more realistic and at the same time make it more suitable for use with radiosity. But instead, the next tutorial will be about setting up the workstation environment. Specifically, exploring the different gamma settings for work and for viewing. I will be back with more radiosity tutorial later but I feel that a good computer monitor and work environment setup is a prerequisite for those other tutorial.
balistic
Just wanted to post some praise for what you're doing here Yves. I had assumed based on my experimentation with it that photon mapping in A:M was critically broken, but you've proved me wrong.

*eats his hat*
frankH
thank you very much for this wonderful tutorial. I´m realy happy to learn something about the background and not only the "click here and here" stuff. I learned a lot. It´s the best tutorial about lightning i´ve found so far. Thanks again for the time you spend for teaching us the stuff.
Looking foreward for the new tutorials.
Greetings
Frank
robcat2075
Yes, thanks for continuing this lighting explanation. Impossible for me to absorb all at once, but I know I will return to it again and again as I try to do better with lighting.


And if you can come up with a foolproof workflow for gamma, that would be great too.
bentothemax
wow, i finally read through this whole thread . . . thanks alot Yves!!!



Now i can have a scene lit that doesnt take 8 hrs to render . . .

Ben
modernhorse
I printed out this thread and took it with me this weekend on vacation. I've read it through a couple times and plan on going through this scene myself. I wish I had found this before I started my own "personal lighting study". I will now put that one on hold, do this and then take the knowledge gained from this tutorial and apply it my own scene(s).

My thanks also to Yves for putting this together.

..d
modernhorse
Okay, i'm back with some questions of course. I've followed the instructions as best as I can but on the 2nd render of Part I my render is very dark. When we add the new light that will be duplicated I ask the following:

1) Should I be adding a Klieg light?
2) What should the intensity be for this part of the exercise?
3) What are the other 'defaults' for this part of the exercise (falloff, cone angle).

I have played around with falloff a bit to brighten up the render, but I want to be sure I'm following this to a tee to actually know what I'm doing here. Thanks.

..d
ypoissant
QUOTE (modernhorse @ Jul 28 2005, 12:16 PM)
1) Should I be adding a Klieg light?

A default bulb light. (I've added that particular bit of instruction to Part I)

QUOTE
2) What should the intensity be for this part of the exercise?
3) What are the other 'defaults' for this part of the exercise (falloff, cone angle).


Leave all other light properties to their default values. (I've also added that particular bit of instruction to Part I)

Thanks for the feedback and the help in making this tutorial more clear.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.