VTK
|
a simple but quality lighting kit More...
#include <vtkLightKit.h>
Public Types | |
enum | LightKitType { TKeyLight, TFillLight, TBackLight, THeadLight } |
enum | LightKitSubType { Warmth, Intensity, Elevation, Azimuth, KFRatio, KBRatio, KHRatio } |
typedef vtkObject | Superclass |
Public Types inherited from vtkObject | |
typedef vtkObjectBase | Superclass |
Public Member Functions | |
virtual int | IsA (const char *type) |
vtkLightKit * | NewInstance () const |
void | PrintSelf (ostream &os, vtkIndent indent) |
virtual void | SetFillLightWarmth (double) |
virtual double | GetFillLightWarmth () |
virtual void | SetHeadLightWarmth (double) |
virtual double | GetHeadLightWarmth () |
virtual void | SetBackLightWarmth (double) |
virtual double | GetBackLightWarmth () |
void | SetKeyLightElevation (double x) |
void | SetKeyLightAzimuth (double x) |
virtual double * | GetKeyLightAngle () |
virtual void | GetKeyLightAngle (double data[2]) |
double | GetKeyLightElevation () |
double | GetKeyLightAzimuth () |
void | SetFillLightAngle (double elevation, double azimuth) |
void | SetFillLightAngle (double angle[2]) |
void | SetFillLightElevation (double x) |
void | SetFillLightAzimuth (double x) |
virtual double * | GetFillLightAngle () |
virtual void | GetFillLightAngle (double data[2]) |
double | GetFillLightElevation () |
double | GetFillLightAzimuth () |
void | SetBackLightAngle (double elevation, double azimuth) |
void | SetBackLightAngle (double angle[2]) |
void | SetBackLightElevation (double x) |
void | SetBackLightAzimuth (double x) |
virtual double * | GetBackLightAngle () |
virtual void | GetBackLightAngle (double data[2]) |
double | GetBackLightElevation () |
double | GetBackLightAzimuth () |
void | DeepCopy (vtkLightKit *kit) |
void | Modified () |
void | Update () |
virtual void | SetKeyLightIntensity (double) |
virtual double | GetKeyLightIntensity () |
virtual void | SetKeyToFillRatio (double) |
virtual double | GetKeyToFillRatio () |
virtual void | SetKeyToHeadRatio (double) |
virtual double | GetKeyToHeadRatio () |
virtual void | SetKeyToBackRatio (double) |
virtual double | GetKeyToBackRatio () |
virtual void | SetKeyLightWarmth (double) |
virtual double | GetKeyLightWarmth () |
virtual double * | GetKeyLightColor () |
virtual void | GetKeyLightColor (double data[3]) |
virtual double * | GetFillLightColor () |
virtual void | GetFillLightColor (double data[3]) |
virtual double * | GetHeadLightColor () |
virtual void | GetHeadLightColor (double data[3]) |
virtual double * | GetBackLightColor () |
virtual void | GetBackLightColor (double data[3]) |
virtual void | MaintainLuminanceOn () |
virtual void | MaintainLuminanceOff () |
virtual int | GetMaintainLuminance () |
virtual void | SetMaintainLuminance (int) |
void | SetKeyLightAngle (double elevation, double azimuth) |
void | SetKeyLightAngle (double angle[2]) |
void | AddLightsToRenderer (vtkRenderer *renderer) |
void | RemoveLightsFromRenderer (vtkRenderer *renderer) |
Public Member Functions inherited from vtkObject | |
vtkObject * | NewInstance () const |
virtual void | DebugOn () |
virtual void | DebugOff () |
bool | GetDebug () |
void | SetDebug (bool debugFlag) |
virtual unsigned long | GetMTime () |
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
vtkCommand * | GetCommand (unsigned long tag) |
void | RemoveObserver (vtkCommand *) |
void | RemoveObservers (unsigned long event, vtkCommand *) |
void | RemoveObservers (const char *event, vtkCommand *) |
int | HasObserver (unsigned long event, vtkCommand *) |
int | HasObserver (const char *event, vtkCommand *) |
void | RemoveObserver (unsigned long tag) |
void | RemoveObservers (unsigned long event) |
void | RemoveObservers (const char *event) |
void | RemoveAllObservers () |
int | HasObserver (unsigned long event) |
int | HasObserver (const char *event) |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
int | InvokeEvent (unsigned long event, void *callData) |
int | InvokeEvent (const char *event, void *callData) |
int | InvokeEvent (unsigned long event) |
int | InvokeEvent (const char *event) |
Public Member Functions inherited from vtkObjectBase | |
const char * | GetClassName () const |
virtual void | Delete () |
virtual void | FastDelete () |
void | Print (ostream &os) |
virtual void | Register (vtkObjectBase *o) |
virtual void | UnRegister (vtkObjectBase *o) |
void | SetReferenceCount (int) |
void | PrintRevisions (ostream &) |
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
int | GetReferenceCount () |
Static Public Member Functions | |
static vtkLightKit * | New () |
static int | IsTypeOf (const char *type) |
static vtkLightKit * | SafeDownCast (vtkObjectBase *o) |
static const char * | GetStringFromType (int type) |
static const char * | GetStringFromSubType (int type) |
static const char * | GetShortStringFromSubType (int subtype) |
static LightKitSubType | GetSubType (LightKitType type, int i) |
Static Public Member Functions inherited from vtkObject | |
static int | IsTypeOf (const char *type) |
static vtkObject * | SafeDownCast (vtkObjectBase *o) |
static vtkObject * | New () |
static void | BreakOnError () |
static void | SetGlobalWarningDisplay (int val) |
static void | GlobalWarningDisplayOn () |
static void | GlobalWarningDisplayOff () |
static int | GetGlobalWarningDisplay () |
Static Public Member Functions inherited from vtkObjectBase | |
static int | IsTypeOf (const char *name) |
static vtkObjectBase * | New () |
Protected Member Functions | |
virtual vtkObjectBase * | NewInstanceInternal () const |
vtkLightKit () | |
~vtkLightKit () | |
void | WarmthToRGBI (double w, double rgb[3], double &i) |
void | WarmthToRGB (double w, double rgb[3]) |
void | InitializeWarmthFunctions () |
double | WarmthToIntensity (double w) |
Protected Member Functions inherited from vtkObject | |
vtkObject () | |
virtual | ~vtkObject () |
virtual void | RegisterInternal (vtkObjectBase *, int check) |
virtual void | UnRegisterInternal (vtkObjectBase *, int check) |
void | InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL) |
void | InternalReleaseFocus () |
Protected Member Functions inherited from vtkObjectBase | |
vtkObjectBase () | |
virtual | ~vtkObjectBase () |
virtual void | CollectRevisions (ostream &) |
virtual void | ReportReferences (vtkGarbageCollector *) |
vtkObjectBase (const vtkObjectBase &) | |
void | operator= (const vtkObjectBase &) |
Protected Attributes | |
double | KeyLightIntensity |
double | KeyToFillRatio |
double | KeyToHeadRatio |
double | KeyToBackRatio |
vtkLight * | KeyLight |
double | KeyLightWarmth |
double | KeyLightAngle [2] |
double | KeyLightColor [3] |
vtkLight * | FillLight |
double | FillLightWarmth |
double | FillLightAngle [2] |
double | FillLightColor [3] |
double | BackLightWarmth |
double | BackLightColor [3] |
vtkLight * | BackLight0 |
vtkLight * | BackLight1 |
double | BackLightAngle [2] |
vtkLight * | HeadLight |
double | HeadLightWarmth |
double | HeadLightColor [3] |
int | MaintainLuminance |
vtkPiecewiseFunction * | WarmthFunction [4] |
Protected Attributes inherited from vtkObject | |
bool | Debug |
vtkTimeStamp | MTime |
vtkSubjectHelper * | SubjectHelper |
Protected Attributes inherited from vtkObjectBase | |
vtkAtomicInt32 | ReferenceCount |
vtkWeakPointerBase ** | WeakPointers |
a simple but quality lighting kit
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.
Definition at line 107 of file vtkLightKit.h.
typedef vtkObject vtkLightKit::Superclass |
Definition at line 111 of file vtkLightKit.h.
Enumerator | |
---|---|
TKeyLight | |
TFillLight | |
TBackLight | |
THeadLight |
Definition at line 115 of file vtkLightKit.h.
Enumerator | |
---|---|
Warmth | |
Intensity | |
Elevation | |
Azimuth | |
KFRatio | |
KBRatio | |
KHRatio |
Definition at line 122 of file vtkLightKit.h.
|
protected |
|
protected |
|
static |
|
static |
|
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 vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
|
static |
|
protectedvirtual |
Reimplemented from vtkObject.
vtkLightKit* vtkLightKit::NewInstance | ( | ) | const |
|
virtual |
|
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Returns the floating-point RGB values of each of the light's color.
|
virtual |
Returns the floating-point RGB values of each of the light's color.
|
virtual |
Returns the floating-point RGB values of each of the light's color.
|
virtual |
Returns the floating-point RGB values of each of the light's color.
|
virtual |
Returns the floating-point RGB values of each of the light's color.
|
virtual |
Returns the floating-point RGB values of each of the light's color.
|
virtual |
Returns the floating-point RGB values of each of the light's color.
|
virtual |
Returns the floating-point RGB values of each of the light's color.
|
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 |
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 |
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 |
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.
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).
|
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 232 of file vtkLightKit.h.
|
inline |
Definition at line 236 of file vtkLightKit.h.
|
inline |
Definition at line 239 of file vtkLightKit.h.
|
virtual |
|
virtual |
|
inline |
Definition at line 243 of file vtkLightKit.h.
|
inline |
Definition at line 246 of file vtkLightKit.h.
|
inline |
Definition at line 250 of file vtkLightKit.h.
|
inline |
Definition at line 253 of file vtkLightKit.h.
|
inline |
Definition at line 256 of file vtkLightKit.h.
|
virtual |
|
virtual |
|
inline |
Definition at line 260 of file vtkLightKit.h.
|
inline |
Definition at line 263 of file vtkLightKit.h.
|
inline |
Definition at line 267 of file vtkLightKit.h.
|
inline |
Definition at line 270 of file vtkLightKit.h.
|
inline |
Definition at line 273 of file vtkLightKit.h.
|
virtual |
|
virtual |
|
inline |
Definition at line 277 of file vtkLightKit.h.
|
inline |
Definition at line 280 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 | ) |
|
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 | ( | ) |
|
static |
Helper method to go from a enum type to a string type
|
static |
Helper method to go from a enum subtype to a string subtype
|
static |
Helper method to go from a enum subtype to a string subtype The difference from GetStringFromSubType is that it returns a shorter strings (useful for GUI with minimun space)
|
static |
Return the possible subtype from a given type. You have to pass in a number i [0,3] no check is done.
|
protected |
|
protected |
Definition at line 320 of file vtkLightKit.h.
|
protected |
Definition at line 321 of file vtkLightKit.h.
|
protected |
Definition at line 322 of file vtkLightKit.h.
|
protected |
Definition at line 323 of file vtkLightKit.h.
|
protected |
Definition at line 325 of file vtkLightKit.h.
|
protected |
Definition at line 326 of file vtkLightKit.h.
|
protected |
Definition at line 327 of file vtkLightKit.h.
|
protected |
Definition at line 328 of file vtkLightKit.h.
|
protected |
Definition at line 330 of file vtkLightKit.h.
|
protected |
Definition at line 331 of file vtkLightKit.h.
|
protected |
Definition at line 332 of file vtkLightKit.h.
|
protected |
Definition at line 333 of file vtkLightKit.h.
|
protected |
Definition at line 335 of file vtkLightKit.h.
|
protected |
Definition at line 336 of file vtkLightKit.h.
|
protected |
Definition at line 338 of file vtkLightKit.h.
|
protected |
Definition at line 339 of file vtkLightKit.h.
|
protected |
Definition at line 341 of file vtkLightKit.h.
|
protected |
Definition at line 343 of file vtkLightKit.h.
|
protected |
Definition at line 344 of file vtkLightKit.h.
|
protected |
Definition at line 345 of file vtkLightKit.h.
|
protected |
Definition at line 347 of file vtkLightKit.h.
|
protected |
Definition at line 349 of file vtkLightKit.h.