Juda texture/en

From KlayGE
Jump to: navigation, search

Juda Texture is the virtual texture technique in KlayGE. The name "juda" is from a Chinese word means "huge".


  • Maximum size: 1Mx1M
  • Texture format: ARGB8, ABGR8, GR8, R8


Terrain rendering

The terrain data can be stored into a Juda Texture directly. In runtime, the data is streamed into GPU on demand. Both terrain editing and rendering take advantages of Juda Texture.

Texture packing

All textures of a game can be packed into one single Juda Texture. And it's transparent to the loading process.


A Juda Texture is presented by a quad-tree. Each node of the tree stores a data block. When an image is committed to a Juda Texture, it's divided into many blocks with a same size. At first, these blocks are stored into the leaf nodes. Then the upper level nodes are updated to the downsampled data. And the leaf nodes just maintain the residuals between the raw data and upper level's. If the residual sum of a sub-tree is lower than some threshold, the sub-tree is cut. This process keeps going on until the whole tree is updated. Finally, the data block of each node is compressed by LZMA algorithm, which is a loss-less compression. At runtime, when a block is required, Juda Texture locates the path between root and that node. The data is decompress and accumulate into a texture cache. In shader, there is a indirect index table for accessing the texture cache and fetching the image data.



JudaTexPacker packs several textures into a Juda Texture file. The layout of the original textures inside the Juda Texture is described by a JTML script.


You can use JudaTexViewer to open a Juda Texture.

Future works

  • More compression rate
  • Visual editing tool
  • Support HDR format