Public Member Functions

LightRayTraversal Class Reference

Search for all occurrences

Detailed Description

This is a callback class that can be given to a ObjLightDesc to have a ray traced through the light volume.

A plug-in derives a class from this one and passes it as a callback in the ObjLightDesc method TraverseVolume(). This allows a developer to integrate the illumination of a segment due to a light. t0 and t1 define the segment in terms of the given ray. This is what the 3ds Max spotlights do: First they break the segment up into three main pieces. The first piece is from the camera to where the ray intersects the lights cone volume. The callback Step() is called once over this segment (t0 and t1 will have this first piece). The illumination is constant over this entire segment from t0 to t1. It is a constant black since the light is not illuminating it at all. The next segment is inside the cone. This segment will be broken up into small pieces. First as it's stepping along it will be between the falloff and the hotspot. The illumination over this segment goes from black to brighter and brighter as it moves towards to hotspot. Across the entire hotspot region the illumination may be constant. Then as it steps from the hotspot to the falloff the illumination will go back down to black. Inside the hotspot region, if shadows are turned on, the light may be brighter or darker depending on if it's inside a shadow or on the edge of a shadow. The light handles all of this. It takes care of the shadows, attenuation, etc. Now consider how the 3ds Max atmospheric effects such as the volume lights use this information. For each light that they are bound to, they call the method TraverseVolume() on the light. The volume light atmospheric effect passes this callback to the TraverseVolume() method. The light then calls this Step() method of the callback for each partial segment of the ray. Given the illumination on the segment (illum) it computes the fog density over that piece. The density may be constant if noise is not turned on, or it may vary if noise is turned on. Using the fog density and the illumination it computes the light reflected off the atmosphere for the segment.

See also:
Class ObjLightDesc

#include <object.h>

Inheritance diagram for LightRayTraversal:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual  ~LightRayTraversal ()
  Destructor.
virtual BOOL  Step (float t0, float t1, Color illum, float distAtten)=0
  This method is called for every step defined by t0 and t1.

Constructor & Destructor Documentation

virtual ~LightRayTraversal ( ) [inline, virtual]

Destructor.

{;}

Member Function Documentation

virtual BOOL Step ( float  t0,
float  t1,
Color  illum,
float  distAtten 
) [pure virtual]

This method is called for every step defined by t0 and t1.

The illumination over this segment is passed in illum.

Parameters:
t0 The start of the segment. This is a distance along the ray. The ray is made up of a point p and a unit length direction vector dir. The point defined by t0 is thus ray.p+t0*ray.dir.
t1 The end of the segment. This is a distance along the ray. The ray is made up of a point p and a unit length direction vector dir. The point defined by t1 is thus ray.p+t1*ray.dir.
illum The light intensity over the entire segment. It can be assumed that the light intensity is constant for the segment.
distAtten This parameter may be used so that volume effects can use the distance attenuation value as an input variable to their effects. For instance, the volume light uses this to change the fog color based on the distance from the light.
Returns:
TRUE to continue; FALSE to halt the integration (stop the traversal).

LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal
LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal LightRayTraversal