Index

PowerDoc Objects

3D Model Settings

Overview

This object contains all the necessary settings for rendering 3D models.

Designated Rendering Function: NONE

None

Properties

pd3DPos (1185)   PD_ARR_LONG_SIGNED

Position of the camera. An array of 3 integers that represent the X, Y and Z coordinates of the camera in 3D model space, multiplied by 262144.

Sample values:

-550502, -1546650, 4508877

pd3DRot (1186)   PD_ARR_LONG_SIGNED

Rotation of the camera. An array of 3 integers that represent the yaw, pitch and roll of the camera in 3D model space, in radians and multiplied by 262144.

Sample values:

-1101005, -107741184, 0

pd3DMul (1187)   PD_ARR_LONG_SIGNED

Scale of the camera's X, Y, Z axis. An array of 3 integers that represent the multiplication factor of the camera's X, Y and Z axis, multiplied by 262144.

Sample values:

262144, 262144, 262144

pd3DBuff (1188)   PD_ARR_LONG_SIGNED

An array of miscellaneous values. Currently this is a single element array.

The elements are interpreted as follows:

The 1st element specifies the distance in Z direction at which the distant fog effect reaches its maximum, multiplied by 262144. If not supplied, the default value is 100 (or 26214400 multiplied). For details, see the 6th, 7th, 8th, 9th and 10th element of the pd3DEnv property.

pd3DProj (1189)   PD_ARR_LONG_SIGNED

An array of projection parameters. Currently this is a 5-element array which defines, in the following order: 1) far clip plane, 2) near clip plane, 3) focal length, 4) film aperture width, and 5) film aperture height. All values except the first one (far clip plane) are multiplied by 262144. The values of this array will be described more thoroughly in the future. If the array is not supplied, the following default values are used.

Perspective Projection

far_clip_plane = 1000
near_clip_plane = 1.0 (or 262144 multiplied)
focal_length = 20.0 (or 5242880 multiplied)
film_aperture_w = 0.980 (or 256901 multiplied)
film_aperture_h = 0.735 (or 192676 multiplied)

Orthographic Projection

far_clip_plane = 1000000000
near_clip_plane = 0.1 (or 26214 multiplied)
focal_length = 20.0 (or 5242880 multiplied)
film_aperture_w = 0.980 (or 256901 multiplied)
film_aperture_h = 0.735 (or 192676 multiplied)

pd3DMiscBits (1190)   PD_LONG_UNSIGNED

Miscellaneous bits.

If bit 1 is set, the projection is orthographic. Otherwise the projection is perspective (default).

pd3DRasterizer (1191)   PD_BYTE_UNSIGNED

Rasterization Method.

0 = Extreme 3D Rasterizer (this is the default)
1 = Standard 3D Rasterizer

pd3DQuality (1192)   PD_BYTE_UNSIGNED

Rendering quality level.

0 = Non-antialiased quality (this is the default)
1 = Antialiased quality level 1
2 = Antialiased quality level 2
3 = Antialiased quality level 3
4 = Antialiased quality level 4
5 = Antialiased quality level 5

pd3DShading (1193)   PD_BYTE_UNSIGNED

Shading method.

0 = Draft (this is the default)
1 = Normal

Note that Normal shading is required to display textures and interpolated face colors. When shading method is Draft, textures will be displayed as opaque gray rectangles and face colors will be rendered using a flat color.

pd3DCulling (1194)   PD_BYTE_UNSIGNED

Culling.

0 = Culling Off (this is the default)
1 = Culling On

pd3DClipping (1195)   PD_BYTE_UNSIGNED

Z-Axis Clipping Method.

0 = Simple Z-Axis Clipping (if one vertex is out of view, the entire polygon is out of view; faster but imprecise)
1 = Standard Clipping (this is the default; a bit slower but precise)

pd3DTransformMode (1196)   PD_BYTE_UNSIGNED

Reserved for future. Must be set to 0.

pd3DTranspThreshold (1197)   PD_BYTE_UNSIGNED

Transparency threshold value in the 0 to 255 range.

The value indicates a transparency threshold at which the display of pixels at surface intersections switches from coarse (i.e. non-antialiased) to smooth (i.e. antialiased).

For example, a value of 128 indicates that any surfaces whose transparency value is 128 or less will generate smooth pixels at intersections with other surfaces, while any surfaces whose transparency value is greater than 128 will generate coarse pixels at intersections with other surfaces.

Consequently, when this value is 0, all visible pixels at surface intersections will always be rendered as coarse. Similarly, when this value is 255, all visible pixels at surface intersections will always be rendered as smooth. This is because all visible surfaces have a transparency value that is 0 or more but less than 255.

The transparency threshold value is only respected by Extreme 3D Rasterizer. Standard 3D Rasterizer does not respect this threshold but always renders pixels at surface intersections as smooth. However, the level of smoothness depends on the rendering quality level.

Sample values:

0
128

