Skip to content

Commit

Permalink
doc: Add tee_rendering.md describing how to render a tee
Browse files Browse the repository at this point in the history
  • Loading branch information
Patiga authored and heinrich5991 committed Aug 30, 2023
1 parent 2f48785 commit e5f90fc
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions doc/tee_rendering.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
This document describes how to render a tee like Teeworlds 0.6 or DDNet, given
a tee skin image.

A skin image must have an aspect ratio of 2:1 (width:height). We get the
following body parts by splitting the tee skin image (3/8 means at 3/8 of the
image's width, 1/4 means at 1/4 of the image's height, etc.):

body: (0/8, 0/4) to (3/8, 3/4)
body_outline: (3/8, 0/4) to (6/8, 3/4)
hand: (6/8, 0/4) to (7/8, 1/4)
hand_outline: (7/8, 0/4) to (8/8, 1/4)
foot: (6/8, 1/4) to (8/8, 2/4)
foot_outline: (6/8, 2/4) to (8/8, 3/4)
eye_normal: (2/8, 3/4) to (3/8, 4/4)
eye_angry: (3/8, 3/4) to (4/8, 4/4)
eye_pain: (4/8, 3/4) to (5/8, 4/4)
eye_happy: (5/8, 3/4) to (6/8, 4/4)
eye_dead: (6/8, 3/4) to (7/8, 4/4) -- entirely unused
eye_surprise: (7/8, 3/4) to (8/8, 4/4)

This leaves an unused rectangle at `(0/8, 3/4) to (2/8, 4/4)`.

For rendering, the segments need to be scaled like this (relative to body being
100%):

body: 100%
feet: 150%
eyes: 120%
hand: 93.75%

The last eye shape `eye_blink` is achieved by scaling `eye_normal` to 45%, but
only vertically.

Then, the images must be positioned like the following (hands or moving feet
not handled), relative to 64/64 or 1 being the edge length of the body
segment).

body: 4/64 up
feet:
10/64 down
7/64 left/right
eyes:
0.125 up
0.05 left/right

eye movement:
dir = angle of eyes (view angle), right = 0
eyes:
x: cos(dir) * 0.125
y: sin(dir) * 0.1
each eye (away from the other):
x: abs(cos(dir)) * 0.01

0 comments on commit e5f90fc

Please sign in to comment.