23
\$\begingroup\$

I can't find a good reason for this anywhere. The reflection vector used in phong has a simple basis in physics. But the half vector used in blinn seemingly has no rational basis, and does not constitute a proper reflection. And yet it is used in every so-called "physically based" shading function. If there is a good physical basis for it, I'd like to know.

What I've been able to find are a few reasons:

It's faster - there's mixed information on this, but even so it would have been a great reason... in the year 1998.

It handles angles higher than 90 degrees better - as far as I can tell the only reason for this is because the phong term has been used improperly. The dot product of the reflection and the view gives an angle between -1 and +1. Usually this angle is clamped to 0 to 1, this is the direct cause of the 90 degree problem. Re-normalize the angle instead of clamping it and you get the full 180 degree coverage. I refuse to believe a simple x * 0.5 + 0.5 operation has eluded the graphics world for 40 years.

it handles edges better - The edge "problem" also exists in the blinn solution, just to a lesser degree. The main cause is improper simulation of area lighting at the terminator, which should be essential for any "physically based" shader. But even in simpler situations a sigmoid function can approximate a soft terminator line correctly. Multiplying into a lambert term is incorrect as it attenuates the specular term improperly, this could cancel out a fresnel term and lead to further errors.

It has long reflections at the edge - It seems to me that while anisotropic reflections may be realistic, blinn is not the correct way to implement them, as they only appear at the edge. It is merely a happy coincidence that an error in the H term happens to look realistic.

None of these reasons are satisfactory, I want to sort out this madness.

I want to clarify that I am not talking about blinn and phong specifically, but instead about the vector components H and R, which are used as the basis for these shaders as well as others.

\$\endgroup\$

3 Answers 3

25
\$\begingroup\$

For perfectly reflective surfaces Phong-model makes sense. However, where does the n in (R.V)^n of Phong-model for approximating rougher surfaces come from? Where is the theory that you have to raise the result of the dot product to the power except that it just appears to empirically give the proper result?

For Blinn-model there's physically based microfacet theory to support all the components in the equation and there's also empirical evidence that the model approximates real world surfaces more closely (though not perfectly). The half-vector in Blinn model is used as an input to normal distribution function (NDF), which is an approximation how microfacets are distributed about surface normal as the function of the surface roughness. I.e. when H-vector points to the normal direction the value is highest since most microfacets point to that direction, and the probability is decreased accordingly when the angle between normal and H-vector is increased.

Blinn-model isn't perfect by any means though and it doesn't for example take the geometry term of the microfacet model into account (i.e. shadowing and masking of microfacets whose importance increases in grazing angles).

\$\endgroup\$
7
  • \$\begingroup\$ I'm not talking about phong's specific implementation which indeed has no physical basis. But I can't see how microfacet theory supports H better than R as a basis for a reflection vector. No shading model is supported empirically, every single one fails at reproducing real materials as per "Experimental validation of BRDF" addy 2005. It seems to me that the microfacets are modelled in phong via the dot product R·V, which can serve as a basis for a more physically correct highlight either through a remapping function or a ramp. A power function is simply the simplest, most incorrect remapping. \$\endgroup\$
    – BmB
    Aug 26, 2014 at 19:02
  • 2
    \$\begingroup\$ @BmB No, microfacets are not "modelled in phong" but use probability distribution of microfacets defined with the NDF, that's being "sampled" with the H-vector. NDF is generally symmetric about the normal (isotropic/anisotropic) so it makes sense to use H-vector for it. I said there's empirical evidence that Blinn-model more closely approximates real world materials than Phong. \$\endgroup\$
    – JarkkoL
    Aug 26, 2014 at 23:00
  • \$\begingroup\$ Any reflection that does not lie along the reflection vector is not a perfect mirror reflection. The dot product produces a reflectance value for angles that are not perfect. Necessarily, these must be produced by microfacets. The dot product therefore does model microfacets. A simple dot produces a linear distribution. But the distribution can be modelled by any function with R just as well as H. This explains nothing about the validity of H over R. \$\endgroup\$
    – BmB
    Aug 26, 2014 at 23:42
  • 1
    \$\begingroup\$ @BmB I suggest you read about microfacet theory and specifically about the NDF part to understand the concept. That'll help you to get the answer to your question. \$\endgroup\$
    – JarkkoL
    Aug 26, 2014 at 23:50
  • 1
    \$\begingroup\$ You should open a new question about microfacets and NDF because there is obviously a lot you don't understand about these concepts and comments are not the right place to explain them. \$\endgroup\$
    – JarkkoL
    Aug 27, 2014 at 20:48
