Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.

  >  Docs Center  >  IDL Reference  >  Object Graphics - Visualization  >  IDLgrLight



Superclasses | Creation | Properties | Methods | Version History

A light object represents a source of illumination for three-dimensional graphic objects. Lights may be either ambient, positional, directional, or spotlights. The first 8 non-ambient type lights encountered in a scene are activated. Any additional non-ambient lights are ignored. Ambient lights do not count toward the limit of 8 active lights. However, an application should define only a single ambient light since only the last ambient light encountered in a scene will be used to define the ambient light properties. If a positional, directional or spotlight type of light is not explicitly created, the default light TYPE is ambient. Lights are not required for objects displayed in two dimensions.

An IDLgrLight object is an atomic graphic object; it is one of the basic drawable elements of the IDL Object Graphics system, and it is not a container for other objects.

Configuring Light Objects

In addition to the type of light source, you can control several other properties of a light object. The following example creates a solid surface object and displays it first with only ambient lighting, then adds various light objects to the scene.

Begin by creating some data, the surface object, and supporting objects:

zdata = DIST(40)
mywindow = OBJ_NEW('IDLgrWindow')
myview = OBJ_NEW('IDLgrView')
mymodel = OBJ_NEW('IDLgrMODEL')
mysurf = OBJ_NEW('IDLgrSurface', zdata, STYLE=2)
; Create the object hierarchy:
myview->Add, mymodel
mymodel->Add, mysurf
; Retrieve the X, Y, and Z ranges from the surface object:
mysurf->GetProperty, XRANGE=xr, YRANGE=yr, ZRANGE=zr
; Convert x, y, and z ranges to normalized coordinates.
xnorm = [-xr[0]/(xr[1]-xr[0]), 1/(xr[1]-xr[0])]
ynorm = [-yr[0]/(yr[1]-yr[0]), 1/(yr[1]-yr[0])]
znorm = [-zr[0]/(zr[1]-zr[0]), 1/(zr[1]-zr[0])]
; Rotate the surface to a convenient orientation:
mymodel->Rotate, [1,0,0], -90
mymodel->Rotate, [0,1,0], 30
mymodel->Rotate, [1,0,0], 30
; Use the SET_VIEW routine to set an appropriate viewplane
; rectangle and zclip region for the view: 
SET_VIEW, myview, mywindow
; Draw the contents of the view:
mywindow->Draw, myview

Once the surface object is drawn, we see that there is no definition or apparent three-dimensional shape to the surface. If we add a positional light one unit in the Z direction above the XY origin, however, details appear:

mylight = OBJ_NEW('IDLgrLight', TYPE=1, LOCATION=[0,0,1])
mymodel->Add, mylight
mywindow->Draw, myview

We can continue to alter the lighting characteristics by changing the properties of the existing light or by adding more light objects. (You can have up to eight lights in a given view object.) We can change the color:

mylight->SetProperty, COLOR=[200,0,200]
mywindow->Draw, myview

We can change the intensity of the light:

mylight->SetProperty, INTENSITY=0.7
mywindow->Draw, myview




See IDLgrLight::Init.


Objects of this class have the following properties. See IDLgrLight Properties for details on individual properties.

In addition, objects of this class inherit the properties of all superclasses of this class.


This class has the following methods:

In addition, this class inherits the methods of its superclasses (if any).

Version History




Added LIGHT_INDEX, SHADER, properties

© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us