Color displays as black if Horizon color is too low #1

Open
opened 2021-06-24 21:34:45 +02:00 by ABelliqueux · 1 comment
ABelliqueux commented 2021-06-24 21:34:45 +02:00 (Migrated from github.com)

If Far color / Horizon color is < 100 (0.10 in blender), the corresponding channel color will display as black.

Example level0.c file :

CVECTOR level0_BGc = { 100, 218, 216, 0 };

results in :
2021-06-24-211924_682x505_scrot

CVECTOR level0_BGc = { 0, 218, 216, 0 };

2021-06-24-211901_685x506_scrot

Might be an error in the linear to RGB conversion function.

Also could be due to psyq dpq calculation. See LibRef47.pdf, p.450 and LibOver47.pdf, p.133, "Light Source Calculation" :

LLM == Local Light Matrix
LLV  == Local light vector
LC    == Local Color
BK   == Back Color
FC   == Far Color
p     == interpolation coefficient

LLV = LLM * v0
LC = BK + LCM * LLV
v2 = (1 - p) * v1 * LC + p * FC

v0 -> vx, vy, vz
vl -> r, g, b
p
NormalColorDpq(): v2 -> r, g, b
If Far color / Horizon color is < 100 (0.10 in blender), the corresponding channel color will display as black. Example `level0.c` file : ```c CVECTOR level0_BGc = { 100, 218, 216, 0 }; ``` results in : ![2021-06-24-211924_682x505_scrot](https://user-images.githubusercontent.com/1405255/123320326-e199d100-d531-11eb-952e-0fa1b5cf9494.png) ```c CVECTOR level0_BGc = { 0, 218, 216, 0 }; ``` ![2021-06-24-211901_685x506_scrot](https://user-images.githubusercontent.com/1405255/123320333-e2cafe00-d531-11eb-8806-1f0bb69bc74b.png) Might be an error in the [linear to RGB](https://github.com/ABelliqueux/blender_io_export_psx_mesh/blob/c3522939f5e8d36d7e4122a125a8cb22d8f9f6cb/io_export_psx_tmesh.py#L596) conversion function. Also could be due to psyq dpq calculation. See [LibRef47.pdf](http://psx.arthus.net/sdk/Psy-Q/DOCS/LibRef47.pdf), p.450 and [LibOver47.pdf](http://psx.arthus.net/sdk/Psy-Q/DOCS/LibOver47.pdf), p.133, "Light Source Calculation" : ``` LLM == Local Light Matrix LLV == Local light vector LC == Local Color BK == Back Color FC == Far Color p == interpolation coefficient LLV = LLM * v0 LC = BK + LCM * LLV v2 = (1 - p) * v1 * LC + p * FC v0 -> vx, vy, vz vl -> r, g, b p NormalColorDpq(): v2 -> r, g, b ```
ABelliqueux commented 2021-07-03 12:05:28 +02:00 (Migrated from github.com)

BG and BK colors now haw a minimal value of 63 : 67d9d3a9ba

This + 800be60cb6 should make for more comparable colors.

BG and BK colors now haw a minimal value of 63 : https://github.com/ABelliqueux/blender_io_export_psx_mesh/commit/67d9d3a9bac41805604265a2c08b99299946da4c This + https://github.com/ABelliqueux/3dcam-headers/commit/800be60cb685d8bf8caba2cb88d2d47c281ecbe2 should make for more comparable colors.
Sign in to join this conversation.
No description provided.