6
\$\begingroup\$

Actually, I think you yourself listed the reasons why Blinn is the default over Phong.

Each reason you listed there is, in fact, an area where Blinn proves superior to Phong.

Taken as a whole, all of these lead to Blinn being a better default than Phong.

Is Blinn perfect? Is it better than Phong?

No.

But it is a reasonable default. Feel free to substitute Phong for Blinn in any renderer/shader you write.

\$\endgroup\$
1
  • \$\begingroup\$ Agree, this is exactly it. Neither model is perfect. Blinn's approximation was above all a performance optimization back then, since calculating the half angle is way cheaper. Turned out it looks better most of the time, too. \$\endgroup\$
    – Damon
    Aug 27, 2014 at 9:14
-2
\$\begingroup\$

I have discovered the reason for the H vector to be used. Unfortunately it is not the way it is used in most shading models, which can then be concluded to be incorrect.

For physically based shading reflected light must obey the fresnel equations. (Most "physically based" shaders don't) Microfacets must also obey the fresnel equations, which relies on the angle of incidence for the light as well as the index of refraction of the interface to produce a correct result.

According to the law of reflection the angle of incidence must be mirrored with the angle of reflection along the surface normal. For a ray of light to have hit the camera - which we know it did - it must have been reflected from the light - that we know the direction of. Thus the surface normal must by deduction be the mirror axis for these two directions. This gives us the half vector H which is in between them. Calculated by normalizing the sum of both.

Now by calculating the angle between the light direction L and the half vector H we acquire the angle of incidence for the specular reflection of a microfacet, and can correctly attenuate it using the fresnel term.

Note that the view direction is equal to R for that microfacet, H is not a reflection term. Blinn, Cook, Torrance, and Sparrow can suck it. Phong and Fresnel were right.

\$\endgroup\$
4
  • \$\begingroup\$ Fresnel term is part of microfacet BRDF equation and individual microfacet don't take this into account since they are modeled as perfect reflectors. Also you don't calculate angle between L and H vectors but N and H vectors. This should give you a hint why H is being used. You need a bit more knowledge on the topic to conclude who was right or "more right" ;) \$\endgroup\$
    – JarkkoL
    Aug 28, 2014 at 0:27
  • \$\begingroup\$ A microfacet of a material has the same properties as the material. Therefore a microfacet of an imperfect reflector cannot itself be a perfect reflector. Your logic is unsound and unhelpful. N dot H has no physical significance. \$\endgroup\$
    – BmB
    Aug 28, 2014 at 1:55
  • 4
    \$\begingroup\$ No, that's not how microfacet model works. My logic is perfectly sound as anyone who understands even the basics of microfacet model can confirm. Each microfacet is perfect reflector (i.e. optically flat) and imperfect reflection of a material comes from the variance of microfacet normals as defined by NDF. Your persistence to defy perfectly valid advices is kind of amusing ;) \$\endgroup\$
    – JarkkoL
    Aug 28, 2014 at 2:31
  • \$\begingroup\$ You have given no advice, all you have done is persist in asserting you are right with nothing to back it up and throwing insults. H is the normal of a microfacet, not the reflection. The reflection can be calculated with the normal. Basic physics disagrees with you. \$\endgroup\$
    – BmB
    Aug 28, 2014 at 21:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .