Escolar Documentos
Profissional Documentos
Cultura Documentos
colours to
the framebuffer. The source code for this shader is shown in the next li sting:
void main()
{
gl_FragColor = gl_Color;
}
A shader needs a main()-function, just as a C-program has. This function gets executed for the
vertex, primitive or fragment.
Vertex shaders need to transform the object space position to world space, where they are
further processed. This transformation is made with the built-in function ftransform():
void main()
{
gl_Position = ftransform();
gl_FrontColor = vec4(0.8f, 0.8f, 0.8f, 1.0f);
}
To simplify the application logic, all BRDFs have the same set of parameters:
uniform vec4 LightColor;
uniform vec4 SpecularLight;
uniform vec3 LightDirection; // in object space
uniform vec4 DiffuseColor;
uniform vec3 EyePosition; // in object space
BRDF
The three terms F, D and G control each a different aspect of the reflection model. All three
components together produce the final result. This can produce better ef fects than the Phong
reflection model at a higher computatioa l cost. The reflection model depends on a variety of
parameters, so experimenting is needed to create good-looking and realist ic results.
3.3.1 The Geometric Term
The geometric term G accounts for shadowing and masking between microfacets. The G term
does not have any factors that are dependent on the physical propert ies of the surface.
G = min( 1, 2(n . h)(n . e) / (e . h), 2(n . h)(n . l) / (e . h))
with
n ... normal
h ... half vector
l ... light direction
e ... vertex-to-eye vector
3.3.2 The Fresnel Term
The Fresnel term determines the amount of reflection from each microfacet and how metallic
the
object looks. For details see [nvidia-fresnel]. The Fresnel term can be thought of a replacement
for the
specular color seen in other reflection models.
F = (g-c)
2/ 2(g+c)
2 (1 + (c(g+c)-1)
2 / (c(g+c)+1)
2)
c=v.h
g = (η2 + c2 -1)
0.5
AUSARBEITUNG
• Die vier-dimensionale bidirektionale Reflektanzverteilungsfunktion (engl. BRDF,
Bidirectional Reflectance Distribution Function) gibt an, wie viel Licht unter beliebigen
Einfalls- und Ausfallsrichtungen, jeweils definiert durch ein Winkelpaar, reflektiert wird.
• Zum einen handelt es sich dabei um das ein-treffende Licht, welches durch die Winkel
qin und fin beschrieben wird und
• zum anderen um das ausgehende Licht, repräsentiert durch qout und fout.
• Da die meisten Materialien zumindest teilweise diffus sind, wird lediglich ein Teil des
Strahlungsflusses reflektiert. Die restlichen Anteile werden von der Oberfläche absorbiert.
• ist speziell fuer metallische Oberflaechen geeignet
Cook Torrance
• Kategorie: ansitrop
• Bei dem von Cook und Torrance beschriebenen Beleuchtungsmodell handelt es sich um
eine BRDF, die eine physikalische Korrektheit anstrebt. Dieses Modell ist speziell fuer
metallische Oberflaechen geeignet.
• Dieses Beleuchtungsmodell ist auch in der Lage, Oberflächen zu beschreiben, die eine
vom Betrachter abhängige Farbe haben [6].
the amount of light that is reflected to a particular viewing position depends on:
• the position of the light,
• the position of the viewer,
• and the surface normal and tangent.
The key parameters of the formula are the diffuse reflectivity of the surface (rd),
the specular reflectivity of the surface (rs),
and the standard deviation of the surface slope (a).
The final parameter is a measure of the roughness of a surface.
• N - unit surface normal.
• L - unit vector in the direction of the simulated light source.
• V - unit vector in the direction of the viewer.
• R - unit vector in the direction of reflection from the simulated light source.
• H - unit angular bisector of V and L (halfway vector).
• T - unit vector in the plane of the surface that is perpendicular to N (i.e., the tangent).
• B - unit vector in the plane of the surface that is perpendicular to both N and T (i.e., the
binormal).
[2] R. Cook and K. Torrance. A reection model for computer graphics. ACM Transactions On
Graph-
ics, 1(1):724, 1982.
The Cook-Torrance model is a modication of earlier reectance models. The main as-
sumption is that the surface is composed of tiny, perfectly reective, smooth microfacets
oriented at different directions. The facets are assumed to be V-shaped and their distribu-
tion is isotropic. The model takes into account the fact that the light might be blocked by
other microfacets (shadowing). Similarly, it also considers the fact that the viewer does
not see some of the microfacets since they are blocked by the other microfacets (masking
effect). The model takes into account an average Fresnel term (polarization is not con-
sidered) when modelling the reectance of individual microfacets. However, it does not
allow for multiple light bounces between the microfacets. The orientation of the facets
is assumed to have some distribution - Cook and Torrance use the Beckman distribution
function
---------------------------------------------------------------------------------------------------------------
http://www.irrlicht3d.org/papers/BrdfModelle.pdf
Das von Cook und Torrance 1982 vorgestellte Modell wird auch manchmal als Blinn-Cook-
Torrance-Modell bezeichnet, weil es auf Blinns Arbeit von 1977 aufbaut. Es eignet sich in der
Praxis sehr gut zum Beschreiben von Metallen wie Kupfer und Gold, aber auch für andere
interessante Materialien wie Plastik mit verschiedener Rauheit.
Des weiteren ist dieses Modell in der Lage Oberflächen zu beschreiben, die eine
betrachtungswinkelabhängige Farbe haben.
Das Cook-Torrance-Modell verwendet die angegebene Aufteilung des reflektierten Lichtes, und
konzentriert sich darauf, die einzige Reflektionslichtkomponente zu beschreiben, die von der
Richtung des Betrachters abhängt, die Glanzlichtkomponente fs.
Dabei wird von Annahmen aus dem 1967 von Torrance und Sparrow vorgestellem Mo-
dell ausgegangen, welches auf physikalischen Erkenntnissen basiert und sich kleiner Flächen be-
dient (oder Microfacetten), um das Reflektionsverhalten des Lichtes zu erklären. Dieses wird
auch oft als Microfacetten-BRDF (micro facet BRDF) bezeichnet und viele andere Modelle
bauen darauf und infolge dessen auch auf dem Cook-Torrance Modell auf. Dies liegt vielleicht
auch daran, dass das Torrance-Sparrow Modell, als es 1967 vorgestellt wurde, das erste phy-
sikalisch basierte Modell war. [NNSK99] Das Torrance-Sparrow-Modell beschreibt die Re-
flektionen an der Oberfl¨ ache mit Hilfe der Vorstellung eine rauen Oberfl¨ ache, den
Microfacetten. Das Modell ist dabei aber nur korrekt, wenn die Wellenl¨ ange des
Lichtes kleiner als die Unebenheit der Oberfl¨ ache ist. Man vergleicht hierbei dieWellenl¨ ange
des Lichtes mit der RMS (root-mean-square, Wurzel der gemittelten Quadrate) der
Unhebenheiten:
G:
Hierbei bezeichnet
→
N die Mittlere Ober-
߬ achennormale,
→
V die Richtung zum Betrach-
ter,
→
L die Richtung zum Licht und
→
H der Halb-
vektor zwischen den zwei letzgenannten Varia-
blen. Durch G(θi, θr, φr) wird also einfach der
gr¨ oßte Anteil an Licht gew¨ ahlt, der durch Selbst-
beschattung Gshdw(self shadowing) und Abblen-
dung Gmsk (masking) verloren wird. Abbildung 8
verdeutlicht den Unterschied zwischen Abblen-
dung und Selbstbeschattung. [Lew93, NIK89]