ID3DXPRTEngine::ComputeLDPRTCoeffs

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.

HRESULT ComputeLDPRTCoeffs(
  LPD3DXPRTBUFFER pDataIn,
  UINT Order,
  D3DXVECTOR3 * pNormOut,
  LPD3DXPRTBUFFER pDataOut
);

Parameters

pDataIn
[in] Pointer to an input ID3DXPRTBuffer spherical harmonic (SH) precomputed radiance transfer (PRT) data object.
Order
[in] 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.
pNormOut
[in, out] 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] Pointer to an output ID3DXPRTBuffer object that contains Order zonal harmonic coefficients per color channel per sample.

Return Values

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

Header: Declared in D3dx9mesh.h.