Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

vtkLightKit Class Reference

#include <vtkLightKit.h>

Inheritance diagram for vtkLightKit:

Inheritance graph
[legend]
Collaboration diagram for vtkLightKit:

Collaboration graph
[legend]
List of all members.

Detailed Description

a simple but quality lighting kit

Date:
2002/12/13 21:10:10
Revision:
1.11

vtkLightKit is designed to make general purpose lighting of vtk scenes simple, flexible, and attractive (or at least not horribly ugly without significant effort). Use a LightKit when you want more control over your lighting than you can get with the default vtk light, which is a headlight located at the camera. (Headlights are very simple to use, but they don't show the shape of objects very well, don't give a good sense of "up" and "down", and don't evenly light the object.)

A LightKit consists of three lights, a key light, a fill light, and a headlight. The main light is the key light. It is usually positioned so that it appears like an overhead light (like the sun, or a ceiling light). It is generally positioned to shine down on the scene from about a 45 degree angle vertically and at least a little offset side to side. The key light usually at least about twice as bright as the total of all other lights in the scene to provide good modeling of object features.

The other lights in the kit (the fill light, headlight, and a pair of back lights) are weaker sources that provide extra illumination to fill in the spots that the key light misses. The fill light is usually positioned across from or opposite from the key light (though still on the same side of the object as the camera) in order to simulate diffuse reflections from other objects in the scene. The headlight, always located at the position of the camera, reduces the contrast between areas lit by the key and fill light. The two back lights, one on the left of the object as seen from the observer and one on the right, fill on the high-contrast areas behind the object. To enforce the relationship between the different lights, the intensity of the fill, back and headlights are set as a ratio to the key light brightness. Thus, the brightness of all the lights in the scene can be changed by changing the key light intensity.

All lights are directional lights (infinitely far away with no falloff). Lights move with the camera.

For simplicity, the position of lights in the LightKit can only be specified using angles: the elevation (latitude) and azimuth (longitude) of each light with respect to the camera, expressed in degrees. (Lights always shine on the camera's lookat point.) For example, a light at (elevation=0, azimuth=0) is located at the camera (a headlight). A light at (elevation=90, azimuth=0) is above the lookat point, shining down. Negative azimuth values move the lights clockwise as seen above, positive values counter-clockwise. So, a light at (elevation=45, azimuth=-20) is above and in front of the object and shining slightly from the left side.

vtkLightKit limits the colors that can be assigned to any light to those of incandescent sources such as light bulbs and sunlight. It defines a special color spectrum called "warmth" from which light colors can be chosen, where 0 is cold blue, 0.5 is neutral white, and 1 is deep sunset red. Colors close to 0.5 are "cool whites" and "warm whites," respectively.

Since colors far from white on the warmth scale appear less bright, key-to-fill and key-to-headlight ratios are skewed by key, fill, and headlight colors. If the flag MaintainLuminance is set, vtkLightKit will attempt to compensate for these perceptual differences by increasing the brightness of more saturated colors.

A LightKit is not explicitly part of the vtk pipeline. Rather, it is a composite object that controls the behavior of lights using a unified user interface. Every time a parameter of vtkLightKit is adjusted, the properties of its lights are modified.

Credits:
vtkLightKit was originally written and contributed to vtk by Michael Halle (mhalle@bwh.harvard.edu) at the Surgical Planning Lab, Brigham and Women's Hospital.
Created by:
  • Halle, Michael
CVS contributions (if > 5%):
  • Halle, Michael (92%)
CVS logs (CVSweb):
  • .h (/Rendering/vtkLightKit.h)
  • .cxx (/Rendering/vtkLightKit.cxx)
Examples:
vtkLightKit (Examples)

Definition at line 116 of file vtkLightKit.h.

Public Types

typedef vtkObject Superclass

Public Methods

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
virtual void SetFillLightWarmth (float)
virtual float GetFillLightWarmth ()
virtual void SetHeadlightWarmth (float)
virtual float GetHeadlightWarmth ()
virtual void SetBackLightWarmth (float)
virtual float GetBackLightWarmth ()
void SetKeyLightElevation (float x)
void SetKeyLightAzimuth (float x)
virtual float * GetKeyLightAngle ()
virtual void GetKeyLightAngle (float data[2])
float GetKeyLightElevation ()
float GetKeyLightAzimuth ()
void SetFillLightAngle (float elevation, float azimuth)
void SetFillLightAngle (float angle[2])
void SetFillLightElevation (float x)
void SetFillLightAzimuth (float x)
virtual float * GetFillLightAngle ()
virtual void GetFillLightAngle (float data[2])
float GetFillLightElevation ()
float GetFillLightAzimuth ()
void SetBackLightAngle (float elevation, float azimuth)
void SetBackLightAngle (float angle[2])
void SetBackLightElevation (float x)
void SetBackLightAzimuth (float x)
virtual float * GetBackLightAngle ()
virtual void GetBackLightAngle (float data[2])
float GetBackLightElevation ()
float GetBackLightAzimuth ()
void DeepCopy (vtkLightKit *kit)
void Modified ()
void Update ()
virtual void SetKeyLightIntensity (float)
virtual float GetKeyLightIntensity ()
virtual void SetKeyToFillRatio (float)
virtual float GetKeyToFillRatio ()
virtual void SetKeyToHeadRatio (float)
virtual float GetKeyToHeadRatio ()
virtual void SetKeyToBackRatio (float)
virtual float GetKeyToBackRatio ()
virtual void SetKeyLightWarmth (float)
virtual float GetKeyLightWarmth ()
virtual float * GetKeyLightColor ()
virtual void GetKeyLightColor (float data[3])
virtual float * GetFillLightColor ()
virtual void GetFillLightColor (float data[3])
virtual float * GetHeadlightColor ()
virtual void GetHeadlightColor (float data[3])
virtual float * GetBackLightColor ()
virtual void GetBackLightColor (float data[3])
virtual void MaintainLuminanceOn ()
virtual void MaintainLuminanceOff ()
virtual int GetMaintainLuminance ()
virtual void SetMaintainLuminance (int)
void SetKeyLightAngle (float elevation, float azimuth)
void SetKeyLightAngle (float angle[2])
void AddLightsToRenderer (vtkRenderer *renderer)
void RemoveLightsFromRenderer (vtkRenderer *renderer)

Static Public Methods

vtkLightKit * New ()
int IsTypeOf (const char *type)
vtkLightKit * SafeDownCast (vtkObject *o)

Protected Methods

 vtkLightKit ()
 ~vtkLightKit ()
void WarmthToRGBI (float w, float rgb[3], float &i)
void WarmthToRGB (float w, float rgb[3])
void InitializeWarmthFunctions ()
float WarmthToIntensity (float w)

Protected Attributes

float KeyLightIntensity
float KeyToFillRatio
float KeyToHeadRatio
float KeyToBackRatio
vtkLightKeyLight
float KeyLightWarmth
float KeyLightAngle [2]
float KeyLightColor [3]
vtkLightFillLight
float FillLightWarmth
float FillLightAngle [2]
float FillLightColor [3]
float BackLightWarmth
float BackLightColor [3]
vtkLightBackLight0
vtkLightBackLight1
float BackLightAngle [2]
vtkLightHeadlight
float HeadlightWarmth
float HeadlightColor [3]
int MaintainLuminance
vtkPiecewiseFunctionWarmthFunction [4]


Member Typedef Documentation

typedef vtkObject vtkLightKit::Superclass
 

Reimplemented from vtkObject.

Definition at line 120 of file vtkLightKit.h.


Constructor & Destructor Documentation

vtkLightKit::vtkLightKit   [protected]
 

vtkLightKit::~vtkLightKit   [protected]
 


Member Function Documentation

vtkLightKit* vtkLightKit::New   [static]
 

Create an object with Debug turned off, modified time initialized to zero, and reference counting on.

Reimplemented from vtkObject.

virtual const char* vtkLightKit::GetClassName   [virtual]
 

Reimplemented from vtkObject.

int vtkLightKit::IsTypeOf const char *    type [static]
 

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

virtual int vtkLightKit::IsA const char *    type [virtual]
 

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

vtkLightKit* vtkLightKit::SafeDownCast vtkObject   o [static]
 

Reimplemented from vtkObject.

void vtkLightKit::PrintSelf ostream &    os,
vtkIndent    indent
[virtual]
 

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

virtual void vtkLightKit::SetKeyLightIntensity float    [virtual]
 

Set/Get the intensity of the key light. The key light is the brightest light in the scene. The intensities of the other two lights are ratios of the key light's intensity.

virtual float vtkLightKit::GetKeyLightIntensity   [virtual]
 

Set/Get the intensity of the key light. The key light is the brightest light in the scene. The intensities of the other two lights are ratios of the key light's intensity.

virtual void vtkLightKit::SetKeyToFillRatio float    [virtual]
 

Set/Get the key-to-fill ratio. This ratio controls how bright the fill light is compared to the key light: larger values correspond to a dimmer fill light. The purpose of the fill light is to light parts of the object not lit by the key light, while still maintaining constrast. This type of lighting may correspond to indirect illumination from the key light, bounced off a wall, floor, or other object. The fill light should never be brighter than the key light: a good range for the key-to-fill ratio is between 2 and 10.

virtual float vtkLightKit::GetKeyToFillRatio   [virtual]
 

Set/Get the key-to-fill ratio. This ratio controls how bright the fill light is compared to the key light: larger values correspond to a dimmer fill light. The purpose of the fill light is to light parts of the object not lit by the key light, while still maintaining constrast. This type of lighting may correspond to indirect illumination from the key light, bounced off a wall, floor, or other object. The fill light should never be brighter than the key light: a good range for the key-to-fill ratio is between 2 and 10.

virtual void vtkLightKit::SetKeyToHeadRatio float    [virtual]
 

Set/Get the key-to-headlight ratio. Similar to the key-to-fill ratio, this ratio controls how bright the headlight light is compared to the key light: larger values correspond to a dimmer headlight light. The headlight is special kind of fill light, lighting only the parts of the object that the camera can see. As such, a headlight tends to reduce the contrast of a scene. It can be used to fill in "shadows" of the object missed by the key and fill lights. The headlight should always be significantly dimmer than the key light: ratios of 2 to 15 are typical.

virtual float vtkLightKit::GetKeyToHeadRatio   [virtual]
 

Set/Get the key-to-headlight ratio. Similar to the key-to-fill ratio, this ratio controls how bright the headlight light is compared to the key light: larger values correspond to a dimmer headlight light. The headlight is special kind of fill light, lighting only the parts of the object that the camera can see. As such, a headlight tends to reduce the contrast of a scene. It can be used to fill in "shadows" of the object missed by the key and fill lights. The headlight should always be significantly dimmer than the key light: ratios of 2 to 15 are typical.

virtual void vtkLightKit::SetKeyToBackRatio float    [virtual]
 

Set/Get the key-to-back light ratio. This ratio controls how bright the back lights are compared to the key light: larger values correspond to dimmer back lights. The back lights fill in the remaining high-contrast regions behind the object. Values between 2 and 10 are good.

virtual float vtkLightKit::GetKeyToBackRatio   [virtual]
 

Set/Get the key-to-back light ratio. This ratio controls how bright the back lights are compared to the key light: larger values correspond to dimmer back lights. The back lights fill in the remaining high-contrast regions behind the object. Values between 2 and 10 are good.

virtual void vtkLightKit::SetKeyLightWarmth float    [virtual]
 

Set the warmth of each the lights. Warmth is a parameter that varies from 0 to 1, where 0 is "cold" (looks icy or lit by a very blue sky), 1 is "warm" (the red of a very red sunset, or the embers of a campfire), and 0.5 is a neutral white. The warmth scale is non-linear. Warmth values close to 0.5 are subtly "warmer" or "cooler," much like a warmer tungsten incandescent bulb, a cooler halogen, or daylight (cooler still). Moving further away from 0.5, colors become more quickly varying towards blues and reds. With regards to aesthetics, extremes of warmth should be used sparingly.

virtual float vtkLightKit::GetKeyLightWarmth   [virtual]
 

Set the warmth of each the lights. Warmth is a parameter that varies from 0 to 1, where 0 is "cold" (looks icy or lit by a very blue sky), 1 is "warm" (the red of a very red sunset, or the embers of a campfire), and 0.5 is a neutral white. The warmth scale is non-linear. Warmth values close to 0.5 are subtly "warmer" or "cooler," much like a warmer tungsten incandescent bulb, a cooler halogen, or daylight (cooler still). Moving further away from 0.5, colors become more quickly varying towards blues and reds. With regards to aesthetics, extremes of warmth should be used sparingly.

virtual void vtkLightKit::SetFillLightWarmth float    [virtual]
 

virtual float vtkLightKit::GetFillLightWarmth   [virtual]
 

virtual void vtkLightKit::SetHeadlightWarmth float    [virtual]
 

virtual float vtkLightKit::GetHeadlightWarmth   [virtual]
 

virtual void vtkLightKit::SetBackLightWarmth float    [virtual]
 

virtual float vtkLightKit::GetBackLightWarmth   [virtual]
 

virtual float* vtkLightKit::GetKeyLightColor   [virtual]
 

Returns the floating-point RGB values of each of the light's color.

virtual void vtkLightKit::GetKeyLightColor float    data[3] [virtual]
 

Returns the floating-point RGB values of each of the light's color.

virtual float* vtkLightKit::GetFillLightColor   [virtual]
 

Returns the floating-point RGB values of each of the light's color.

virtual void vtkLightKit::GetFillLightColor float    data[3] [virtual]
 

Returns the floating-point RGB values of each of the light's color.

virtual float* vtkLightKit::GetHeadlightColor   [virtual]
 

Returns the floating-point RGB values of each of the light's color.

virtual void vtkLightKit::GetHeadlightColor float    data[3] [virtual]
 

Returns the floating-point RGB values of each of the light's color.

virtual float* vtkLightKit::GetBackLightColor   [virtual]
 

Returns the floating-point RGB values of each of the light's color.

virtual void vtkLightKit::GetBackLightColor float    data[3] [virtual]
 

Returns the floating-point RGB values of each of the light's color.

virtual void vtkLightKit::MaintainLuminanceOn   [virtual]
 

If MaintainLuminance is set, the LightKit will attempt to maintain the apparent intensity of lights based on their perceptual brightnesses. By default, MaintainLuminance is off.

virtual void vtkLightKit::MaintainLuminanceOff   [virtual]
 

If MaintainLuminance is set, the LightKit will attempt to maintain the apparent intensity of lights based on their perceptual brightnesses. By default, MaintainLuminance is off.

virtual int vtkLightKit::GetMaintainLuminance   [virtual]
 

If MaintainLuminance is set, the LightKit will attempt to maintain the apparent intensity of lights based on their perceptual brightnesses. By default, MaintainLuminance is off.

virtual void vtkLightKit::SetMaintainLuminance int    [virtual]
 

If MaintainLuminance is set, the LightKit will attempt to maintain the apparent intensity of lights based on their perceptual brightnesses. By default, MaintainLuminance is off.

void vtkLightKit::SetKeyLightAngle float    elevation,
float    azimuth
 

Get/Set the position of the key, fill, and back lights using angular methods. Elevation corresponds to latitude, azimuth to longitude. It is recommended that the key light always be on the viewer's side of the object and above the object, while the fill light generally lights the part of the object not lit by the fill light. The headlight, which is always located at the viewer, can then be used to reduce the contrast in the image. There are a pair of back lights. They are located at the same elevation and at opposing azimuths (ie, one to the left, and one to the right). They are generally set at the equator (elevation = 0), and at approximately 120 degrees (lighting from each side and behind).

void vtkLightKit::SetKeyLightAngle float    angle[2] [inline]
 

Get/Set the position of the key, fill, and back lights using angular methods. Elevation corresponds to latitude, azimuth to longitude. It is recommended that the key light always be on the viewer's side of the object and above the object, while the fill light generally lights the part of the object not lit by the fill light. The headlight, which is always located at the viewer, can then be used to reduce the contrast in the image. There are a pair of back lights. They are located at the same elevation and at opposing azimuths (ie, one to the left, and one to the right). They are generally set at the equator (elevation = 0), and at approximately 120 degrees (lighting from each side and behind).

Definition at line 221 of file vtkLightKit.h.

void vtkLightKit::SetKeyLightElevation float    x [inline]
 

Definition at line 225 of file vtkLightKit.h.

void vtkLightKit::SetKeyLightAzimuth float    x [inline]
 

Definition at line 228 of file vtkLightKit.h.

virtual float* vtkLightKit::GetKeyLightAngle   [virtual]
 

virtual void vtkLightKit::GetKeyLightAngle float    data[2] [virtual]
 

float vtkLightKit::GetKeyLightElevation   [inline]
 

Definition at line 232 of file vtkLightKit.h.

float vtkLightKit::GetKeyLightAzimuth   [inline]
 

Definition at line 235 of file vtkLightKit.h.

void vtkLightKit::SetFillLightAngle float    elevation,
float    azimuth
 

void vtkLightKit::SetFillLightAngle float    angle[2] [inline]
 

Definition at line 239 of file vtkLightKit.h.

void vtkLightKit::SetFillLightElevation float    x [inline]
 

Definition at line 242 of file vtkLightKit.h.

void vtkLightKit::SetFillLightAzimuth float    x [inline]
 

Definition at line 245 of file vtkLightKit.h.

virtual float* vtkLightKit::GetFillLightAngle   [virtual]
 

virtual void vtkLightKit::GetFillLightAngle float    data[2] [virtual]
 

float vtkLightKit::GetFillLightElevation   [inline]
 

Definition at line 249 of file vtkLightKit.h.

float vtkLightKit::GetFillLightAzimuth   [inline]
 

Definition at line 252 of file vtkLightKit.h.

void vtkLightKit::SetBackLightAngle float    elevation,
float    azimuth
 

void vtkLightKit::SetBackLightAngle float    angle[2] [inline]
 

Definition at line 256 of file vtkLightKit.h.

void vtkLightKit::SetBackLightElevation float    x [inline]
 

Definition at line 259 of file vtkLightKit.h.

void vtkLightKit::SetBackLightAzimuth float    x [inline]
 

Definition at line 262 of file vtkLightKit.h.

virtual float* vtkLightKit::GetBackLightAngle   [virtual]
 

virtual void vtkLightKit::GetBackLightAngle float    data[2] [virtual]
 

float vtkLightKit::GetBackLightElevation   [inline]
 

Definition at line 266 of file vtkLightKit.h.

float vtkLightKit::GetBackLightAzimuth   [inline]
 

Definition at line 269 of file vtkLightKit.h.

void vtkLightKit::AddLightsToRenderer vtkRenderer   renderer
 

Add lights to, or remove lights from, a renderer. Lights may be added to more than one renderer, if desired.

void vtkLightKit::RemoveLightsFromRenderer vtkRenderer   renderer
 

Add lights to, or remove lights from, a renderer. Lights may be added to more than one renderer, if desired.

void vtkLightKit::DeepCopy vtkLightKit *    kit
 

void vtkLightKit::Modified   [virtual]
 

Update the modification time for this object. Many filters rely on the modification time to determine if they need to recompute their data. The modification time is a unique monotonically increasing unsigned long integer.

Reimplemented from vtkObject.

void vtkLightKit::Update  
 

void vtkLightKit::WarmthToRGBI float    w,
float    rgb[3],
float &    i
[protected]
 

void vtkLightKit::WarmthToRGB float    w,
float    rgb[3]
[protected]
 

void vtkLightKit::InitializeWarmthFunctions   [protected]
 

float vtkLightKit::WarmthToIntensity float    w [protected]
 


Member Data Documentation

float vtkLightKit::KeyLightIntensity [protected]
 

Definition at line 294 of file vtkLightKit.h.

float vtkLightKit::KeyToFillRatio [protected]
 

Definition at line 295 of file vtkLightKit.h.

float vtkLightKit::KeyToHeadRatio [protected]
 

Definition at line 296 of file vtkLightKit.h.

float vtkLightKit::KeyToBackRatio [protected]
 

Definition at line 297 of file vtkLightKit.h.

vtkLight* vtkLightKit::KeyLight [protected]
 

Definition at line 299 of file vtkLightKit.h.

float vtkLightKit::KeyLightWarmth [protected]
 

Definition at line 300 of file vtkLightKit.h.

float vtkLightKit::KeyLightAngle[2] [protected]
 

Definition at line 301 of file vtkLightKit.h.

float vtkLightKit::KeyLightColor[3] [protected]
 

Definition at line 302 of file vtkLightKit.h.

vtkLight* vtkLightKit::FillLight [protected]
 

Definition at line 304 of file vtkLightKit.h.

float vtkLightKit::FillLightWarmth [protected]
 

Definition at line 305 of file vtkLightKit.h.

float vtkLightKit::FillLightAngle[2] [protected]
 

Definition at line 306 of file vtkLightKit.h.

float vtkLightKit::FillLightColor[3] [protected]
 

Definition at line 307 of file vtkLightKit.h.

float vtkLightKit::BackLightWarmth [protected]
 

Definition at line 309 of file vtkLightKit.h.

float vtkLightKit::BackLightColor[3] [protected]
 

Definition at line 310 of file vtkLightKit.h.

vtkLight* vtkLightKit::BackLight0 [protected]
 

Definition at line 312 of file vtkLightKit.h.

vtkLight* vtkLightKit::BackLight1 [protected]
 

Definition at line 313 of file vtkLightKit.h.

float vtkLightKit::BackLightAngle[2] [protected]
 

Definition at line 315 of file vtkLightKit.h.

vtkLight* vtkLightKit::Headlight [protected]
 

Definition at line 317 of file vtkLightKit.h.

float vtkLightKit::HeadlightWarmth [protected]
 

Definition at line 318 of file vtkLightKit.h.

float vtkLightKit::HeadlightColor[3] [protected]
 

Definition at line 319 of file vtkLightKit.h.

int vtkLightKit::MaintainLuminance [protected]
 

Definition at line 321 of file vtkLightKit.h.

vtkPiecewiseFunction* vtkLightKit::WarmthFunction[4] [protected]
 

Definition at line 323 of file vtkLightKit.h.


The documentation for this class was generated from the following file: