Expand Minimize

D3DXSHEvalSphericalLight function

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

Syntax


HRESULT D3DXSHEvalSphericalLight(
  _In_   UINT Order,
  _In_   const D3DXVECTOR3 *pPos,
  _In_   FLOAT Radius,
  _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.

pPos [in]

Type: const D3DXVECTOR3*

Pointer to the light position.

Radius [in]

Type: FLOAT

Radius of spherical light source.

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*

Pointer to the output SH vector for the green component.

pBOut [out]

Type: FLOAT*

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

Evaluates a spherical light and returns spectral SH data. There is no normalization of the intensity of the light like there is for directional lights, so care has to be taken when specifying the intensities. 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