Skip to content
Benedikt S. Vogler edited this page Nov 18, 2017 · 4 revisions

This article is an abridgement of my bachelor thesis (German). Sorting the sprites is non-trivial task with 3 dimensions. I recommend topological sort or dual depth peeling depending on the hardware or your game. CPU and gnu based algorithms can be combined but this is not recommended as this used more resources without an improvement of the image.

CPU based

The cpu based algorithms use the painter's algorithm. Set the used algorithm with cvar depthsorter <int>.

  1. no sort
  2. Topological Sort
  3. Sort by Depth value

GPU based

Set with cvar depthbuffer <int>.

  1. no depth buffer
  2. Depth Buffer
  3. Depth Peeling (currently only two layers work)

The result of the depth peeling can be improved by uploading a depth map to the GPU. This extension is not yet implemented in the engine. For speed improvement the content of the spritebatch is used twice. If the sprite batch is flushed during the frame only the last part will be rendered. Deactive this speed improvement or use another algorithm.

Clone this wiki locally