Click or drag to resize
DigitalRuneMiscellaneous
Helper classes

The EffectHelper provides extensions methods for effects and related types.

The GraphicsHelper provides various helper methods, extension methods, as well as new blend and depth-stencil states.

The MeshHelper provides helper methods and extensions methods for working with meshes, submeshes, and materials.

The NoiseHelper provides noise textures, such as grain or Perlin noise.

The PostProcessHelper provides a few reusable standard filters.

The SceneHelper provides extensions methods for scene nodes.

The TextureHelper provides reusable default textures and helper methods for working with textures.

Render target pool

Intermediate render targets for deferred rendering, shadow maps, post-processing, etc. can be obtained from the RenderTargetPool. The render target pool manages a set of reusable render targets. Render targets can be obtained by calling Obtain2D/ObtainCube and specifying a certain RenderTargetFormat. When a render target is no longer needed it should be returned to the render target pool by calling Recycle.

The render target pool has a Clear method. This method removes all cached render targets. It is recommended to call this method manually if the viewport size of the game changes. This method can also be called when the game needs to clean up resources, e.g. when a new level is loaded.

Texture atlases, tile sets and 2D animations

A texture atlas is a large image containing a collection of textures. Texture atlases are used because it is often more efficient to pack multiple textures into a texture atlas which can be treated as a single unit by the graphics hardware. Textures of different size can be packed together.

A tile set is similar to a texture atlas: A tile set is a collection of images (called "sprites" or "tiles"). All tiles have the same size and are packed as a regular grid.

A tile set can be used for 2D animations ("flipbook animations", "sprite sheet animations"): The tile set contains a sequence of images (animation frames). Cycling through the images in rapid succession creates the illusion of movement.

When a tile set is used for animation, the top-left tile contains the first animation frame, the second tile in the upper row contains the second animation frame, and so on. The bottom-right tile contains the last animation frame.

Important note Important

Most renderers require that the animation frames are tightly packed and the tile set does not contain empty tiles. For example, an animation consisting of 3 frames can be packed as a 1x3 or 3x1 tile set, but not as 2x2!

Note that the two concepts, texture atlases and tile sets, can be combined: A texture atlases may contain a texture which may contain a tile set. At runtime the PackedTexture represents a texture, a tile set, a texture within a texture atlas, or a tile set within a texture atlas.

The PackedTexture is used by Billboards and ParticleSystems.

Models may use texture atlases, however they do not require the PackedTextures class at runtime. (It makes no difference whether a model texture is a regular texture or a texture atlas. DigitalRune Graphics assumes that any UV coordinate changes are already baked into the model, or that the associated DirectX Effects handle the UV coordinate changes automatically.)

Note Note

Currently there is no support for packing texture atlases and loading packed textures via the XNA content pipeline. Texture atlases can be created using third-party tools, PackedTextures need to be created manually at runtime.

A texture packer including XNA content pipeline support will be added in a future release of DigitalRune Graphics.