Ian wrote:How come you needed to do this?
- Code: Select all
+ biasIndex = vec4(0.95, 0.95, 1.05, 1.0);
+ exponent = expIndex[int(shininess)] / biasIndex[int(shininess)];
That based on video observation? It wouldn't surprise me if the weighting of colors on videos were off .. so I'd be quite surprised if you needed that.
Yes, it's based on observation. However, when comparing with direct video captures I mostly match them with Supermodel using Virtual Dub. Nothing fancy: gamma curves, color temperature, etc. When done properly you're able to notice even the smallest difference.
Some explanation is needed:
expIndex coefficient affects the sharpness and the diameter of the highlight spot (as the usual standard highlight formulae),
multIndex the overall brightness / scale of the highlight. The latter is an addition on mine because the exponent alone is not sufficiently bright, even if its shape is correct. That's why I'm speculating that the Real3D uses look-up tables because, unless I missed something obvious, I can't find a simple formula.
Still I needed a last little adjustment. With
biasIndex I can lower the brightness while incrementing the sharpness of the highlight, and vice versa. This was necessary to preserve the semplicity of the first two terms:
- Code: Select all
expIndex = vec4(8.0, 16.0, 32.0, 64.0);
multIndex = vec4(2.0, 2.0, 3.0, 4.0);
Compared with my previous solution, without said bias and with not so obvious
multIndex values :
- Code: Select all
expIndex = vec4(8.0, 16.0, 32.0, 64.0);
multIndex = vec4(2.25, 1.85, 3.5, 5.6);
The good thing is that those values seem to produce in all games consistent results with the observed footage. There're still some very little quirks, but I wait for the proper quad poly emulation. Even changing, for example, the "Y" term of the
biasIndex from 0.95 to 1.0, will overbright the cars in Scud and the car shading (especially the transparent glasses) in Daytona 2.
Ian wrote:Also surely this clamp is not needed?
- Code: Select all
specularFactor = min(specularFactor, 1.0);
If you are clamping here too
- Code: Select all
+ // Final clamp: we need it for proper shading in dimmed light and dark ambients
+ finalData.rgb = min(finalData.rgb, vec3(1.0));
At first
specularFactor was clamped only for transparent polys, that was a safety measure to avoid alpha > "1", not sure what it could have break, but I left there because doesn't seem to hurt. On a second thought I choose to use it for all cases anyway.
finalData.rgb instead clamps only the color components not alpha.
So in the end I think we can remove it and change
finalData.rgb to cover all 4 channels (rgb + alpha). I'll try that on Scud and Daytona 2 and let you know.
