Computes the source radiance resulting from a single bounce of interreflected light. This method can be used for any lit scene, including a spherical harmonic (SH)-based precomputed radiance transfer (PRT) model.
HRESULT ComputeBounce( LPD3DXPRTBUFFER pDataIn, LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal );
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.
Use the following calling sequence to model multiple light bounces with direct lighting.
LPD3DXPRTBUFFER pDataA, pDataB, pDataC; // initialization ID3DXPRTEngine* m_pPRTEngine; ComputeDirectLightingSH( SHOrder, pDataA ); // The accumulation buffer, pDataC, needs to be // initialized to the direct lighting result. pDataC->AddBuffer( pDataA ); hr = m_pPRTEngine->ComputeBounce( pDataA, pDataB, pDataC ); // first bounce hr = m_pPRTEngine->ComputeBounce( pDataB, pDataA, pDataC ); // second bounce hr = m_pPRTEngine->ComputeBounce( pDataA, pDataB, pDataC ); // third bounce hr = m_pPRTEngine->ComputeBounce( pDataB, pDataA, pDataC ); // fourth bounce
Use the following calling sequence to model multiple light bounces with subsurface scattering.
LPD3DXPRTBUFFER pDataA, pDataB, pDataC; // initialization ID3DXPRTEngine* m_pPRTEngine; ComputeDirectLightingSH( SHOrder, pDataA ); // *pDataC should be set to zero. The ComputeSS call will add together // the direct lighting results from pDataA for non-subsurface scattering // elements and subsurface scattering results for the subsurface scattering // elements. Perform proper error handling for each call. hr = m_pPRTEngine->ComputeSS ( pDataA, pDataB, pDataC ); hr = m_pPRTEngine->ComputeBounce( pDataB, pDataA, NULL ); // first bounce hr = m_pPRTEngine->ComputeSS ( pDataA, pDataB, pDataC ); hr = m_pPRTEngine->ComputeBounce( pDataB, pDataA, NULL ); // second bounce hr = m_pPRTEngine->ComputeSS ( pDataA, pDataB, pDataC );
The output of this method does not include albedo, and only incoming light is integrated in the simulator. By not multiplying the albedo, you can model albedo variation at a finer scale than the source radiance, thereby yielding more accurate results from compression.
Call ID3DXPRTEngine::MultiplyAlbedo to multiply each PRT vector by the albedo.
Header: Declared in D3dx9mesh.h.