formZ SDK | 5.0 API Reference | Project | Modeling | Rendering | Render Materials
Description
Renders the reflection map shaders of all faces of an object into a single
texture. The object is unfolded and then rendered from a top view.
The uv coordinates of each topological point (segment's start point)
are returned in the optional uv_coords array. If passed in as non NULL,
the array must be allocated to the number of items which is equal to the number of
facetted segments of the object.
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 bytes if do_alpha is FALSE or
res * res * 2 bytes if do_alpha is TRUE. Pixel intensity
is stored as an unsigned char. i.e. from 255 (white) to 0 (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.
The rendered texture for each face does actually not show the shape of the
face but coveres the entire bounding rectangle of the face. This is done to avoid
color bleeding artifacts when using MIP mapping and summation table sampling
techniques. In order to capture the shape of the face in the texture, the do_alpha
argument needs to be set to TRUE. When this is done, the shape of the face
is rendered into the aplha channel of the texture, where a pixel covered by the
face is on (255) and a true background pixels is off (0).
Note, that the texture contains all effects of the reflection map shaders properly. This
includes decals, solid texture and random patterns.
The reflection map is identified by the refl_map argument as follows :
0 : ambient map
1 : diffuse map
2 : specular map
3 : mirror map
4 : transmission map
5 : glow map
nl>
Note, that only those reflection maps actually are rendered, that are present in
the given reflection shader of the surface style. For example, rendering the
mirror map in a matte shader will produce a sold white texture, since the
matte shader does not have a mirror factor.
Plugin Prototype
fzrt_error_td fz_rmtl_get_obj_reflmap_rndr_txr(
fzrt_int | windex, |
objt, | |
fzrt_int | refl_map, |
fzrt_int | res, |
unsigned char * | bytes, |
floc, | |
ffmt_id, | |
do_alpha, | |
fz_xy_td * | uv_coords ) |
Parameters
windex [Input]
project window index
objt [Input]
the object, whose reflection map shaders to render into the texture map
refl_map [Input]
which reflection map to render
res [Input]
The (horizontal and vertical) resolution of the square texture.
bytes [Input, Optional]
byte storage for the texture. IMPORTANT : it is the calling code's responsibility to allcoate at least res * res bytes.
floc [Input, Optional]
texture map file locator
ffmt_id [Input, Optional]
The file format reference id.
do_alpha [Input]
If set to TRUE, the outline of the rendered faces is included in the aplha channel of the texture.
uv_coords [Input, Optional]
storage for the uv coordinates, which place each topological point (segment start point) of the object at the proper position in the texture.
Returns
Error codes
Availability
6.0.0.0
Function Set
Defined in