formZ SDK | 4.0 Call Back Reference | Surface Style Representation

# fz_srep_cbak_bake_combined_textures

Description

This callback function allows a plugin to take procedural textures and bake them on the object as a single image map. It allows the plugin to place all effects, such as shading, decals, maps unique to a renderer into a single image. This method is frequently used by game developers.
The callback is responsible for the whole baking process. This usually involves the following steps (this is how renderZone does it) :
The object is converted to facetted, if it is a smooth object Any non planar faces are triangulated A new surface style is created, which will assigned to the object. This surface style will be set up by the plugin to contain the rendered texture.
The necessary effects are rendered into a single image map. It is up to the plugin to decide how to do it. RenderZone places the rendered image of each face into a single map, arranging the face images in a fashion that minimizes waste.
The uv coordinates of the object are set to point into the rendered texture. The texture map control attribute of the object needs to be set to UV Coordinates, using the uv's.
The surface style is updated to use the rendered texture.
The object and its faces are set to use the new surface style.

Plugin Prototype

fzrt_error_td fz_srep_cbak_bake_combined_textures(

fzrt_int | windex,
fz_objt_ptr | objt,
fzrt_int | res,
fzrt_floc_ptr | floc,
fz_ffmt_ref_td | ffmt_id,
fzrt_boolean * | cancelled,
fzrt_int * | prog_count )

Parameters

windex [Input]

project window index

objt [Input]

The object onto which to bake the textures

res [Input]

The horizontal and vertical resolution in pixel at which to render the textures.

floc [Input]

The location for the saved textures

ffmt_id [Input]

The id of the image format

cancelled [Result]

Return TRUE, if the texture baking process was cancelled

prog_count [Result]

The progress of the baking operation as a value from 0 to 100 (i.e. percent done). This output variable is used to drive a progress bar.

Returns

Error codes

Availability

7.0.0.0

Plugin Example

Function Set

fz_srep_cbak_fset

Defined in

fz_srep_api.h