From BlenderWiki

Jump to: navigation, search

[edit] Lamp

Mode: All Modes

Panel: Shading/Lamp Context

Hotkey: F5

[edit] Description

Lamp Light.
The 'Lamp' lamp is an omni-directional point of light, that is, a point radiating the same amount of light in all directions. It's visualised by a plain, circled dot, (Lamp Light).

Being a point light source, the direction of the light hitting an object's surface is determined by the line joining the lamp and the point on the surface of the object itself. Light intensity/energy decays based on (among other variables) distance from the Lamp to the object. In other words, surfaces that are further away are darker.

[edit] Options

Lamp Panel
  • Dist: (Distance)
The Dist: field indicates the number of Blender Units (BU) at which the intensity of the current light source will be half of its Intensity. Objects less than the number of BU away from the lamp will get more light, while Objects further away will receive less light. Certain settings and lamp falloff types affect how the Dist: field is interpreted, meaning that it will not always react the same.
  • Energy (0.0 - 10.0)
The Intensity of the light sources illumination.
  • Color
The color of the light sources illumination.
  • Layer
Only objects that are on the same layer as the light are lit by the light.
  • Negative
The light takes away light from the surface, subtracting light and making the surface darker, not lighter.
  • No Diffuse
The light does not brighten the color of the surface.
  • No Specular
The light does not cause a shine on the surface, and is not used in calculating the Material Specular color or highlights on the surface.
  • Sphere
The Sphere option restricts the lamp's illumination range so that it will instantly stop illuminating past an area once it reaches the number of Blender Units away from itself, as specified in the Dist: field.
An imaginary Sphere (with a radius of the Dist: field) is placed around the light source and it's light is blocked from passing through the Sphere walls. So the Dist: field now basically means that any light that is further away form its light source than the value in the Dist: field will be Attenuated to 0 after this point, and won't naturally attenuate but instantly stop.
Screenshot showing the light Attenuation of a Constant Falloff light type with the Sphere option active.
Screenshot showing the light Attenuation of a Constant Falloff light type with the Sphere option Deactivated.
When the Sphere option is active, a dotted Sphere will appear around the light source, indicating the demarcation point at which this lights propagation will cease, example below:
Screenshot of the 3D view window, showing the Sphere light clipping circle.
  • Lamp Falloff
The Lamp Falloff field has been improved in Blender 2.46 so the layout of the Lamp panel is different in a number of ways. One of the changes is the Lamp Falloff drop down menu. The Lamp Falloff types are listed and described below:
  • Lin/Quad Weight
This Lamp Falloff is described in the Blender 2.46 release notes as follows:
"Exactly the same as in older Blenders with the old 'Quad' button enabled. When this setting is chosen, two sliders are shown, 'Linear' and 'Quad' (previously Quad1 and Quad2), which controls the 'linearness' or 'quadraticness' of the falloff curve. Lamps in old files with the 'Quad' button on will be initialised to this setting."
Lamp Panel with Lamp Falloff type Lin/Quad Weighted selected and the Quad and Linear slider also highlighted in yellow also.
So it looks as if the Lin/Quad Weighted Lamp Falloff type is in effect allowing the mixing of the 2 Light Attenuation profiles (Linear Attenuation type and Quadratic Attenuation type).
Here is a screenshot of the Lin/Quad Weighted light with default settings:
Screenshot showing the Lin/Quad Weighted Lamp Falloff type effect with default settings.
  • Linear
This slider/numeric input field, can have a value between 0 and 1. A value of 1 in the Linear field and 0 in the Quad field, in effect means that the light from this source is completely Linear. Meaning that by the number of Blender Units distance specified in the Dist: field, this light sources Intensity will be half the value it was when it reaches the number of Blender Units distance specified in the Dist: field.
In the situation just described the Linear Falloff type is being completely respected, it has the Intensity value it should have (half Intensity) by the time it reaches the distance specified in the Dist: field.
When the Quad slider is set to 0 the formula for working out the Attenuation at a particular range for Linear Attenuation is, in effect:
I = E * (D / (D + Q1 * R))
Where E is the current Energy slider setting.
Where D is the current setting of the Dist: field.
Where Q1 is the current setting of the Linear slider.
Where R is the distance from the lamp where the light Intensity gets measured.
Where I is the calculated Intensity of light.
  • Quad
