Expand Minimize

D3DXSHEvalDirectionalLight function

Evaluates a directional light and returns spectral spherical harmonic (SH) data.

Syntax


HRESULT D3DXSHEvalDirectionalLight(
  _In_   UINT Order,
  _In_   const D3DXVECTOR3 *pDir,
  _In_   FLOAT RIntensity,
  _In_   FLOAT GIntensity,
  _In_   FLOAT BIntensity,
  _Out_  FLOAT *pROut,
  _Out_  FLOAT *pGOut,
  _Out_  FLOAT *pBOut
);

Parameters

Order [in]

Type: UINT

Order of the SH evaluation. Must be in the range of D3DXSH_MINORDER to D3DXSH_MAXORDER, inclusive. The evaluation generates Order2 coefficients. The degree of the evaluation is Order - 1.

pDir [in]

Type: const D3DXVECTOR3*

Pointer to the (x, y, z) hemisphere axis direction vector in which to evaluate the SH basis functions. See Remarks.

RIntensity [in]

Type: FLOAT

The red intensity of the light.

GIntensity [in]

Type: FLOAT

The green intensity of the light.

BIntensity [in]

Type: FLOAT

The blue intensity of the light.

pROut [out]

Type: FLOAT*

Pointer to the output SH vector for the red component.

pGOut [out]

Type: FLOAT*

Optional pointer to the output SH vector for the green component.

pBOut [out]

Type: FLOAT*

Optional pointer to the output SH vector for the blue component.

Return value

Type: HRESULT

If the function succeeds, the return value is D3D_OK. If the function fails, the return value can be: D3DERR_INVALIDCALL.

Remarks

The output vector is computed so that if the intensity ratio R/G/B is equal to 1, the resulting exit radiance of a point directly under the light on a diffuse object with an albedo of 1 would be 1.0. This will compute three spectral samples; pROut will be returned, while pGOut and pBOut may be returned.

On the sphere with unit radius, as shown in the following illustration, direction can be specified simply with theta, the angle about the z-axis in the right-handed direction, and phi, the angle from z.

Illustration of a sphere with unit radius

The following equations show the relationship between Cartesian (x, y, z) and spherical (theta, phi) coordinates on the unit sphere. The angle theta varies over the range of 0 to 2 pi, while phi varies from 0 to pi.

Equations of the relationship between Cartesian and spherical coordinates

Requirements

Header

D3dx9math.h

Library

D3dx9.lib

See also

Precomputed Radiance Transfer (Direct3D 9)

 

 

Community Additions

ADD
Show:
© 2014 Microsoft