ID3DXPRTEngine::ComputeLDPRTCoeffs method

Computes locally-deformable precomputed radiance transfer (LDPRT) coefficients relative to per-sample normal vectors to minimize the least-squares error with respect to input ID3DXPRTBuffer data. These coefficients can be used with skinned or transformed normal vectors to model global effects on dynamic objects.

Syntax

HRESULT ComputeLDPRTCoeffs(
  [in]      LPD3DXPRTBUFFER pDataIn,
  [in]      UINT            Order,
  [in, out] D3DXVECTOR3     *pNormOut,
  [in, out] LPD3DXPRTBUFFER pDataOut
);

Parameters

pDataIn [in]

Type: LPD3DXPRTBUFFER

Pointer to an input ID3DXPRTBuffer spherical harmonic (SH) precomputed radiance transfer (PRT) data object.

Order [in]

Type: UINT

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

pNormOut [in, out]

Type: D3DXVECTOR3*

Optional vector array to be filled with shader-optimal normal vectors for which LDPRT coefficients are optimized. This array must be the same size as the number of samples in pDataIn. If NULL, surface normal vectors are used.

pDataOut [in, out]

Type: LPD3DXPRTBUFFER

Pointer to an output ID3DXPRTBuffer object that contains Order zonal harmonic coefficients per color channel per sample.

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

Solutions for shading normal vectors can optionally be obtained with this method. These normal vectors, along with the LDPRT coefficients, can more accurately represent the PRT signal. In this case, the coefficients represent zonal harmonics oriented in the normal direction.

This method cannot be used with results from ID3DXPRTEngine::ComputeSurfSamplesBounce or ID3DXPRTEngine::ComputeSurfSamplesDirectSH.

Requirements

Requirement Value
Header
D3DX9Mesh.h
Library
D3dx9.lib

See also

ID3DXPRTEngine