Quad (Quadratic) Attenuation type lighting is considered a more accurate representation of how light Attenuates, and as such when the Lin/Quad Weighted Lamp Fallout type is selected, Fully Quadratic Attenuation is selected by default (that is the Quad slider field is 1 and the Linear slider field is 0).
This slider/numeric input field, can have a value between 0 and 1. A value of 1 in the Quad field and 0 in the Linear field, in effect means that the light from this source is completely Quadratic (Quad type).
In the situation just described the Quad Falloff type is being completely respected so it has the Intensity value it should have (half intensity) by the time it reaches the distance specified in the Dist: field. After the light has reached the distance in the Dist: field, the light decays much more quickly.
One of the characteristics of Quadratic Light Attenuation is that at first it gradually Attenuates and then at a certain point starts to Attenuate at a much faster rate. The faster rate stage of Attenuation is roughly entered when the distance from the light is more than the value in the Dist: field.
When the Linear slider is set to 0 the formula for working out the attenuation at a particular range for Quadratic attenuation is, in effect:
I = E * (D2 / (D2 + Q2 * R2))
Where E is the current Energy slider setting.
Where D is the current setting of the Dist: field.
Where Q2 is the current setting of the Quad slider.
Where R is the distance from the lamp where the light Intensity gets measured.
Where I is the calculated Intensity of light.
  • Light Attenuation profile when both Linear and Quad sliders have values greater than 0
If both the Linear and Quad slider fields have values greater than 0, then the formula used to calculate the Light Attenuation profile changes to this:
I = E * (D / (D + Q1 * R)) * (D2 / (D2 + Q2 * R2))
Where E is the current Energy slider setting.
Where D is the current setting of the Dist: field.
Where Q1 is the current setting of the Linear slider.
Where Q2 is the current setting of the Quad slider.
Where R is the distance from the lamp where the light Intensity gets measured.
Where I is the calculated Intensity of light.
  • No Light Attenuation when both Linear and Quad sliders have values of 0.
If both the Linear and Quad sliders have 0 as their values. Then their light Intensity will not Attenuate with distance. This does not mean that the light will not get darker, it will, but only because the Energy the light has is spread out over a wider and wider distance. The total amount of Energy in the spread out light will remain the same though. Light angle also affects the amount of light you see. If what you want is a light source that doesn't attenuate and gives the same amount of light Intensity to each area it hits you need a light with properties like the Constant Lamp Falloff type.
Also when the Linear and Quad sliders are both 0 values the Dist: field ceases to have any visible effect on the Light Attenuation.
  • Custom Curve
