jjroland opened this issue on May 08, 2007 · 212 posts
bagginsbill posted Thu, 12 March 2009 at 9:12 AM
You could, but the Apollo shaders don't implement GC, or not correctly anyway.
The issue with GC reflections is that the non-GC version doesn't produce the right colors.
Let's stick to grayscale for this discussion, so I don't have to deal with RGB triples. The math is the same, just done 3 times, once for each color channel.
Suppose we consider two points on the cornea. One point has the pupil behind it and another has the iris behind it. Suppose the pupil is black (0) and the iris is reflecting (without/ GC, i.e. linear value) mid-gray (.5).
Suppose further that there is a reflection of a window and the brightness there, with GC, is .5.
And suppose that the Fresnel effect says the reflection coefficient here is .2.
Let:
Fe = Fresnel Effect reflection coefficient
Dc = Diffuse color (linear) after illumination is taken into account
Rc = Reflection color after illumination is taken into account (the gamma corrected color of some other object in the scene)
G = Gamma correction factor (usually 2.2)
The general formula for linear reflection + diffuse is:
(1 - Fe) * Dc + Fe * Rc
And the gamma correcting formula is:
((1 - Fe) * Dc + Fe * (Rc ^ G)) ^ (1 / G)
So, the pupil section of the cornea would be according to the Apollo (linear) shader would be:
.8 * 0 + .2 * .5 = .1
while the GC shader version would be:
(.8 * 0 + .2 * (.5 ^ 2.2)) ^ ( 1 / 2.2) = .24
The Apollo shader would produce a much lower and inaccurate reflection.
Now let's consider the iris section. The Apollo (linear) shader would be:
.8 * .5 + .2 * .5 = .5
while the GC shader would produce
(.8 * .5 + .2 * (.5 ^ 2.2)) ^ ( 1 / 2.2) = .69
And again we see the Apollo shader does not mix the reflection with the diffuse correctly.
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)