Jump to content

Talk:Specular highlight: Difference between revisions

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Content deleted Content added
1&only (talk | contribs)
1&only (talk | contribs)
Line 156: Line 156:
==== Specular ====
==== Specular ====


:<math>
:<math> k_\mathrm{spec} = ( V \cdot R ) ^ s = ( \sqrt{ 1 - (L \cdot T ) ^2 } * \sqrt{ 1 - (V \cdot T ) ^2 } - (L \cdot T ) * (V \cdot T ) ) ^s </math>
\begin{align}
:<math> k_\mathrm{spec} = \left [ \sin(\angle(L, T)) \sin(\angle(V, T)) - \cos(\angle(L, T)) \cos(\angle(V, T)) \right ] ^s=(-\cos(\angle(L, T)+\angle(V, T)))^s</math>
k_\mathrm{spec} & {}= ( V \cdot R ) ^ s \\
:<math> k_\mathrm{spec} = \left [ \cos(\angle(L, T)) \cos(\angle(V, T)) -\sin(\angle(L, T)) \sin(\angle(V, T)) \right ] ^s=\cos^s(\angle(L, T)+\angle(V, T)) </math>
& {} = ( \sqrt{ 1 - (L \cdot T ) ^2 } * \sqrt{ 1 - (V \cdot T ) ^2 } - (L \cdot T ) * (V \cdot T ) ) ^s \\
& {} = \left [ \sin(\angle(L, T)) \sin(\angle(V, T)) - \cos(\angle(L, T)) \cos(\angle(V, T)) \right ] ^s=(-\cos(\angle(L, T)+\angle(V, T)))^s\\
& {} = \left [ \cos(\angle(L, T)) \cos(\angle(V, T)) -\sin(\angle(L, T)) \sin(\angle(V, T)) \right ] ^s \\
& {} = \cos^s(\angle(L, T)+\angle(V, T))
\end{align}
</math>


=== Links ===
=== Links ===

Revision as of 11:15, 26 June 2015

Perhaps this is the wrong place, but since we photographers also access this topic I would like to know how polarizing filters effect specular highlights, including ones on metallic surfaces. — Preceding unsigned comment added by Makofoto (talkcontribs) 18:15, 27 September 2014 (UTC)[reply]


WikiProject iconPhysics Start‑class Low‑importance
WikiProject iconThis article is within the scope of WikiProject Physics, a collaborative effort to improve the coverage of Physics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.
WikiProject iconComputer graphics Start‑class
WikiProject iconThis article is within the scope of WikiProject Computer graphics, a collaborative effort to improve the coverage of computer graphics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
???This article has not yet received a rating on the project's importance scale.

I would like to suggest the fact that for a pure mirror like surface the reflection occurs when the angle between L and N and V and N are the same. Mentioning the half-vector as being the direction around which light is reflected seems 1/ wrong 2/ misleading. It has been proven that using the half-vector in models such as the Phong or the Cook-Torrance gave more accurate results than by using the reflection vector, but physically speaking, again, for a pure mirror like surface, the reflection direction is the vector that should be used. It seems to me that the first paragraph should not mention the half-vector and should be re-written such as to only mention the reflection vector. Anyone would agree and make the change ? -c

Error: Cook-Torrance model

According to the reference[1], the formula for the specular term should be changed from

to

ClaudeKnaus (talk) 15:15, 21 September 2010 (UTC)[reply]

Gaussian model better than the Blinn-Phong shading model?

It says in the article that Gaussian distribution is a slightly better model than Phong shading, while in fact the model will give

where and Suppose that is very small (which it will be in the specular highlight), we can then use a first order Taylor series to obtain

which is exactly the same as in the Blinn-Phong shading model. --Kri (talk) 23:48, 7 February 2011 (UTC)[reply]

