Support for UDIM textures and tiled images
Open, NormalPublic

Description

This is the design task for supporting tiled images (and therefore UDIM textures) in Blender.

Basics

Essentially, a tiled image consists of multiple files, where each file covers one unit square in the UV space.
Currently, the layout is hardcoded to ten tiles per row which is the standard for UDIM textures.

UDIM refers to a naming scheme for these tiles - tile (x, y) is assigned the number 1001 + 10*y + x. Most of Blender doesn't need to care about this, it's only really relevant for loading/saving files and displaying them in the UI.

Implementation

Fundamentally, tiled textures are similar to image sequences - they consist of a number of image files and buffers. Therefore, the core implementation is handled like image sequences which allows to reuse the existing image cache. This is done by adding a new source type, IMA_SRC_TILED, which specifies that the image consists of multiple tiles.

The ImageUser now contains a tile index that is used when acquiring the ImBuf, and the Image contains the number of tiles.

Tasks

Generally, the remaining work is to update all the areas that access images in Blender and handle the tiles correctly. These areas can be roughly split into "using images" and "editing images" - for example, support in the Viewport, Eevee and Cycles are essential for using tiles textures, while support in texture painting and baking is only needed for editing and/or creating them.

Since the main motivation for UDIM support is the ability to use textures generated with external tools, the "using images" part has priority.

ToDos

Basics
Image Editor
  • Showing all tiles in the Image Editor (rB89c0dc4ebdb8)
  • Supporting Image Editor operators like color sampling (rB5c62468e4b39)
  • Labeling/Naming tiles (rB4875f41ea6da)
  • Optionally showing a tile grid even without a loaded image for laying out UVs
  • Texture painting support (rBcc4defac041f)
  • Maybe support drawing across tile borders
  • Better UI
3D texture painting
  • Support for drawing on tiled images (rBbc05599bd0c4)
  • Maybe support drawing across tile borders
Cycles
  • Support tiled images as Cycles textures in SVM mode (rB62550b490ac6)
  • Support tiled images as Cycles textures in OSL mode
  • Support baking to tiled images
Eevee
Known bugs
  • Occasional crashes in the painting undo code (only in release builds, debug builds are stable)
  • Wrong painting radius when painting on tiles with different size and/or aspect ratio
More coming

Details

Type
Design

Sounds good to me, I don't have any objections to the design.