![]() |
![]() |
![]() |
Sets mesh material properties in the 3-D scene. Use this method to specify subsurface scattering parameters.
Syntax
HRESULT SetMeshMaterials(
const D3DXSHMATERIAL **ppMaterials, UINT NumMeshes, UINT NumChannels, BOOL bSetAlbedo, FLOAT fLengthScale );
Parameters
- ppMaterials
- [in] Address of a pointer to desired mesh material properties. See D3DXSHMATERIAL.
- NumMeshes
- [in] Index of the mesh on which to set material properties.
- NumChannels
- [in] Number of color channels to set in the mesh. Set to 1 to specify gray materials (R = G = B), or 3 to enable color bleeding effects.If you intend to change this parameter, first set the albedo using another method such as ID3DXPRTEngine::SetPerTexelAlbedo or ID3DXPRTEngine::SetPerVertexAlbedo.
- bSetAlbedo
- [in] If TRUE, sets the albedo of the mesh to ppMaterials, overwriting all existing texel and vertex albedo values.If FALSE, preserves all existing texel and vertex albedo values set by other methods; NumChannels must match the NumChannels parameter used to create the buffer in D3DXCreatePRTBuffer or D3DXCreatePRTBufferTex.
- fLengthScale
- [in] Scale of the 3-D scene relative to a 1-mm cube. Used for subsurface scattering computations.
Return Value
If the method succeeds, the return value is S_OK.
If the method fails, the return value can be one of the following:
D3DERR_INVALIDCALL The method call is invalid. For example, a method's parameter may have an invalid value. E_OUTOFMEMORY Microsoft Direct3D could not allocate sufficient memory to complete the call.