The Defold Dictionary

It was suggested on Discord that we should collaboratively start working on a dictionary of commonly occurring words in the Defold manuals and in technical documentation on game engines in general. Words such as mipmaps, render target and view projection should be explained. The purpose of this forum thread is to collect the words and their definitions. Later on the contents will be moved to a separate page in the Defold Learn section on the website.

List of words that require a definition (please suggest more):

  • Mipmaps
  • Render target
  • View projection
  • Texture

Below you will find a first attempt at defining Mipmaps and Render Target. Please suggest improvements!

Mipmaps
Mipmaps are pre-calculated, optimized sequences of images, each of which is a progressively lower resolution representation of the previous. Mipmaps are useful primarily in 3D games where they can help reduce aliasing artifacts and increase rendering speed when images are drawn at different distances to the camera. These improvements come at a cost of a 33% increase in texture size.

Defintion on Wikipedia: Mipmap - Wikipedia

In Defold mipmaps are enabled by default when building your game with texture compression enabled. Mipmaps can be disabled by unchecking the Mipmaps checkbox in the texture profile.

Render target
When your game is rendered (drawn to the screen) it is done according to the steps defined in your render script. The default render script starts by clearing the screen using a single color, next it renders sprites, tilemaps, particle effects and other visual components and in a final step it renders the gui on top of everything else. Everything is drawn to a screen buffer and at the end of the frame (or at the start of the next) the contents of the screen buffer is drawn to the screen.

A render target can act as an alternative buffer to which you can draw things,. When a render target is enabled (using a command in your render script) any subsequent draw call will be directed to the render target instead of to the screen buffer. This in itself is not very useful. The power comes from the fact that the contents of a render target can be used when drawing something else.

One very common use for render targets is post processing effects such as blur, color grading or CRT effects. The entire game is first drawn to a render target and in a second step the render target is drawn to the screen while some kind of calculation is performed to each of the pixels (using a shader program) to apply the post processing effect.

23 Likes

This is a great idea and should be followed by changes to the documentation and manuals! :smiley:

Also some additions from my site:

Mipmaps
This image from LearnOpenGL - Textures explains to me visually what mipmaps are:
image
For objects far away from the player/camera, we don’t need to set high resolution textures as this is time and memory consuming and hard for shaders to specify a proper color for our screens. Thus an idea of mipmaps was introduced - where higher definition image is duplicated in half of the resolution and so on, and so on. As mentioned above, Defold is taking care of optimizing the textures with mipmaps by default or with our changes to the profile. There are few levels of optimization/compression. The naming was changed in 1.2.185 and current levels are:

LEVEL Note
FAST Fastest compression. Low image quality
NORMAL Default compression. Best image quality
HIGH Slowest compression. Smaller file size
BEST Slow compression. Smallest file size

You should do your tests of course, but here is also a comment section in the source code of Defold engine (introduced in 1.2.185)

// FAST - low amount of compression, quality is almost exactly the same quality as uncompressed
// NORMAL - medium amount of compression, slight change in image quality
// HIGH - high compression ratio but visible reduction in quality
// BEST - maximum compression ratio and visible compression artifacts

8 Likes