Shading
Shading is a method to create shadows on the model. Two shading methods, gouraud shading and toon shading are available in MascotCapsule V3.
Table of contents
1. Gouraud shading
Gouraud shading method finds the normal vector of each vertex in the object, and interpolates the triangular surface consisting of these vertices. A smooth shading result is achieved, because pixel borders are less distinctive.
Gouraud shading
2. Toon shading
Toon shading method creates distinctive borders for the shadow. It creates shading effects similar to cartoon animation.
Toon shading
3. Shading sample code
Use the setShading( int shading ) method in the Effect3D class, in order to specify the shading setting. Specify the shading value to NORMAL_SHADING for gouraud shading, and TOON_SHADING for toon shading.
In addition to this, use the setThreshold( int threshold, int high, int low ) method to specify the threshold level for toon shading. In this method, threshold represents the threshold value of toon shading, high represents the intensity when the level is greater than the threshold value, and low represents the intensity when the level is equal to or smaller than the threshold value. Specify the intensity value 0 to 255 for high and low.
* commandAction() method
* Process when the soft key is pressed-down (changing the rendering parameter)
*/
public void commandAction( Command c, Displayable d ){
/* Changing the shading method */
if( label.equals( commandLabels[ 0 ] ) ){
Quick Links
- MIDP + com.mascotcapsule package (MascotCapsule V3 API)
- Basic rendering
- Rendering a 3D model / Semi-transparency using BlendHalf / Additive and subtractive blending effects / Switching the animation data / Switching the pattern using dynamic polygons / Lighting / Shading / Using the environment map / Rendering the primitives / Reducing the texture distortion / Preventing Z-sort rendering mistakes under certain circumstances / Coordinate systems and the camera / Projection methods
- Basic rendering
- Go back to Samples index

