Software Sprite Overview

Sample Execution Screen


Description

The software sprite displays a character using the square polygon from the TWL and NITRO 3D graphics engine.

Software Sprite Features

Priority

The rendering priority of the software sprite can be specified with the Z-value of the square polygons that make up the software sprite. To use orthogonal projection with the rendering of square polygons, the depth test needs to be set up in the Z-buffer mode to properly carry out the test. If you are using a 3D object and the software sprite together, the Z-values of each must be managed so that they do not interfere with each other.

Alpha Blend

To specify different opacity for each sprite, use the alpha blend feature of the software sprite. In the 3D graphics engine, rendering a polygon with its alpha value set to zero renders it as a wireframe. However, fully transparent sprites (alpha value of zero) are detected inside the library, and the library is configured not to render them.

Color Modulation

A specified color can be applied to the software sprite.

Setting the UV Value

The software sprite is rendered as a polygon with textures mapped, but the UV value of the mapped texture can be changed. The UV values are specified for the upper left and lower right of the sprite.

Setting of the Rotation Center

The center of rotation can be specified when rotating a software sprite. The center of the software sprite is the default center of rotation.

Vertical/Horizontal Flip

The software sprite can be flipped in the vertical and horizontal directions during display.

Software Sprite Rendering API

The APIs that render software sprites are roughly divided into two categories. One is an API that uses the data organization provided by the library to render. The other is an API that does not use data organization. It directly specifies parameters to functions and arguments to carry out rendering.

Differences in Performance Depending on API Classification

void NNS_G2dDrawSprite( s16 px, s16 py, int pz, 
                        int sx, int sy, 
                        int U0, int V0, int U1, int V1 );
The API that specifies parameters and then carries out rendering is a simple function that sets up the UV value and renders the square polygons.
It operates quickly, but the appropriate settings for the 3D graphics engine must be configured.

void NNS_G2dDrawSpriteSimple  ( const NNSG2dSimpleSprite* pS );
void NNS_G2dDrawSpriteBasic   ( const NNSG2dBasicSprite* pB );
void NNS_G2dDrawSpriteExtended( const NNSG2dExtendedSprite* pE );
The API that carries out rendering using the library data organization executes the various settings of the 3D graphics engine in the function.
It is easy to use, but has a higher processing load in comparison to the API that directly designates parameters.

Comparing the sample demos, the API that specifies parameters directly runs approximately 40% faster than one that renders using data structures.
Using this API is recommended when your game involves rendering large sprites.

Software Sprite Data Organization

Software Sprite Data Organization

Type Possible Features Application Example
Simple Sprite Sprite position, rotation around Z-axis, priority, and alpha blend. Rendering of particles and other items where the texture is the same and only the position and size of the sprite are different.
Basic Sprite All features of Simple Sprite, texture specification, color modulation. Rendering of standard sprites.
Extended Sprite All features of Basic Sprite, UV value setting, rotation center setting, vertical/horizontal flip. Rendering of sprites with effects such as UV animation.

Three formats of software sprites are available based on the number of parameters that can be specified.
All software sprites are processed internally as Extended Sprites.
With Simple Sprites and Basic Sprites, default values are used for the features that cannot be specified, which reduces their calculation cost.
The default values can be changed by a separate API.

See Also

None.

Revision History

2008/06/20 Updated to include TWL.
2007/11/26 Added description for alpha values.
2004/12/06 Initial version.


CONFIDENTIAL