The Custom Curve Lamp Falloff type became available in Blender 2.46 and is very flexible.
Lamp Panel with Lamp Falloff type Custom Curve selected and highlighted in Yellow. Also shown is the Falloff Curve tab that is created (also highlighted in Yellow) when Custom Curve falloff type is in effect.
Most other Lamp Falloff types work by having their light Intensity start at its maximum (when nearest to the Light source) and then with some predetermined pattern decrease their light Intensity when the Distance from the light source gets further away.
When using the Custom Curve Lamp Falloff type, a new panel is created called "Falloff Curve" shown below:
Falloff Curve panel used to control the amount of Light Attenuation a light has in an arbitrary manner.
This Falloff Curve Profile Graph, allows the user to alter how Intense light is at a particular point along a lights Attenuation Profile.
In the example above (the default for the Falloff Curve Profile Graph), the Graph shows that the Intensity of the light starts off at the maximum Intensity that the light can have (when near the light) and linearly Attenuates the light Intensity as it moves to the right (further away from the light source).
So if the user wanted to have a Light Attenuation Profile that got more Intense as it moved away from the light source, the user could alter the Light Attenuation Profile Graph as needed. Below is an example of a Falloff Curve Profile Graph, showing just such a situation:
Falloff Curve for reversed Attenuation.
Falloff Curve for reversed Attenuation rendered.
You are not just limited to simple changes such as light reversing the Attenuation profile, you can have almost any Attenuation profile you desire.
The Falloff Curve Profile Graph has 2 axis, the Intensity axis and the Distance axis, labelled Intensity and Distance in the pictures shown (although these labels were added to make describing how the Falloff Curve Profile Graph works, easier, they don't appear in Blender).
The Distance axis represents the position at a particular point along a light sources Attenuation path. The far left being at the the position of the light source and the far right being the place where the light sources influence would normally be completely Attenuated. I say normally would because the Falloff Curve can be altered to do the exact opposite if required.
The Intensity axis represents the Intensity at a particular point along a light sources Attenuation path. Higher Intensity is represented by being higher up the Intensity axis while lower Intensity light is represented by being lower down on the Intensity axis.
Here is another example of different Falloff Curve Profile Graph, along with its resultant render output:
Falloff Curve Profile Graph resulting in Oscillating Attenuation pattern in Light.
Render showing the affect of the Falloff Curve Profile Graph on the Attenuation.
Altering the Falloff Curve Profile Graph is easy. Just  LMB Image:Template-LMB.png on a part of the graph you want to alter and drag it where you want it to be. If when you click you are over or near one of the tiny black square handles, it will turn white indicating that this is the handle that is now selected and you will be able to drag it to a new position. If when you click on the graph you are not near a handle, one will be created at the point that you clicked, which you can then drag where you wish.
  • Inverse Square
This Lamp Fallout type Attenuates its Intensity according to inverse square law, scaled by the 'Dist:' value. Inverse square is a sharper, realistic decay, useful for lighting such as desk lamps and street lights. This is similar to the old Quad option with slight changes.
Screenshot showing the Inverse Square Lamp Falloff type effect with default settings.
  • Inverse Linear
This Lamp Fallout type Attenuates its Intensity linearly, scaled by the 'Dist' value. This is the default setting, behaving the same as the default in previous Blender versions without 'Quad' switched on. This isn't physically accurate, but can be easier to light with.
Screenshot showing the Inverse Linear Lamp Falloff type effect with default settings.
  • Constant
This Lamp Fallout type does not Attenuate its Intensity with distance. This is useful for distant light sources like the sun or sky, which are so far away that their falloff isn't noticeable. Sun and Hemi lamps always have constant falloff.
Screenshot showing the Constant Lamp Falloff type effect with default settings.

[edit] Shadow and Spot Panel for Lamp and Sun light sources

When a Lamp or Sun light source are selected the Spot and Shadow Panel has the following default layout:

The Shadow and Spot Panel when Lamp or Sun light sources are selected.

[edit] Options

  • Ray Shadow
The Ray Shadow button enables the Lamp and Sun light sources to generate Ray Traced Shadows.
When the Ray Shadow button is selected, another set of options is made available, those options being:
  • Shadow Sample Generator Type - Constant QMC
The Constant QMC method is used to calculate shadow values in a very uniform, evenly distributed way. This method results in very good calculation of shadow value but it is not as fast as using the Adaptive QMC method, however Constant GMC is more accurate.
  • Shadow Sample Generator Type - Adaptive QMC
The Adaptive QMC method is used to calculate shadow values in a slightly less uniform and distributed way. This method results in good calculation of shadow value but not as good as Constant QMC. The advantage of using Adaptive QMC is that it in general is much quicker while being not much worse than Constant QMC in terms of overall results.
  • Samples
This Numerical slider field set the maximum number of samples that both Constant QMC and Adaptive QMC will use to do their shadow calculations. The maximum number of samples that can be taken is 16. According to the tooltip information that appears when over this field the sample value is squared so setting a sample value of 3 really means 32 samples will be taken.
  • Soft Size
The Soft Size numeric slider, determines the size of the fuzzy/diffuse/penumbra area around the edge of a shadow. Soft Size only determines the width of the soft shadow size not how graduated and smooth the shadow is. If you want a wide shadow which is also soft and finely graduated you must also set the number of Samples in the Samples field higher than 1, otherwise this field has no visible effect and the shadows generated will not have a soft edge. The maximum value for Soft Size is 100 (Blender Units?).
Above is a table of renders with different Soft Size and Sample settings showing the effect of various values on the softness of shadow edges.
Below is an Animated version of the above table of images showing the effects:
You may need to click on the Image to see the Animation.
  • Threshold
The Threshold field is used with the Adaptive GMC shadow calculation method. The value in the Threshold field is used to determine if Adaptive GMC shadow sample calculation can skipped based on a threshold of how shadowed an area is already. The maximum Threshold value is 1.
  • Only Shadow
When the Only Shadow button is selected the light source will not illuminate an object but will generate the shadows that would normally appear.
This feature is often used to control how and where shadows fall by having a light which illuminates but has no shadow, combined with a second light which doesn't illuminate but has Only Shadow enabled, allowing the user to control shadow placement by moving the Shadow Only light around.

[edit] What is Quasi-Monte Carlo?

The Monte Carlo method is a method of taking a series of samples/readings of values (any kind of values, such as light values, color values, reflective states) in or around an area at random, so as to determine the correct actions to take in certain calculations which usually require multiple sample values to determine overall accuracy, of those calculations. The Monte Carlo methods tries to be as random as possible, this can often cause areas that are being sampled to have large irregular gaps in them (places that are not sampled/read), this in turn can cause problems for certain calculations (such as shadow calculation).

The solution to this was the Quasi-Monte Carlo method.

The Quasi-Monte Carlo method is also random, but tries to make sure that the samples/readings it takes are also better distributed (leaving less irregular gaps in its sample areas) and more evenly spread across an area. This has the advantage of sometimes leading to more accurate calculations based on samples/reading.

Note
Everything above this point it an update to reflect the state of things as of Blender 2.46, it could all be wrong or out of date for Blender 2.47, if you want me to change it let me know and I will, or edit it yourself. -- Terrywallwork -- 6th September 2008


[edit] Examples

Render example.
Notice in (Render example) that the light is gradually diminishing for each sphere that is farther away from the light source as compared to the Sun render example where the light's intensity was constant (i.e. never faded with distance).

[edit] Distance

In this example, the Lamp has been set pretty close to the group of planes. This causes the light to affect the front, middle and rear planes more dramatically. Looking at (Various Distance settings) you can see that as the Dist is increased more and more objects are becoming progressively brighter.

Dist: 10
Dist: 100
Dist: 1000
"Various Distance settings", Shadow disabled.

The Dist: parameter is controlling where the light is falling --at a linear rate-- to 1/2 its original value from the light's origin. As you increase or decrease this value you are changing where this 1/2 falloff occurs. You could think of Dist: as the surface of a sphere and the surface is where the light's intensity has fallen to 1/2 its strength, in all directions. Note that the light's intensity continues to fall even after Dist:. Dist: just specifies the distance where 1/2 of the light's energy has weakened.

Notice in (Dist: 1000) that the farthest objects are very bright. This is because the falloff has been extended far into the distance which means the light is very strong when it hits the last few objects. It is not until 1000 units that the light's intensity has fallen to 1/2 its original intensity.

Contrast this with (Dist: 10) where the falloff occurs so soon that the farther objects are barely lit. The light's intensity has fallen by 1/2 by time it even reaches the 10th object.

You may be wondering, why the first few planes appear to be dimmer? This is because the surface angle between the light and the object's surface normal are getting close to oblique. That is the nature of a Lamp light object. By moving the light infinitely far away you would begin to approach the characteristics of the Sun lamp type.

[edit] Quad

Quad makes the light's intensity falloff with a non-linear rate, or specifically, quadratic rate. The characteristic feature of using "Quad" is that the light's intensity begins to fall off very slowly but then starts falling off very rapidly. We can see this in the (Quad enabled) images.

Quad with 10
Quad with 100
Quad with 1000
Quad enabled with the specified distances.

With Quad enabled the "Dist:" field is specifying where the light begins to fall faster, roughly speaking, see Technical Details for more info.

In (Quad with 10) the light's intensity has fallen so quickly that the last few objects aren't even lit.

Both (Quad with 100) and (Quad with 1000) appear to be almost identical and that is because the Distance is set beyond the farthest object's distance which is at ~40 units out. Hence, all the objects get almost the full intensity of the light.

As with Dist the first few objects are dimmer than farther objects because they are very close to the light. Remember, the brightness of an object's surface is also based on the angle between the surface normal of an object and the ray of light coming from the lamp.

This means there are at least two things that are controlling the surface's brightness: intensity and the angle between the light source and the surface's normal.

[edit] Sphere

Clipping Sphere
Sphere controls where the light's intensity is clipped/clamped off. All light rays stop at the surface of the sphere regardless of the light's falloff. In (Clipping Sphere) you can see a side view example of the setup with Sphere enabled and a distance of 10.

Any objects beyond the sphere receive no light from the lamp.

The Dist: field is now specifying both where the light's rays stop and the intensity's ratio falloff setting. The only difference is that now light abruptly stops at sphere's surface regardless of the light's intensity.


Sphere with 10
Sphere with 20
Sphere with 40
Sphere enabled with the specified distances, Quad disabled.

In (Sphere with 10) the clipping sphere's radius is 10 units which means the light's intensity is also being controlled by 10 units of distance. With Quad disabled the light's intensity has fallen very low even before it gets to the first object.

In (Sphere with 20) the clipping sphere's radius is now 20 units and some light is reaching the middle objects, but no light is going beyond the clipping sphere even if the light still has energy left.

In (Sphere with 40) the clipping sphere's radius is now 40 units which is beyond the last object. However, the light doesn't make it to the last few objects because the intensity has fallen to 0. The light's intensity has faded before it was clipped by the sphere.

[edit] Hints

If the Lamp light is set to not cast shadows it illuminates through walls and the like. If you want to achieve some nice effects like a fire, or a candle-lit room interior seen from outside a window, the Sphere option is a must. By carefully working on the Distance value you can make your warm firelight shed only within the room, while illuminating outside with a cool moonlight, the latter achieved with a Sun or Hemi light or both.

[edit] Technical Details

The effect of the Distance parameter is very evident, while the effect of the Quad button is more subtle. In any case the absence of shadows is still a major issue. As a matter of fact only the first plane should be lit, because all the others should fall in the shadow of the first.

For the Math enthusiasts, and for those desiring deeper insight, the laws governing the decay are the following. Let D be the value of the Distance Numeric Button, E the value of the Energy slider and r the distance from the Lamp to the point where the light intensity I is to be computed.

If Quad and Sphere buttons are off:

I = E x (D / (D + r))

It is evident what affirmed before: That the light intensity equals half the energy for r = D.

If Quad Button is on:

I = E x (D / (D + Q1 r)) x (D2 / (D2 + Q2 r2))

This is a little more complex and depends from the Quad1 (Q1) and Quad2 (Q2) slider values. Nevertheless it is apparent how the decay is fully linear for

Q1 = 1, Q2 = 0

and fully quadratic for

Q1 = 0, Q2 = 1

this latter being the default. Interestingly enough if

Q1 = Q2 = 0

then light intensity does not decay at all. If the Sphere button is on the above computed light intensity I is further modified by multiplication by the term which has a linear progression for r from 0 to D and is identically 0 otherwise.

If the Quad button is off and the Sphere button is on:

Is = E x (D / (D + r)) x ((D - r) / D) if r < D; 0 otherwise

If both Quad and Sphere buttons are on:

Is = E x (D / (D + Q1 r)) x (D2 / (D2 + Q2 r2)) x ((D - r) / D) if r < D; 0 otherwise

Might be helpful in understanding these behaviours graphically.

Light decays: a) Blender default linear; b) Blender default quadratic with Quad1=0, Quad2=1; c) Blender quadratic with Quad1=Quad2=0.5; d) Blender quadratic with Quad1=Quad2=0. Also shown in the graph the same curves, in the same colours, but with the Sphere button turned on.

[edit] See Also

Place related links here.





Redirects to fix

  • Manual/Lamp Types → Doc:Manual/Lighting/Lamp Types
  • Manual/Spot Lamp → Doc:Manual/Spot Lamp
  • Manual/Sun Lamp → Doc:Manual/Lighting/Lamp Types/Sun
  • Release Notes/Notes246/Misc → Dev:Ref/Release Notes/2.46/Misc