pd3DMaxDepth (1198)   PD_WORD_UNSIGNED

Maximum Z-Depth. This is the maximum number of z-depth levels 3D Rasterizer will allocate and be able to process. Must be at least 1. The default value is 16.

Sample values:

8
32

pd3DBkg (1199)   PD_ARR_BYTE_UNSIGNED

A 4-element array containing the R, G, B, X values of a specific background color for which the antialiased pixels should be optimized. If this array is not supplied or has no elements, antialiased pixels will look good on any background color.

This property has impact only when using antialiased rendering quality.

pd3DEnv (1200)   PD_ARR_BYTE_UNSIGNED

An array of parameters describing the environment that affects the final color of the 3D model. This is an array consisting of up to 10 elements. If this array is not supplied or has no elements, only ambient light is used to illuminate the model and no distant fog color is applied to the model. Otherwise, the elements are interpreted as follows:

The 1st element specifies the type of illumination applied to the model.

When this value is 0, only ambient light is used to illuminate the model. The 2nd, 3rd, 4th and 5th elements are ignored in this case. However, when this value is 1 or 2, one additional light source is used to illuminate the model. The value 1 means a "front" light source (placed at the same location as the camera), while the value 2 means a "back" light source (placed at the location which is at the same distance from the origin of 3D model space as the camera but in opposite direction). In both of these cases, the value of the 2nd element is the red component of the light (LR), the value of the 3rd element is the green component of the light (LG), and the value of the 4th element is the blue component of the light (LB). The value of the 5th element is the intensity of the light (LI).

Note that the component of the light (LR, LG, LB) and its intensity (LI) are all quantities in the 0 to 255 range.

The 6th element specifies the type of distant fog effect applied to the model.

When this value is 0, no distant fog color is applied to the model. The same is true if the size of the array is less than 6. The 7th, 8th, 9th and 10th elements are ignored in this case. However, when this value is 1, distant fog color is applied to the model. In this case, the value of the 7th element is the red component of the fog (FR), the value of the 8th element is the green component of the fog (FG), and the value of the 9th element is the blue component of the fog (FB). The value of the 10th element is the intensity of the fog (FI). Also, note that the first element of the pd3DBuff array in this case supplies the distance at which the distant fog effect reaches its maximum.

Note that the component of the fog (FR, FG, FB) and its intensity (FI) are all quantities in the 0 to 255 range.

Sample values:

0
1, 255, 166, 66, 128, 0
2, 255, 166, 66, 128, 1, 128, 128, 128, 200
1, 241, 235, 200, 128, 1, 64, 64, 64, 204

Example

C/C++

DT_ID_SLONG obj[1];

obj[0] = pdObjAdd(doc, 0, "3D Model Settings");

/* Properties for object 0 */
pdPropAdd(doc, obj[0], pd3DPos, "524288, 1205862, 10092544", PD_ARR_LONG_SIGNED);
pdPropAdd(doc, obj[0], pd3DRot, "-9594470, -102078874, 0", PD_ARR_LONG_SIGNED);
pdPropAdd(doc, obj[0], pd3DMul, "262144, 262144, 262144", PD_ARR_LONG_SIGNED);
pdPropAdd(doc, obj[0], pd3DMiscBits, "0", PD_LONG_UNSIGNED);
pdPropAdd(doc, obj[0], pd3DRasterizer, "0", PD_BYTE_UNSIGNED);
pdPropAdd(doc, obj[0], pd3DQuality, "3", PD_BYTE_UNSIGNED);
pdPropAdd(doc, obj[0], pd3DShading, "1", PD_BYTE_UNSIGNED);
pdPropAdd(doc, obj[0], pd3DCulling, "0", PD_BYTE_UNSIGNED);
pdPropAdd(doc, obj[0], pd3DClipping, "1", PD_BYTE_UNSIGNED);
pdPropAdd(doc, obj[0], pd3DTranspThreshold, "128", PD_BYTE_UNSIGNED);

INTEGRAL DSL

/* Lambda shortcuts */

local o = @(label = "") CDTObj(::my.doc, label); /* to make object */
local p = @(id, str, len = PD_DEFAULT) CDTProp(id, str, len); /* to add property - general */
local s = @(id, str) CDTPropStr(id, str); /* to add property - string */
local i = @(id, num) CDTPropInt(id, num); /* to add property - integer */
local l = @(id, obj) CDTLink(id, obj); /* to add link */

/* Objects */

local obj_0 = o("3D Model Settings");

/* Object Properties */

obj_0 + p(pd3DPos, "524288, 1205862, 10092544") + p(pd3DRot, "-9594470, -102078874, 0") + p(pd3DMul, "262144, 262144, 262144") + p(pd3DMiscBits, "0") + p(pd3DRasterizer, "0") + p(pd3DQuality, "3") + p(pd3DShading, "1") + p(pd3DCulling, "0") + p(pd3DClipping, "1") + p(pd3DTranspThreshold, "128");
 

Index