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.