I'm not sure where the "better" came from. Your observation is also the basis of my 1993 paper, ref 1, in which I compare the Gaussian approximations to the Phong and Blinn–Phong methods. The approximations are good for small angles and large n, as you note; there is still a difference between the Phong and Blinn–Phong methods under this appproximation though. I also provide other good approximations, much quicker to compute, needing no exponentiation and not very accurate normalization. Dicklyon (talk) 02:24, 8 February 2011 (UTC)[reply]
Nice paper, and nice illustrations; I read some of it. I have also thought about using what you call the D vector to approximate dot product between the L and R vectors; I guess there are approximations like this everywhere in computer graphics and similar fields if you are just somewhat bright in geometry and physics. But you haven't patented these methods, have you? --Kri (talk) 00:17, 10 February 2011 (UTC)[reply]
Apple did; probably expires Nov. 2012 if it's still alive. Dicklyon (talk) 01:44, 10 February 2011 (UTC)[reply]
Okay. Say, just hypothetically, that I would come up with some of the techniques mentioned in your paper, without seeing them there and without having any idea of that they where patented. And say that I would use those techniques in a commercial product. Now, if Apple finds out that I'm using the same techniques that they have a patent on, can they sue me for it? --Kri (talk) 00:02, 13 February 2011 (UTC)[reply]
Sure, anyone can sue anyone for anything. And they could claim that you knew about it and infringed it willfully, so are liable for triple damages. Unlikely, though, esp. since it would be hard to show any damages and it would cost them millions to litigate. There's also a good chance they have allowed it to just expire. It's always a crap shoot. It's best not to worry about infringing patents, I think. Dicklyon (talk) 00:09, 13 February 2011 (UTC)[reply]
Yes that's true; it's probably better to live your life without worrying for a lot of stuff! --Kri (talk) 18:16, 13 February 2011 (UTC)[reply]
There are sources about Gaussian microfacet distribution here. I think this distribution is not quite the same thing as the specular shape distribution in the Blinn–Phong method, but certainly very closely related. Maybe you can say something more useful than the "better". Dicklyon (talk) 02:25, 10 February 2011 (UTC)[reply]
Don't you realise? They all are the same, spot will be brighter and more shiny if surface is better polished (for example, if light source is point, then if ball surface is very good polished then bright spot will be brightest and smallest at biggest polishing amount [n] and rest of ball surface will be almost black, the darker from bright spot on ball depending on angle between ball triangle normal and light vector). Polishing level describing n factor. There simply can't be something better than Phong model. Only if we talking about HDR, then maybe something better possible to think up than Phong-Blinn method. — Preceding unsigned comment added by Versatranitsonlywaytofly (talkcontribs) 13:37, 21 August 2011 (UTC)[reply]
There is only one problem with Phong-Blinn equation But first need to answer to question, what stronger reflects sun light: white paper or mirror? If take white paper size of eye retina (about 0.5 cm x 0.5 cm) and mirror with eye retina size and mirror from whatever distance will reflect all sun energy for eye in 0.5*0.5=0.25 . Energy amount will be equal from any distance. And pease of paper from distance will look very small and all energy [going parallel from sun) split into all directions. Now consider two ball, one is metal or mirror ball and another is ball colored with white color, which is like paper without any specular highlights (in nature it's almost don't exist paper without specularity of light). So rising with n any number between between 0 and 1 will decrease number. We need to made somehow, that paper reflects energy in single point (or pixel) about 1 and mirror about 5 or 10, let choose number 7 for mirror reflected energy per pixel. So then depending how close material is to mirror or to paper in sense of specularity highlight need to choose coefficient k between 1 and 7 and then formula becoming In perfect sense, paper is material which reflects light equally (to viewer) do not depending on angle between surface normal and light vector. And perfect mirror is mirror, which reflecting only light if dot product of surface normal and light vector is 1 and if there is only 5 degree angle (between N and L vectors) then light reflection is still 0 (to viewer). For perfect paper material formula can be like this where 1<c<1000. If c is small (c=1) then it is simulated perfect mirror and if c=1000 then it is simulated perfect paper. But formula is not good enough. Too much coefficients like c and n. So formula must look more like this where 1<c<1000. Notice, that vectors N and H are normalized and dot product of them can't be more than 1, because angle between them goes in formula Then just need multiply all formula by light intensity where 0<I<1. From specular lighting to viewer can come light with strength maximum 2, but if result is bigger than 1 then it must be 1. So by changing only c (from 1 to 1000) you will get effect from perfect paper to perfect mirror. As simple as that, without any errors.
I forgot that for perfect mirror need big n, so formula can be like this or like this and in both cases if result more than 1, then it still 1. For perfect mirror but enough and 1<n<10. About light intensity for this formula you can forget. Final formula can be where 1<c<1000.

Formula correct only for point lights

Specular highlight formula (if c>1, then c=1; I is light intensity, 0<I<1; k is coefficient of how much reflected light bulb wire on metal surface is brighter than white paper illuminated [perpendicular to light direction] by the same light bulb at same distance, 1<k<5) is correct for point lights and all kind of lamps if lamps are not close to object with specular highlight. And I think in most cases programmers in game and in all places do not making this condition: if c>1, then c=1 (they making it before multiplying by light intensity I). Because this is very important for almost reflected (like reflection on metal) even weak light to be brighter than white paper illuminated by stronger light (because specular reflection is reflection of light source like wire of light bulb). But here is bad news. From big distance all rays coming to surface of metal almost parallel and if metal is flat, then all flat surface will be bright and in reality would be on flat surface only small bright spot (in reality would be only Sun spot very bright instead all bright flat surface). So specular lighting can't be implemented correctly for near and far light sources. And specular highlights are in most cases only good for not flat objects (then they almost correct). So even ray-tracing and specular cubemaps and any over best techniques are incapable to correctly simulate metal specular highlights. For near objects specular highlight formula (if c>1, then c=1) is incorrect, because must be reflected shape of light like light bulb bright shape or very bright wire inside bulb. But at least if near light source is not parallel light, then on flat surface will be bright spot and brightest in center, but in reality there should be bright shape (like blured light bulb wire [on metal]). Final formula is this:

