Add pixel STP infos

This commit is contained in:
ABelliqueux 2021-07-24 11:39:38 +02:00
parent 7f1cf83a13
commit 2d31f940e6

View File

@ -15,6 +15,32 @@ Mode can be :
See [FileFormat47.pdf](http://psx.arthus.net/sdk/Psy-Q/DOCS/FileFormat47.pdf), p.179 See [FileFormat47.pdf](http://psx.arthus.net/sdk/Psy-Q/DOCS/FileFormat47.pdf), p.179
# Transparency
In 16bpp mode, only 15b are used for colors (R 5, G 5, B 5). The 15th bit is defined as the STP or Semi-Transparency flag.
A primitive transparency is set with `SetSemiTrans()`. The only case where a primitive with unset (=0) STP is transparent is when all values are 0.
i.e ; using STP 0, B 0, G 0, R 0 will result in a transparent pixel wether the primitive is set to semi-tranparent or not.
Here are the transparency modes for various values on semi-transparent and opaque primitives :
| STP, B, G, R | (0, 0, 0, 0) | (1, 0, 0, 0) | (0, n, n, n) | (1, n, n, n) |
| :-: | :-: | :-: | :-: | :-: |
| Non-transparent primitive | Transparent | Black | Non-transparent | Non-transparent |
| Semi-transparent primitive | Transparent | Semi-transparent | Non-transparent black | Semi-transparent |
See [FileFormat47.pdf](http://psx.arthus.net/sdk/Psy-Q/DOCS/FileFormat47.pdf), p.56, p.192,
[FileFormat47.pdf](http://psx.arthus.net/sdk/Psy-Q/DOCS/LibOver47.pdf), p.107
## img2tim semi-transparency options
`img2tim` has several options related to pixel transparency :
* -t - Set semi-transparent bit (STP) on non fully black pixels. This will set the STP to 1 on pixels with RGB values different from B0,G0,R0.
* -usealpha - Use alpha channel (if available) as transparency mask. This will use the converted image's alpha channel (PNG, TGA, TIFF, GIF)
* -alpt <value> - Threshold value when alpha channel is used as transparency mask (Default: 127). Transparency values above this wil be treated as opaque.
* -tindex <col> - Specify color index to be treated as transparent (ignored on non palletized images). When using 4bpp/8bpp, specified color to be used as transparent.
* -tcol <r g b> - Specify RGB color value to be treated as transparent. Same as above for 16bpp.
# Tools # Tools
You can use open source tools : Gimp, Aseprite You can use open source tools : Gimp, Aseprite
@ -63,7 +89,7 @@ convert input.png -colors 16 output.png
convert input.png -colors 256 output.png convert input.png -colors 256 output.png
``` ```
## ## PNG > Tim
```bash ```bash
img2tim -bpp 4 -org 512 0 -plt 0 481 -usealpha -o TIM4.tim TIM4.png img2tim -bpp 4 -org 512 0 -plt 0 481 -usealpha -o TIM4.tim TIM4.png