d3d9.dllComputeSS
Microsoft DirectX 9.0 SDK Update (October 2004)

ID3DXPRTEngine::ComputeSS Method


Computes the source radiance resulting from subsurface scattering, using material properties set by ID3DXPRTEngine::SetMeshMaterials. This method can be used only for materials defined per-vertex in a mesh object.

Syntax

HRESULT ComputeSS(      

    LPD3DXPRTBUFFER pDataIn,     LPD3DXPRTBUFFER pDataOut,     LPD3DXPRTBUFFER pDataTotal );

Parameters

pDataIn
[in] Pointer to an input ID3DXPRTBuffer object that represents the 3-D object from the previous light bounce. This input buffer must have the proper number of color channels allocated for the simulation.
pDataOut
[in, out] Pointer to an output ID3DXPRTBuffer object that models a single bounce of the subsurface-scattered light. This output buffer must have the proper number of color channels allocated for the simulation.
pDataTotal
[in, out] Pointer to an optional ID3DXPRTBuffer object that is the running sum of all previous pDataOut outputs. May be NULL.

Return Value

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value can be one of the following:

D3DERR_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.
E_OUTOFMEMORYMicrosoft Direct3D could not allocate sufficient memory to complete the call.


Remarks

To model subsurface scattering, call this method for each light bounce after an ID3DXPRTEngine::ComputeDirectLighting... method is called.

Use the following calling sequence to model subsurface scattering.

LPD3DXPRTBUFFER pDataA, pDataB, pDataC; // initialization
ID3DXPRTEngine* m_pPRTEngine;

hr = 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.

hr = m_pPRTEngine->ComputeSS( pDataA, pDataB, pDataC );
if ( FAILED( hr ) goto Exit;

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 precomputed radiance transfer (PRT) vector by the albedo.

See Also

ID3DXPRTEngine::ComputeBounce


© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.