ID3DXPRTEngine::ComputeVolumeSamplesDirectSH method

Computes a projection of distant lighting into spherical harmonic (SH) basis vectors that represent incident radiance at specified locations.

Syntax

HRESULT ComputeVolumeSamplesDirectSH(
  [in]            UINT            OrderIn,
  [in]            UINT            OrderOut,
  [in]            UINT            NumVolSamples.xml,
  [in]      const D3DXVECTOR3     *pSampleLocs,
  [in, out]       LPD3DXPRTBUFFER pDataOut
);

Parameters

OrderIn [in]

Type: UINT

Order of the SH representation of distant lighting. Must be in the range of D3DXSH_MINORDER to D3DXSH_MAXORDER, inclusive. The degree of the evaluation is OrderIn - 1.

OrderOut [in]

Type: UINT

Order of the SH representation of local lighting. Must be in the range of D3DXSH_MINORDER to D3DXSH_MAXORDER, inclusive. The degree of the evaluation is OrderOut - 1.

NumVolSamples.xml [in]

Type: UINT

Number of sample locations.

pSampleLocs [in]

Type: const D3DXVECTOR3*

Position for each sample.

pDataOut [in, out]

Type: LPD3DXPRTBUFFER

Pointer to an output ID3DXPRTBuffer object that projects the distant lighting into SH basis vectors. This buffer must have the proper number of color channels allocated for the simulation. This method generates OrderIn² * OrderOut"² scalars per channel at each sample location.

Return value

Type: HRESULT

If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be one of the following: D3DERR_INVALIDCALL, E_OUTOFMEMORY.

Remarks

This method computes how light from a distant source arrives at each point in space specified by pSampleLocs. The SH coefficients represent the mapping, at each pSampleLocs point, of source radiance to transferred incident radiance.

To use this method successfully, you must set sampling over a sphere with UseSphere = TRUE and UseCosine = FALSE in ID3DXPRTEngine::SetSamplingInfo; otherwise, this method will return an error with D3DERR_INVALIDCALL.

Requirements

Requirement Value
Header
D3DX9Mesh.h
Library
D3dx9.lib

See also

ID3DXPRTEngine

ID3DXPRTEngine::ComputeVolumeSamples