ID3DXPRTEngine::ComputeSSAdaptive

Computes a transfer vector that maps source radiance to exit radiance resulting from subsurface scattering, using adaptive sampling and material properties set by ID3DXPRTEngine::SetMeshMaterials. The method generates new vertices and faces on the mesh to more accurately approximate the precomputed radiance transfer (PRT) signal. This method can be used only for materials defined per-vertex in a mesh object.

HRESULT ComputeSSAdaptive(
  LPD3DXPRTBUFFER pDataIn,
  FLOAT AdaptiveThresh,
  FLOAT MinEdgeLength,
  UINT MaxSubdiv,
  LPD3DXPRTBUFFER pDataOut,
  LPD3DXPRTBUFFER pDataTotal
);

Parameters

pDataIn
[in] Pointer to an input ID3DXPRTBuffer object that represents the 3D object from the previous light bounce. This input buffer must have the proper number of color channels allocated for the simulation.
AdaptiveThresh
[in] Threshold on the PRT vector to use for subdividing mesh vertices and faces. If less than 1e-6f, a default value of 1e-6f is specified.
MinEdgeLength
[in] Minimum face edge length that will be generated in adaptive sampling. If the method determines that the value is too small, a model-dependent value is specified.
MaxSubdiv
[in] Maximum level of subdivision of a face that will be used in adaptive sampling. If zero, a default value of 4 is specified.
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 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

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

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.

Requirements

Header: Declared in D3dx9mesh.h.

See Also

ID3DXPRTEngine::ComputeBounce, ID3DXPRTEngine::ComputeSS