• No se han encontrado resultados

Organización Creadora de Conocimiento de Nonaka y Takeuchi

For total realism we would need to exactly model light sources and the reflecting capabilities of materials given by the Bidirectional reflectance distribution function (BRDF), ρ0v, φv, θL, φL), where θv, φv give the angles that specify the viewer direction and θL, φL are the angles that specify the light direction, see Figure 6.1.

azimuth = 0

In Figure 6.1, θ is the zenith angle, i.e. the angle between an incident light ray and the vertical (z-axis) at P or d A; the elevation angle = 90− θ. θ is written theta in the diagram; thetas is the theta of the light source, thetav is the theta of the viewer.

The azimuth angle of a ray incident at a point P or area element d A is the angle between plane containing the ray and the reference plane of zero azimuth at P or d A, i.e. local North at d A; the symbol is φ (phi in the diagram; phis is the phi of the light source, phiv is the phi of the viewer and phir is the azimuth angle separating the source and the viewer).

BRDF is clearly a very general description of reflectance — but at a great cost, we need four angle parameters, plus the wavelength λ parameter, making five parameters.

Such complexity is clearly out of the question for a graphics system such as OpenGL — at least currently.

But as we have said, a world of just colour and no lighting is a flat and uninteresting world. just colour and no lighting or reflected light.

There is a simple lighting-reflectance model called Lambertian (called diffuse in OpenGL).

Lambertian (diffuse) model In the Lambertian model light is directional but when it is reflected it is reflected equally in all directions in the upper hemisphere. The amount of light incident on a fixed area of the surface depends on the angle at which the light strikes the surface. If θ is the angle of the light source with respect to the normal to the surface (i.e. the relative zenith angle), then the lightness of the surface varies as cos θ; hence it is 1 (maximum) when the light source is perpendicular (θ = 0) to the surface and it is 0 when the light is at θ = 90.

Could we get away with purely diffuse (Lambertian) reflectors with their simplicity of the single parameter kd (reflectance)? Granted, we would need to allow kd to vary with colour (kdr, kdg, kdb) for red green and blue — recall that we can model λ variations by considering just three colours.

The answer unfortunately is no. Diffuse reflectors are matte so you see none of the highlights and shininess that give us sensations of depth and position.

OpenGL simulates reality by allowing four light models and corresponding material reflectivity characteristics: ambient, diffuse, specular, and emissive. A light or a surface may have a mixture of these. Emissive is a special case and applies only to a surface which is emitting its own light.

First we give a description in English; later we include some mathematics.

Ambient Ambient light is totally non-directional; think of up-lighting in a room, or light that has entered a room from a window; each of these would have a high ambient content.

We can specify the ambient colour distribution of a light, i.e. the amount of red, green and blue.

We can also specify the ambient colour of a material, i.e. it’s reflectivity in red, green and blue. In OpenGL, ambient light interacts only with ambient material colour.

Think of ambient light and materials as being like the colours we have been using up to now, and that all scenes were lit with a pure white, r = 1, g = 1, b = 1, ambient light. In other words, the reflectivity model is the simple model we used in Chapter 2 and in section 6.1.2 above: you have illumination i (coloured) and a reflecting surface r (coloured) and to get

the light reflected you multiply i × r , for each wavelength, or for each colour, red, green, blue, in the three colour model.

In case you are confused, the term ambient applies more naturally to light only — but OpenGL’s model needs ambient material colours.

Diffuse The term diffuse applies more naturally to the reflectivity of materials than to lights, but as with ambient, OpenGL’s model needs diffuse lighting to go with diffuse materials.

Diffuse light is directional but when it is reflected it is reflected equally in all directions in the upper hemisphere, this is called Lambertian reflection.

We can specify the colour distribution of diffuse lights and likewise the diffuse colour of a material, i.e. (kdr, kdg, kdb).

Specular The term specular also applies more naturally to the reflectivity of materials than to lights, but as with ambient and diffuse, OpenGL’s model needs specular lighting to go with specular materials.

Specular light is directional and when it is reflected it is reflected in a preferred direction;

think of a shiny surface.

We can specify the colour distribution of specular lights and materials. In OpenGL, specular light interacts only with specular material colour.

Emissive Emissive refers only to materials. Materials may emit their own light. Think of a glowing object; emissive light adds to the lightness of the object. Of course, the glowing object may also be reflecting ambient, diffuse, and specular light. Emissive light does not act as a light source, i.e. it does not contribute to the overall lighting of a scene.

Colours are Independent In OpenGL, lights are allowed to have independent colour components for ambient, diffuse, and specular. Likewise materials can have independent colour components for ambient, diffuse, specular, and emissive. If you think this odd, take the example from (Shreiner et al. 2008a): think of the example of a red snooker ball under white light — the snooker ball looks mostly red, but the (specular) highlights are white.

Colours are Combined Independently Let us say we have a light with ambient components lar, lag, lab (red, green, blue), diffuse components ldr, ldg, ldb, and specular components lsr, lsg, lsb.

Now let us have a material with ambient components mra, mga, mba (red, green, blue), diffuse com-ponents mdr, mdg, mdb, and specular components mrs, msg, msb.

The viewed red lightness of that material will be

rr = larmar + ldrmdr + lsrmsr + er, (6.7) where er is any emissive component. And similarly for green (rg) and blue (rb). If any of the sums rr, rg, rb is greater than 1.0, it is clamped (the OpenGL term) to 1.0.