formZ SDK | 5.0 API Reference | Project | Modeling | Rendering | Render Materials

fz_rmtl_get_bmp_norm_shdr_rndr_txr

Description

Renders a bump shader into a texture map of a given size. Unlike , the texture is not returned as a gray scale height map, but as a color coded map, where the x,y and z direction of the normal direction of the bumps are encoded as r, g and b colors ( r = (x + 1) / 2, g = (y + 1)/2, b = (z + 1) /2 ). This creates a texture map commonly known as a normal map. The texture map can be returned in a memory buffer of bytes or can be written to an image file. To return the texture map in memory, the bytes parameter must be passed as non NULL and the bytes storage must be allocated by calling code to res * res * 3 bytes. Pixel color is stored as unsigned char r g b components. i.e. 255, 255, 255 is white, 0, 0, 0 is black. Pixels are stored in row major order with the top left pixel of the texture in the first three bytes. To write the texture map to file, the floc parameter must be passed as non NULL and must contain a valid file name and file directory. The format reference id parameter, ffmt_id, must identify a file format that is capable of writing a bitmap image.

Plugin Prototype

fzrt_error_td fz_rmtl_get_bmp_norm_shdr_rndr_txr(

fzrt_int

windex,

fz_rmtl_ptr

rmtl_ptr,

fzrt_int

res,

fzrt_int

num_tiles,

unsigned char *

bytes,

fzrt_floc_ptr

floc,

fz_ffmt_ref_td

ffmt_id )

Parameters

windex [Input]

project window index

rmtl_ptr [Input]

the surface style from which to render the bump shader

res [Input]

The (horizontal and vertical) resolution of the square texture.

num_tiles [Input]

The number of (horizontal and vertical) tiles with which the pattern is rendered into the texture. For example, num_tiles == 3 generates 3 x 3 = 9 tiles of the pattern.

bytes [Input, Optional]

byte storage for the texture. IMPORTANT : it is the calling code's responsibility to allcoate at least res * res * 3 bytes.

floc [Input, Optional]

texture map file locator

ffmt_id [Input, Optional]

The file format reference id.

Returns

Error codes

Availability

6.1.0.0

Function Set

fz_rmtl_fset


Defined in

fz_rmtl_api.h