Talk:Blinn–Phong reflection model
This article is rated Stub-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||
|
Need an image
[edit]We need an image to illustrate the situation here. Anyone? --cslarsen 11:03, 5 May 2006 (UTC)
- I believe there is an error in the image caption. The rightmost image is supposed to approximate the phong model by modifying the specular power and thus making the highlight smaller (as blinn-phong tends to make larger highlights for the same specular power than phong). But surely we would have to *raise* the exponent to make the highlight smaller, not lower it as the caption suggests. Jtsiomb 14:13, 24 January 2007 (UTC)
- I agree. What is the proper procedure in this case? We cannot change the caption since it is part of the picture. Should we add a correcting phrase to the text of the article.--130.133.8.114 (talk) 13:13, 20 May 2010 (UTC) Günter Rote
No sure it's default in OGL or D3D
[edit]For D3D I don't know but. To what I know it's only Gouraud in OpenGL as default.
- Gourad shading is an interpolation model while the Blinn–Phong shading model is a shading model, or an illumination model (see List of common shading algorithms); those are two completely separate things. According to OpgenGL Programming Guide — Seventh edition, OpenGL uses the Blinn–Phong shading model. This is not explicitly expressed, though, but the book describes the formula OpenGL uses, which exactly matches that of the Blinn–Phong model. It may be that Gourad shading is the default interpolation model, of that I do not know. —Kri (talk) 13:10, 9 July 2013 (UTC)
Default in OpenGL?
[edit]Someone reverted this paragraph: "Blinn-Phong is the default shading model used in OpenGL, and is carried out on each vertex as it passes down the graphics pipeline; pixel values between vertices are interpolated by Gouraud shading by default, rather than the more expensive Phong shading." with the comment "rm paragraph: speaking about a 'per-vertex phong shading' is rather strange to me".
I don't know if the original statement was true, but it makes perfect sense. While Phong shading is a per-pixel shading with normal interpolation, the Phong reflection model or the alternative Blinn–Phong shading model, though called differently, can be used at vertices and interpolated with Gouraud shading.
I'm going to revert the deletion. If someone knows for sure that it's true or not, please comment.
Dicklyon 16:13, 29 June 2006 (UTC)
- It was correct. Doing actual normal-interpolation takes a lot of extra calculation and gives only a little benefit. The traditional way to get around this is to increase tesselation, but nowadays you can write a fragment shader that does it. (I'm still wondering if we could have a normal-interpolation feature added to GLSL that could in hardware interpolate two normals with a quadratic approximation to the normalization, instead of having to take a square root at every step....) - Rainwarrior 05:07, 30 June 2006 (UTC)
- Indeed, an approximate normalization of the interpolated normal is a lot quicker than a reciprocal square root. But then the high power of the dot product multiplies the normalization error up by a big factor, so you really need a different (and quicker) formulation of the reflection model to get a net win. Right? Maybe like this [1]? Dicklyon 05:28, 30 June 2006 (UTC)
- That's true, any errors would be worsened by high specular exponents... it's just something I've had in the back of my mind for a while, I haven't tried out any experiments of my own yet. I was more wondering if an automatic normal approximation might ever be built into GLSL, i.e. instead of just the varying type, have a normalized_varying type or something where interpolates them as normals doing an approximation in hardware somehow. I suppose there are already extensions that use a cube map to approximate normalization though. I should try some of these out. - Rainwarrior 06:17, 30 June 2006 (UTC)
- The sensitivity to normalization errors comes from using the dot product as a proxy for the angle. If you use the squared magnitude of a vector difference instead (approx sin^2 instead of cos), then the error due to normalization when you compute a smaller specular reflection is much less. Making an approximate Phong-like or Blinn-like or Gaussian-like specularity out of the sin^2 is easy. It's all published in an obscure Apple tech report and a patent. Let me know if you'd like a copy. Dicklyon 15:06, 30 June 2006 (UTC)
- Find the "Lyon-Phong" variant via my new home page [2]. Dicklyon 20:37, 1 July 2006 (UTC)
- Thanks! - Rainwarrior 20:50, 1 July 2006 (UTC)
Rename
[edit]Since we make a distinction between Phong shading model and Phong reflection model, shouldn't we be consistent about this and move this page to Blinn-Phong reflection model? - Rainwarrior 18:48, 7 August 2006 (UTC)
- That's absolutely true - Blinn-Phong has nothing to do with shading! 2007-08-24 —Preceding unsigned comment added by 129.187.100.191 (talk) 13:36, August 24, 2007 (UTC)
- No, it's not absolutely true. The only reason to prefer this as a reflection model is that it makes a more efficient shading algorithm than a better model does. Dicklyon 01:49, 28 August 2007 (UTC)
- Efficiency is not the only reason, and not even a reason at all for the non directional-light case. Blinn-Phong is superior to Phong as it has a theoretical basis in microfacet theory and actually approximates real world phenomena, whereas Phong has no physical basis and is an empirical model built upon gut feelings that produces unrealistic results. 115.70.207.78 (talk) 03:04, 5 April 2016 (UTC)
- Sound good. Source for that? Dicklyon (talk) 03:17, 5 April 2016 (UTC)
- Efficiency is not the only reason, and not even a reason at all for the non directional-light case. Blinn-Phong is superior to Phong as it has a theoretical basis in microfacet theory and actually approximates real world phenomena, whereas Phong has no physical basis and is an empirical model built upon gut feelings that produces unrealistic results. 115.70.207.78 (talk) 03:04, 5 April 2016 (UTC)
- No, it's not absolutely true. The only reason to prefer this as a reflection model is that it makes a more efficient shading algorithm than a better model does. Dicklyon 01:49, 28 August 2007 (UTC)
- In terms of usual terminology in books, "Blinn–Phong shading" seems to be much more common than "Blinn–Phong reflection" in books. Dicklyon 15:31, 28 August 2007 (UTC)
- Well I think the term "shading model" is used a bit more liberally outside of Wikipedia (especially nowadays with programmable "shaders"). I was referring to the distinction we are making in our two Phong articles, where we seem to be trying to differentiate the two terms. As we are using them in the Phong articles, Blinn-Phong is a "reflection model" which uses the Phong "shading model" of an interpolated normal. To call it a shading model without explaining that we are being looser with the term here than in the other articles is probably confusing for someone who is trying to learn these things. I'm not saying we should remove the term "Blinn-Phong shading model"--it's best if the terms we use reflect real-world usage--but we shouldn't be using the term in two different ways without explaining it. It might actually be more worthwhile to merge the two Phong articles and explain that there are two different things but loosen up the terminology (i.e. point out that the reflection model may go by either name), rather than try to justify the ambiguity in this article. - Rainwarrior 06:36, 29 August 2007 (UTC)
- I agree that the better solution would probably be to merge the Phong articles so that both aspects of it can be discussed in one place. Dicklyon 17:59, 29 August 2007 (UTC)
- Well I think the term "shading model" is used a bit more liberally outside of Wikipedia (especially nowadays with programmable "shaders"). I was referring to the distinction we are making in our two Phong articles, where we seem to be trying to differentiate the two terms. As we are using them in the Phong articles, Blinn-Phong is a "reflection model" which uses the Phong "shading model" of an interpolated normal. To call it a shading model without explaining that we are being looser with the term here than in the other articles is probably confusing for someone who is trying to learn these things. I'm not saying we should remove the term "Blinn-Phong shading model"--it's best if the terms we use reflect real-world usage--but we shouldn't be using the term in two different ways without explaining it. It might actually be more worthwhile to merge the two Phong articles and explain that there are two different things but loosen up the terminology (i.e. point out that the reflection model may go by either name), rather than try to justify the ambiguity in this article. - Rainwarrior 06:36, 29 August 2007 (UTC)
- In terms of usual terminology in books, "Blinn–Phong shading" seems to be much more common than "Blinn–Phong reflection" in books. Dicklyon 15:31, 28 August 2007 (UTC)
Efficiency explanation
[edit]Jtsiomb added an explanation, but I'm not sure I get it. It seems to rely on L and V being constant across a face, but that would only be true of the light and viewpoint were infinitely distant, no? Also, the language about how it might "seem absurd" is not appropriately encyclopedic. Seems like a rewrite is in order. Dicklyon 03:55, 24 January 2007 (UTC)
- You are absolutely correct. I didn't realize while writing it, that I was implicitly assuming the light and viewer to be treated as infinitely distant. I edited it to explicitly state that assumption. Also as far as the language goes, I'm afraid I'm not a native english speaker, and I didn't think the "seem absurd" would be inappropriate. I fixed that too.Jtsiomb 10:37, 24 January 2007 (UTC)
The section on efficiency doesn't mention one of the biggest differences between Blinn-Phong and Phong -- H can be calculated per vertex and linearly interpolated across a triangle (even with per-pixel normals, e.g. from bump-mapping), while R cannot. 60.240.243.216 (talk) 14:40, 21 April 2011 (UTC)
- I don't see why it shouldn't be possible to calculate R per vertex and then interpolate it? --Kri (talk) 16:22, 21 April 2011 (UTC)
- Since H doesn't depend on the surface normal, it's very simple. If you want to simulate a textured surface, where the surface normal varies per pixel, you can combine with variable N with interpolated H easily in H•N. But with Phong, if you interpolate R across a triangle, you'll get a smooth surface; if you want a fluctuating N, you need to recalulate R at each pixel. So Phong is efficient for smooth surfaces, but not for textured, if I understand this stuff correctly. Dicklyon (talk) 06:31, 22 April 2011 (UTC)
So if we assume the viewer is at infinite distance then the look vector for every pixel/fragment is the same? It feels a bit odd to me. Anyway that is what validates the idea of one single half vector for the entire frame right? Also regarding the above discussion about interpolating the half vector: when linearly interpolating the (unit-length) halfvector across triangles I found artefacts in my renderings (I was using HLSL, re-normalizing H at pixel/fragment level and computing dot products at pixel level). Interpolating the unnormalized view and light vectors (so actually the relative camera position and relative light position with regard to the vertex's world XYZ position) across the triangle and then normalizing them in the pixel/fragment shader to computer the (unit-length) half vector at that level did give expected rendering results. Can someone verify it is correct to linearly interpolate H vectors across triangles?84.82.112.181 (talk) 23:36, 7 June 2011 (UTC)
- What kind of artifacts? Did you compute the (unit-length) halfvector from the normalized view and light vectors? --Martin Kraus (talk) 17:43, 8 June 2011 (UTC)
Terminology definition
[edit]I don't really know much about rendering, so perhaps this is an obvious question, but in the definition of the half-angle H, there is a reference to a vector N which never defined, and probably should be. 192.91.171.42 15:20, 27 April 2007 (UTC)
- Fixed a while back. Dicklyon 15:32, 28 August 2007 (UTC)
Wrong pictures
[edit]Pictures in this article are in linear color space, but they are usually viewed on sRGB monitor, so they look completely different from an actual Blinn-Phong/Phong Reflection Model rendering. 83.7.234.61 (talk) 19:15, 19 December 2009 (UTC)
HLSL Code Sample
[edit]Given that blinn-phong shading is a basic effect used often in HLSL I shall add a small piece of HLSL code which performs the function. --ChristosIET (talk) 15:05, 26 February 2010 (UTC)
- I don't think this should be part of a Wikipedia article because it represents original material that cannot be attributed to a source; see Wikipedia:NOR. But if you have a published source for this shader, it would be better to cite the source. --Martin Kraus (talk) 09:19, 9 June 2011 (UTC)
Incorrect information in picture
[edit]In the image illustrating three different renderings, it says under the rightmost picture that it uses a lower exponent. This is incorrect; to get smaller (sharper) reflections a higher exponent has to be used. --Kri (talk) 23:11, 6 February 2011 (UTC)
- Good catch. I corrected the image. Dicklyon (talk) 23:56, 6 February 2011 (UTC)
Article Incorrectly Describes Blinn-Phong?
[edit]I've read Blinn's paper several times and the model described in his original paper is not what is described in this article. If you read Blinn's paper you can see that the model is a modification of the Torrance-Sparrow model, not of the Phong model. He only briefly talks about a reformulation of the Phong model in the beginning of the paper. He then reformulates the Torrance-Sparrow model in terms of the half angle H. Later in the paper, he compares the two models showing how the modified Torrance-Sparrow model performs better than the modified Phong model in both accuracy and speed. In addition, his proposed microfacet distribution D_3 is not mentioned in the article. This is all clear in the concluding paragraph:
"The Torrance-Sparrow reflection model differs from the Phong model in the inclusion of the G, F and l/(N*E) terms. This has a noticable effect primarily for non-metallic and edge lit objects. The use of the D3 micro facet distribution function provides a better match to experimental data and is, happily, easier to compute than D1 or D2. This savings effectively offsets the extra computation time for G and F yielding a hilight generation function having a high degree of realism for no increase in computation time."
What's the deal? — Preceding unsigned comment added by 129.25.18.12 (talk) 19:08, 18 August 2011 (UTC)
- The article describes what is known as Blinn–Phong, which is Blinn's adaptation of Phong's cosine specularity model. We should also have a good article on the Torrance–Sparrow model, including how Blinn adapted it. Maybe you can create that? Dicklyon (talk) 19:39, 18 August 2011 (UTC)
- Hmm, I will see if I can make some time for that, thanks — Preceding unsigned comment added by 129.25.18.12 (talk) 19:47, 18 August 2011 (UTC)
Badly written uncited mess
[edit]I have no time to fix this right now (otherwise I would) but this article has been marked as not having enough references for almost ten years, contains inaccuracies and a lot of sloppy language. I anyone were to put this article up for deletion, I wouldn't blame them. — Preceding unsigned comment added by 77.61.180.106 (talk • contribs) 31 August 2021 (UTC)