Some docs I wrote for myself
- Code: Select all
// step 1.5 hw (ie scud) only uses values of 0-127 (like the sdk)
// so the code should read something like
// float shade = (ix&0xFF)/127.f;
// Using this the castle is perfectly shaded in scud. But other parts are too dark.
// step 2.0+ h/w uses -128 -> +127. -128 maps to 0, and 127 maps to 1
// There is some offset value which is added to the fixed shaded value that increases it's brightness
// Scud uses it. In some cases you can see it pushes the value to like 1.5 so the textures are 50% overbright. Advanced course start.
// Dirtdevils is also missing this offset value. But I can't find where it is.
// Could be in the poly header, or in the viewport data maybe. Or possibly colour table ..
Anyway here are some debug images
I noticed with our current code the castle section is totally washed out. It should be much darker, with more contrast with the shaded areas.
All the non texture parts are using fixed shading (including the sky)
This is with the polygon colours, no other shading

Fixed shaded values
(using 0-127) not -128 to 127

Fixed shaded values multiplied by the poly colours

The castle section looks correct. The sky which is using a different viewport is way too dark. Colours seem too dark, fixed shaded values also seem too dark. Multiplied together they are even darker.
I think there is some per viewport offset added to the fixed shaded value.
The parts in scud need an offset of 1 added to look correct.
In dirtdevils the fixed shaded parts under the bridge need 0.5 to look correct.