Brief Index      Full Index      Events Index      I.M. Reference

Insert_Distant_Light

Functions

HC_KEY Insert_Distant_Light (double di, double dj, double dk)
HC_KEY DInsert_Distant_Light (double di, double dj, double dk)

Function Documentation

HC_KEY Insert_Distant_Light ( double  di,
double  dj,
double  dk 
)

Inserts a distant point source of light into your scene.

Parameters:
di- Vector describing the direction in which the light lies, infinitely far away.
dj- As above.
dk- As above.
Returns:
The key to the inserted geometry, or -1 if an error occurred.

DETAILS

Normally, when you set the color of a surface (a polygon, mesh, or shell face) HOOPS Visualize draws the surface in the specified color. Visualize will optimize scenes that contain no lights by skipping lighting calculations. If a scene has one or more lights in it, lighting calculations are made. The lighting calculations compute the color of each face using the color and orientation of the lights.

In HOOPS Visualize, there are four possible sources of light:


A distant light is similar to the sun: it's so far away that all the light rays arriving from it are parallel. The only important considerations are the light's color and direction - not its position. The direction specified by Insert_Distant_Light() can later be modified by the modelling transformations. The color is defined by the "lights" option of Set_Color() . Unlike local, spot, and area lights, distant lights illuminate all surfaces in a scene with equal intensity (the intensity defined by Set_Color() ).

The scope of a light is always its containing window. Even if the light is many levels down from the window in the segment tree, it still "shines light" on everything in the scene (except as noted below, under "light visibility"). In fact, if you want to have several lights of different colors, you must put them in different segments in order to set the different color attributes. You could also put a light in its own subsegment so as to make it orbit your scene using Rotate_Object().

NOTES

If the light is shining on one side of a given face and you're looking at the other side, the side you're looking at is in the shadow of the face and is not lit by the light. Beyond this effect, shadows are not computed by the standard shaders ("no lighting interpolation", Gouraud, and Phong). If you request shadows in your scene via advanced radiosity or ray-trace computations (see Set_Rendering_Options() ), shadows generated from a specific light can be turned off with Set_Visibility("shadows = no emitting").

The number of lights you can have in a scene is almost unlimited. Since the screen isn't able to keep getting brighter and brighter as additional lights are inserted, HOOPS Visualize scales the total brightness by the total brightness of all the light sources. Please see the "light scaling" Driver Option for a means of overriding this calculation.

The "fixed colors" driver option might also be of interest when using lights.

In the current implementation, lights only affect faces. Lines and edges are still drawn in the standard way, with static colors.

Turning off the visibility of a light makes that light cease to exist for the purpose of performing, a lighting calculation. This may be a convenient way to enter and leave "lighted" mode in your program.

Turning off the light visibility also prevents a light placed elsewhere in the segment tree (but within the same window) from shining through the local geometry. This could be useful for inserting geometries that don't need to be lit, such as annotations, into a lighted window.

Of the five types of possible light sources listed above, an ambient light is not sufficient to trigger lighting calculations. To force the system to perform lighting calculations, insert a black distant light.

RESTRICTIONS

In OpenGL, the maximum number of supported lights is 8. For DX9, the maximum number of lights is 15.

See also:
Insert_Local_Light, Insert_Spot_Light, Renumber_Key, Rotate_Object, Rotate_Object_Offaxis, Set_Color, Set_Driver_Options, Set_Rendering_Options, Set_Visibility, Show_Distant_Light, Move_Distant_Light.
HC_KEY DInsert_Distant_Light ( double  di,
double  dj,
double  dk 
)

Similar to Insert_Distant_Light(), but accepts parameters of type double for increased precision.

Parameters:
di- Vector describing the direction in which the light lies, infinitely far away.
dj- As above.
dk- As above.
Returns:
The key to the inserted geometry, or -1 if an error occurred.

DETAILS

No additional details. See Insert_Distant_Light().

Brief Index      Full Index      Events Index      I.M. Reference