# [WIP] Digital Being - Texture v1

In this document, we make the high-level pitch of *Digital Being Anatomy v1* (https://blog.sprited.ai/digital-being-anatomy-v1) concrete by translating it into an implementable system.

We define the core data representations, encoding schemes, and rendering pipeline required to construct a digital being from first principles.

**Requirements**: At high level, we need to be able to construct visually convincing image of character given set of textures that describe the internals of the character.

**Constraints**: Initially the character starts as a single pixel and eventually becomes a fully humanoid character only using local rules within shader.

**The Atlas**: The atlas is 128x128 texture maps that describe the character. It contains 64 patches of the character. Each patch defines one part of character.

**Patch Naming Scheme**: Patch 0 is the first top left 16x16 patch. Patch 1 is the one below. Patch 8 is the one to the right of Patch 0.

**Reserved cells in Patches**: To make centering easier, we reserve 0-th row and 0th-column for something else in the future. All growth happens within the grid except those spots. For example, center of 16x16 is going to be 8th row and 8th column.

**Patch 0**: First patch is reserved for metadata, and isn't used in v1.

**Patch 1**: Contains the Head cells. In particular, it will contain a vertical line segment where each cell in the line contains thickness value. For simplicity, we user 4x4 patch in this document.

```plaintext
SOCKET_ID (uint 5bit)
       0      1      2      3 
 0 |      |      |      |      |
 1 |      |      |      |      |
 2 |      |      |    1 |      |
 3 |      |      |      |      |

SOCKET_Z (float)
       0      1      2      3 
 0 |      |      |      |      |
 1 |      |      |      |      |
 2 |      |      |  5.0 |      |   // +5.0 z-direction
 3 |      |      |      |      |

SOCKET_DZ (float)
       0      1      2      3 
 0 |      |      |      |      |
 1 |      |      |      |      |
 2 |      |      |  0.6 |      |
 3 |      |      |      |      |

CELL TYPE (uint 3bit)
       0      1      2      3 
 0 |      |      |      |      |
 1 |      |      | CENT |      |   // i.e. CENTROID
 2 |      |      | CENT |      |
 3 |      |      |      |      |

DIR (uint 5bit)
       0      1      2      3 
 0 |      |      |      |      |
 1 |      |      |   ↑  |      |
 2 |      |      |   ↑  |      |
 3 |      |      |      |      |

DISPLACEMENT (f16)
       0      1      2      3 
 0 |      |      |      |      |
 1 |      |      | 0.00 |      |
 2 |      |      | 0.10 |      |
 3 |      |      |      |      |

THICKNESS (f16)
       0      1      2      3 
 0 |      |      |      |      |
 1 |      |      | 1.50 |      |
 2 |      |      | 1.40 |      |
 3 |      |      |      |      |
```

*   Cell Type layer describes type of cell for each slot.
    
*   Direction layer will keep the current direction of the cell.
    
*   Depth layer will tracks how much does the CENTROID cell is depressed away from the camera.
    
*   THICKNESS layer defines how much thickness we should render in pixels.
    
*   SOCKET layers give the 3D location of the socket position.
    

REVISION: Instead of maintaining separate layer for sockets. We create a LAYOUT patch which keeps track of SOCKETs.

\-- Sprited Dev 🐛
