D3DX11ComputeNormalMap function

Note

The D3DX (D3DX 9, D3DX 10, and D3DX 11) utility library is deprecated for Windows 8 and is not supported for Windows Store apps.

Note

Instead of using this function, we recommend that you use the DirectXTex library, ComputeNormalMap.

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 D3DX11ComputeNormalMap(
  _In_ ID3D11DeviceContext *pContext,
  _In_ ID3D11Texture2D     *pSrcTexture,
  _In_ UINT                Flags,
  _In_ UINT                Channel,
  _In_ FLOAT               Amplitude,
  _In_ ID3D11Texture2D     *pDestTexture
);

Parameters

pContext [in]

Type: ID3D11DeviceContext*

Pointer to an ID3D11DeviceContext interface, representing the source height-map texture.

pSrcTexture [in]

Type: ID3D11Texture2D*

Pointer to an ID3D11Texture2D interface, representing the source height-map texture.

Flags [in]

Type: UINT

One or more D3DX_NORMALMAP flags that control generation of normal maps.

Channel [in]

Type: UINT

One D3DX_CHANNEL flag specifying the source of height information.

Amplitude [in]

Type: FLOAT

Constant value multiplier that increases (or decreases) the values in the normal map. Higher values usually make bumps more visible, lower values usually make bumps less visible.

pDestTexture [in]

Type: ID3D11Texture2D*

Pointer to an ID3D11Texture2D interface, representing the destination texture.

Return value

Type: HRESULT

If the function succeeds, the return value is D3D_OK. If the function fails, the return value can be the following value: D3DERR_INVALIDCALL.

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. The central differencing denominator is hardcoded to 2.0.

Requirements

Requirement Value
Header
D3DX11tex.h
Library
D3DX11.lib

See also

D3DX Functions