This (0<d<1) is diffuse lighting and it needed, because at different angle [between light source and surface] goes not equal amount of light energy per surface area. If angle between light vector and surface normal is 0 degrees, then lighting is brightest. At bigger angles bigger surface areas illuminated by same amount of light energy.
In games Crysis and Crysis 2 there used light attenuation (light weakening depending on distance between light and object). In "Doom 3" and in "Fear 3" videogames light attenuation is not used for flashlight (фонарик). Of course light attenuation also needed for realism (but not sun light or moonlight).

do not need remove

Phong distribution

In the Phong reflection model, the intensity of the specular highlight is calculated as:

Where R is the mirror reflection of the light vector off the surface, and V is the viewpoint vector (viewer vector).

In the Blinn–Phong shading model, the intensity of a specular highlight is calculated as:

Where N is the smooth surface normal and H is the half-angle direction (the direction vector midway between L, the vector to the light, and V, the viewpoint vector). Here angle describes the angle between R and V vectors. The Blinn–Phong shading model is equal to Phong reflection model model, but it smarter to use, because do not need to know reflection of light vector R and is faster because don't need to compute

When H coincides with N, the direction of the reflection coincides with the viewing direction V and a specular hightlight is observed. So the original formula

is expanded to
or

The complete Blinn-Phong model formula looks like:

where I is intensity of light, vector N is normal of surface and vector L is light source vector. Angle between H and V vectors is equal to angle between H and L vectors.

The exponent n characterizes the shiny properties of the surface and ranges from 1 to infinity. Objects that are matte require a small exponent, since they produce a large, dim, specular highlight with a gentle falloff. Shiny surfaces should have a sharp highlight that is modeled by a very large exponent, making the intensity falloff very steep. Together with the diffuse reflection model, the Phong illumination model can be expressed in the following way:

can be replaced by using the mechanism of the dot or scalar product of the unit vectors R and V:
This is the generally accepted phong reflection equation. As the angle between V and R decreases, the specularity rises.

Because it is expensive to calculate the reflection vector R (mirror of light incidence around the surface normal), James F. Blinn [Blinn] introduced a way to do this using an imaginary vector H, which is defined as halfway between L and V. H is therefore:

For calculation diffuse of light (how light reflects depending on angle between surface normal N and light vector L) need to use this formula:
where ||N||=1 and ||L||=1, because they are normalized.

The number n is called the Phong exponent, and is a user-chosen value that controls the apparent smoothness of the surface. These equations imply that the distribution of microfacet normals is an approximately Gaussian distribution (for large ), or approximately Pearson type II distribution, of the corresponding angle.[2] While this is a useful heuristic and produces believable results, it is not a physically based model.

Heidrich–Seidel anisotropic distribution

... very misleading.


Please do not delete: temporal place before I make it official.


The Heidrich–Seidel.[3] distribution is a simple anisotropic distribution, based on the Phong model. It can be used to model surfaces that have small parallel grooves or fibers, such as brushed metal, satin, and hair.

Parameters

Input parameters:

D - Thread direction ( In original papers this appear as T )
s - Shininess exponent. Values ere between 0 and infinity
N - real surface normal
L - vector from point to light
V - Vector from point to viewer
T - Thread direction based on real surface normal.
P - Projection of vector L on to plane with normal T ( in original paper this appear as N ).
R - Reflected incoming light ray against T. Incoming light ray is equal to negative L.

All vectors are unit.

Conditions

If some of the conditions are not satisfied from the list color is zero

Note: Thins list is not optimized.

Formula

First we need to correct original direction of fiber D to be perpendicular to real surface normal N. This can be done by projection fiber direction on to plane with normal N:

It is expected that fiber is cylindrical. Note the fact that normal of fiber depends of light position. Normal of fiber at given point is:

Reflected ray needed for specular calculation:

Final calculation

Optimization

Calculation of R and P are expensive operation. To avoid their calculation original formula can be rewritten in next form:

Diffuse

Specular

ftp://ftp.sgi.com/opengl/contrib/blythe/advanced99/notes/node154.html

Comments

T can be observed as bump normal and after that it is possible to apply other BRDF than Phong. — Preceding unsigned comment added by 1&only (talkcontribs) 21:37, 23 June 2015 (UTC)[reply]


— Preceding unsigned comment added by 64.102.255.40 (talk) 14:24, 22 June 2015 (UTC)[reply]

  1. ^ R. Cook and K. Torrance. "A reflectance model for computer graphics". Computer Graphics (SIGGRAPH '81 Proceedings), Vol. 15, No. 3, July 1981, pp. 301–316.
  2. ^ Richard Lyon, "Phong Shading Reformulation for Hardware Renderer Simplification", Apple Technical Report #43, Apple Computer, Inc. 1993 PDF
  3. ^ Wolfgang Heidrich and Hans-Peter Seidel, "Efficient Rendering of Anisotropic Surfaces Using Computer Graphics Hardware", Computer Graphics Group, University of Erlangen [1]