?/TD>
Microsoft DirectX 9.0

D3DXComputeNormalMap Function


Converts a height map into a normal map. The (x,y,z) components of each normal are mapped to the (r,g,b) channels of the output texture.

Syntax

HRESULT D3DXComputeNormalMap(      

    LPDIRECT3DTEXTURE9 pTexture,     LPDIRECT3DTEXTURE9 pSrcTexture,     const PALETTEENTRY *pSrcPalette,     DWORD Flags,     DWORD Channel,     FLOAT Amplitude );

Parameters

pTexture
[out, retval] Pointer to an IDirect3DTexture9 interface, representing the destination texture.
pSrcTexture
[in, retval] Pointer to an IDirect3DTexture9 interface, representing the source height-map texture.
pSrcPalette
[in] Pointer to a PALETTEENTRY type that contains the source palette of 256 colors or NULL.
Flags
[in] One or more D3DX_NORMALMAP flags that control generation of normal maps.
Channel
[in, out] One D3DX_CHANNEL flag specifying the source of height information.
Amplitude
[in] Constant value by which the height information is multiplied.

Return Value

If the function succeeds, the return value is D3D_OK.

If the function fails, the return value can be the following value.

D3DERR_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.


Remarks

This method computes the normal by using the central difference with a kernel size of 3x3. RGB channels in the destination contain biased (x,y,z) components of the normal.

Function Information

Headerd3dx9tex.h
Import libraryd3dx9.lib
Minimum operating systems Windows 98


© 2002 Microsoft Corporation. All rights reserved.