Specifications

Developers guidelines | 3D graphics with Java ME
38 June 2010
Q: How can I do ToonShading
A: ToonShading, or CelShading, cannot be performed by the hardware, since the
current hardware on all 3D-enabled phones does not support direct manipulation of
the graphics pipeline (shading). However, one can mathematically create CelShaded
models in software. It is done by manually plotting pixels to the graphic buffer after all
models have been rendered. This technique is very slow unless done right. The key is
to work with unshaded models with no (or almost no) textures and later shade them
directly onto the graphics buffer with pixel-plotting.
Q: Is there any support for perspective correction ?
A: The FigureLayout class provides a convenient setPerspective method which can be
used for perspective correction.
Q: Is it possible to export several 3D objects in a scenario at to one Bac file?
A: Yes, but it is recommended to export them as individual Bac files. This allows your
objects to be individually loaded in your application. Also, this minimises errors with
loading files onto phones. Some phones might throw exceptions when too complex
files are loaded.
Q: What do the constants PATTR_BLEND_NORMAL, PATTR_BLEND_ADD,
PATTR_BLEND_HALF and PATTR_BLEND_SUB mean?
A: The commands are used to blend polygons. The table below shows how the
polygon background is mixed with the texture.
The RGB colors from the background are mixed with the RGB colors from the texture
individually. Half, Addition and Subtract cannot be used at the same time for the same
polygon.
Q: Is there any way to access the vertices of a 3Dobject in my MIDlet using Mascot
Capsule version 3? If not, how should I check whether the model touches the ground?
A: To check how a model touches the ground is really a pure polygon-collision issue.
Most of the time a developer will create some kind of level editor, where clear
boundaries are made for all the walkable objects (usually large bounding boxes). Thus
one doesn't have to have vertex access but can instead mathematically determine if
one object is touching another. All that is needed is a file containing all ground
bounding boxes and a bounding box or sphere for your model.
To create a bounding sphere for a model only two single variables need to be known.
The center of the model, and the radius of the sphere. Most developers export
bounding boxes when the model is converted, by reading an ascii format. That way
one has no need for direct vertex manipulation either.
Attribute Background Texture
Normal 0% + 100%
Add 100% + 100%
Half 50% + 50%
Sub 100% - 100%