I changed the normal conversion code (as well as the code for fixed shading) to this
- Code: Select all
#define BYTE_TO_FLOAT(B) ((2.0f * (B) + 1.0f) * (1.0F/255.0f))
- Code: Select all
// Per vertex normals
if (ph.SmoothShading()) {
p.v[j].normal[0] = BYTE_TO_FLOAT((INT8)(ix & 0xFF));
p.v[j].normal[1] = BYTE_TO_FLOAT((INT8)(iy & 0xFF));
p.v[j].normal[2] = BYTE_TO_FLOAT((INT8)(iz & 0xFF));
}
from
- Code: Select all
p.v[j].normal[0] = (INT8)(ix & 0xFF) / 128.f;
You can see for positive numbers this will effect the length of the normal.
Before for 127 / 128 = 0.99
Now
((127 * 2) + 1 ) / 255 = 1.0
It's only a 1% change, but didn't know if this would effect specular at all?
Maybe the bias you added might not be needed anymore?