Introduction to Computer Graphics EEL 5771-001 PPT8: Illumination models 1 By Nikitha Gullapalli...

Preview:

Citation preview

Introduction to Computer GraphicsEEL 5771-001

PPT8: Illumination models

1

By Nikitha GullapalliU44773764

2

Light Sources

Photorealism[16] is a genre of art that encompasses painting, drawing and other graphic media, in which an artist studies a photograph and then attempts to reproduce the image as realistically as possible in another medium.

A light source[17] essentially is an optical transmitter that is paired with an optical receiver, both of which are connected to electrically based devices or systems. So, the source converts electrons to photons and the detector converts photons to electrons.

Decrease in intensity of a signal, beam, or wave as a result of absorption of energy and of scattering out of the path of a detector, but not including the reduction due to geometric spreading is called intensity attenuation[18].

Light sources near and far: the source placed near the object is called near light source and the source placed far away from the object is called far light source.

3

Light Sources

A spotlight[7] is a light source which has a cone of effect, e.g. a desk lamp or a torch. Like a directional light, it has a basic direction, but it also has a defined conic volume in which its light can fall. The angle of the cone determines how much of the scene is illuminated. Spotlights can also have a drop-off rate; this is the degree to which light nearer the edge of the cone becomes less and less bright compared to light at the center (angular attenuation[7]). e.g. for a torch beam, directly ahead is the brightest point while to either side the light becomes dimmer usually until there is very little illumination (high drop off rate). Compare this to a stage light, where the cone of illumination is usually fairly constant from the center to its edge (low drop off rate).

a) no drop off rate specified [7] b) specific drop-off rate specified[7]

Light Sources

Cones and flaps[1]: to restrict the light’s effect to limited area cones and flaps were found. Flaps are modeled after “barn doors” found on the professional photography lights that confine the effect of the light to a designated range in x,y,z coordinates. Each light has 6 coordinates and user can specify their maximum and minimum values. Each flap further has a flag to determine if it is on or off. When a points shape is determined, the illusion model is evaluated for the light of when the points coordinates are within the range specified by the minimum and maximum coordinates. Figure(a) shown below shows the use of x flaps when (L’)’ is parallel to the y axis and x.z flaps are sharply restricting the lights effect

4

Light Sources

Cones[1]: it is possible to create a sharply delineated spotlight through the use of cones, whose apex is at light source and whose axis lies along (L’)’.

The figure3 (b) shows a cone with a generating angle of δ may be used to restrict the light sources effects by evaluating the illumination model only when γ <δ

Fig: (e)demonstrates the use of cone to restrict the light of (c). (b) the cube is aligned with the coordinate axis, so 2 pair of flaps can show the effects shown[1]

5

6

Illumination Models

Color [2] is a property of light that depends on wavelength. When light falls on an object, some of it is absorbed and some is reflected. The apparent color of an opaque object depends on the wavelength of the light that it reflects; e.g., a red object observed in daylight appears red because it reflects only the waves producing red light. The color of a transparent object is determined by the wavelength of the light transmitted by it. An opaque object that reflects all wavelengths appears white; one that absorbs all wavelengths appears black. Black and white are not generally considered true colors; black is said to result from the absence of color, and white from the presence of all colors mixed together.

Additive Colors [2] :colors whose beams of light in various combinations can produce any of the color sensations are called primary, or spectral, colors. The process of combining these colors is said to be "additive“. Subtractive Colors [2] :When pigments are mixed, the resulting sensations differ from those of the transmitted primary colors. The process in this case is "subtractive," since the pigments subtract or absorb some of the wavelengths of light.

7

Illumination Models

Specular reflection[4] is the mirror-like reflection of light  from a surface, in which light from a single incoming direction is reflected into a single outgoing direction. Such behavior is described by the law of reflection, which states that the direction of incoming light (the incident ray), and the direction of outgoing light reflected (the reflected ray) make the same angle with respect to the surface normal, thus the angle of incidence equals the angle of reflection, and that the incident, normal, and reflected directions are coplanar.

Lambert cosine law [3] says that the radiant intensity or luminous intensity observed from an

ideal diffusely reflecting surface or ideal diffuse radiator is directly proportional to the cosine of the angle θ between the direction of the incident light and the surface normal. The law is also known as the cosine emission law or Lambert's emission law

A surface which obeys Lambert's law is said to be Lambertian, and exhibits Lambertian reflectance. Such a surface has the same radiance when viewed from any angle. This means, for example, that to the human eye it has the same apparent brightness. It has the same radiance because, although the emitted power from a given area element is reduced by the cosine of the emission angle, the apparent size (solid angle) of the observed area, as seen by a viewer, is decreased by a corresponding amount. Therefore, its radiance (power per unit solid angle per unit projected source area) is the same.

8

Ambient Reflection Models [5]

Even thought parts of scene are not directly lit by light sources, they can still be visible because of indirect illumination. “Ambient” light IA is an approach to this indirect illumination.

Ambient light is independent of light sources and viewer position Contribution of ambient light

……………………………….....................(1)- is ambient reflection coefficient- is ambient intensity (constant over scene)

Total intensity Itotal at point P seen by viewer is

• • ……………........(2)

In equation (2) kA, kD dependent on wavelength (different values for R, G and B) and are often division into color and reflection coefficient of surface.

9

Example of ambient reflection[6]

fig 8

10

11

Diffuse reflection model [6]

• Diffuse reflection is the reflection of light from a surface such that an incident ray is reflected at many angles rather than at just one angle as in the case of specular reflection. An illuminated ideal diffuse reflecting surface will have equal luminance from all directions which lie in the half-space adjacent to the surface 

12

Light reflected equally in all directions - intensity dependent on angle between light source and surface normal

by Lambert’s cosine law: I = I* cos ………………………………….(1)-where I* is intensity of light source

Light reflected equally in all directions, with intensity depending on angle between light and surface normal

I = Kd ( cos ) I*…………………………………(2)

I* = Intensity of light source N = Surface normal L = Direction of light source Kd = Diffuse-reflection coefficient I = Reflected intensity

13 The angle between two vectors is given by their dot product: cos = L . N (assume L, N are unit length)

The coefficient Kd depends on the wavelength of the incoming light

I ( ) = Kd() ( L . N ) I*()…………………………………(3)Example: Diffuse reflection [6]

14

Specular reflection Models[6]

In perfect specular reflection, light is only reflected along the unique direction symmetric to the incoming light as shown in fig a

Fig a Fig b In practice, light is reflected within a small angle of the perfect reflection direction - the

intensity of the reflection tails off at the outside of the cone as shown in figb. This gives a narrow highlight for shiny surfaces, and a broad highlight for dull surfaces.

15

Thus we want to model intensity, I, as a function of angle between viewer and R, say ø, as shown below

The sharper peak is for the shinier surfaces, and broader peak for dull surfaces.

Phong realised this effect can be modelled by: (cos ø )n with a sharper peak for larger n

16

Intensity depends on angle between eye and reflected light ray:

I = Ks( cos )n I*…………………………………………(1)

n varies with material I* = Intensity of light sourcelarge n : shiny V = View directionsmall n : dull R = Direction of perfect reflected light

Ks = Specular-reflection coefficientI = Reflected intensity

17

Using cos = R . V (R, V unit vectors), we have:

I () = Ks ( R . V )n I()*………………………………….(2)

Where Ks does not depend on the wavelength - hence colour of highlight is same as source

A common Reflection model for ambient, diffusion and specular is as shown below

I() = Ka()Ia() + ( Kd()( L . N ) + Ks( R . V )n ) I*() ………………(3)

18

Example :specular reflection [6]

Example of ambient reflection a)only emission and ambient b) Including ambient and diffuse reflection

c) Including ambient, diffuse and specular reflection

19

20

Specular reflection functions[8]

I = Ks( cos )n I* where Ks is the Specular reflection functions

21

Example [9]

22

Illumination Models: half-way vector [19]

half-way vector model is a modified version of phong illumination model. This modified version replaces the deviation of the view direction from the direction of ideal specular reflection, the angle α, by another angle based on halfway vector based between the direction of light source and the viewer direction.

The viewer can see ideal specular reflection when the halfway vector between I and v coincide with the normal vector n to the surface. A reasonable measure for the deviation from the direction of specular reflection is therefore the angle β between the normal vector n and the halfway vector h of I and v as shown in the figure below.

23 Term cosα is replaced by cosβ in phong illumination equation , as shown below

Halfway vector h is given by

When there is more than one light source and also ambient light in the scene, the single computed intensity is the sum of all intensities. Incase the surface is emmiteing light itself, even the must be added. This leads to the following oveall illumination equation for the point on the surface.

24

Illumination Models

Color components [12] A color model is an abstract mathematical model describing the way colors can be represente

d as tuples of numbers, typically as three or four values or color components (e.g. RGB and CMYK are color models). However, a color model with no associated mapping function to an absolute color space is a more or less arbitrary color system with no connection to any globally understood system of color interpretation.

A wide range of colors can be created by the subtractive primary colors of pigment (cyan (C), magenta (M), yellow (Y), and black (K)).Those colors then define a specific color space.

25

multiple light sources[13] Multiple light sources each create their own patterns of light and shade. The quantities of light from each pattern

combine additively, but remember that it is light energy (linear radiance) that adds, not the nonlinear brightness's. An area lit by two equal light sources gives off twice as much light energy as an area lit by only one, but looks much less than twice as bright. One result of this is that areas of overlap of shadows that get no light from either source tend to be conspicuously dark compared to areas lit by one source.

26

Transparency[14,15]

Opaque[14]:When light strikes an opaque object none of it passes through. Most of the light is either reflected by the object or absorbed and converted to heat. Materials such as wood, stone, and metals are opaque to visible light.

translucent[14]:Materials like frosted glass and some plastics are called translucent. When light strikes translucent materials, only some of the light passes through them. The light does not pass directly through the materials. It changes direction many times and is scattered as it passes through. Therefore, we cannot see clearly through them; objects on the other side of a translucent object appear fuzzy and unclear. Because translucent objects are semi-transparent, some ultraviolet rays can go through them. This is why a person behind a translucent object can get a sunburn on a sunny day.

transparent objects[14]: Materials like air, water, and clear glass are called transparent. When light encounters transparent materials, almost all of it passes directly through them. Glass, for example, is transparent to all visible light. The color of a transparent object depends on the color of light it transmits. If green light passes through a transparent object, the emerging light is green; similarly if red light passes through a transparent object, the emerging light is red.

27

Snell’s law[15]:Snell's law (also known as the law of refraction) is a formula used to describe the relationship between the angles of incidence and refraction, when referring to light or other waves passing through a boundary between two different isotropic media, such as water, glass, or air.

Snell's law states that the ratio of the sines of the angles of incidence and refraction is equivalent to the ratio of phase velocities in the two media, or equivalent to the reciprocal of the ratio of the indices of refraction

28

Transparency

Opacity and multiple objects[26]

Opacity (pronounced "o-PASS-ity") refers to the opaqueness of an object. In computing, opacity is often used in graphics software to define how "nontransparent" an image is. In other words, the more transparent an image or image layer is, the lower its opacity. This process can be done to multiple objects at the same time.

29

Shadows

Visibility from the eye[20] Can you see something from the eye position? Yes, then visible. No, then not visible Can you see something from a light source position? Yes, then not in shadow. No, then in

shadow But there can be multiple light sources, thus the techniques below can be used

Two-Pass Object Precision 1st pass: transform to light position> hidden surface determination (polygons

which are not in shadow) 2nd pass: transform to original world coordinate sys >polygons not in shadow

are merged to become surface detail polygons (which algorithm?) Post-processing: transform to eye coordinate > visible surface determination

+ surface details

30 Two-pass Image Precision

Z buffer from eye (e): what the viewer can see Z buffer from light (l): what the light source can see for each (xe,ye,ze)

transform to (xl,yl,zl) is zl more distant than z(xl,yl)

yes, (xe,ye) is in shadow no, (xe,ye) is not in shadow

31

It should be noted that once we have located these shadow Areas for all light sources, the shadows could be treated as surface patterns[21] and stored in pattern arrays. Further the shadow patterns generated by a hidden surface method are valid for any selected viewing position, as long as the light source positions are not changed.

32

Light Intensities

Perceived intensities[12]: The human eye responds to low light levels by enlarging the pupil, allowing more light to enter the eye. This response results in a difference between measured and perceived light levels. A lamp that is dimmed to 10% of its maximum measured light output is perceived as being dimmed to only 32%. Likewise, a lamp dimmed to 1% is perceived to be at 10%.

Gamma correction[10] :When we "compute" colors we generally assume that they are linear quantities. Unfortunately, most display devices are nonlinear.

33

Intensity level resolution for high quality viewing [11]

Intensity level resolution refers to the number of intensity levels used to represent the image. The more intensity levels used, the finer the level of detail discernible in an image Intensity level resolution is usually given in terms of the number of bits used to store

each intensity level

Question now is how much resolution is enough?This all depends on what is in the image and what you would like to do with it

34

Example [11]

The picture on the right is fine for counting the number of cars, but not for reading the number plate

35

Halftone Techniques

Halftone[22] is the reprographic technique that simulates continuous tone imagery through the use of dots, varying either in size or in spacing, thus generating a gradient like effect. "Halftone" can also be used to refer specifically to the image that is produced by this process.

The most common method of creating screens amplitude modulation: produces a regular grid of dots that vary in size. The other

method of creating screens. frequency modulation: is used in a process also known as stochastic screening

36

Halftone Techniques

Intensity[22]: The resolution of a halftone screen is measured in lines per inch (lpi). This is the number of lines of dots in one inch, measured parallel with the screen's angle. Known as the screen ruling, the resolution of a screen is written either with the suffix lpi or a hash mark; for example, "150 lpi" or "150#".

The higher the pixel resolution of a source file, the greater the detail that can be reproduced. However, such increase also requires a corresponding increase in screen ruling or the output will suffer from posterization. Therefore file resolution is matched to the output resolution.

Though round dots are the most common used, there are different dot patterns[22] available, each of them having their own characteristics. They can be used simultaneously to avoid the moiré effect. Generally, the preferred dot shape is also dependent on the printing method or the printing plate.

Round dots: most common, suitable for light images, especially for skin tones. They meet at a tonal value of 70%.

Elliptical dots: appropriate for images with many objects. Elliptical dots meet at the tonal values 40% (pointed ends) and 60% (long side), so there is a risk of a pattern.

Square dots: best for detailed images, not recommended for skin tones. The corners meet at a tonal value of 50%. The transition between the square dots can sometimes be visible to the human eye.

37

Halfton dot patterns example[23]

38

Halftone Techniques

Dot pattern problems[23] Dot Gain

The problem with printing halftone dots is that the dot will grow in size as the ink is pushed out of the mesh onto a soft surface like a shirt. A typical halftone will grow from 25% to 35% when printed properly. If printed poorly it can grow to twice its size. This means that the print will be muddy with no detail.

39

Dithering Techniques

Approximating halftone images[24] If we cannot display all the required intensity levels (e.g. on a printer) we need a

trick using the spatial integration that our eyes performs: In normal light the eye can only detect about one arc minute. This is called VISUAL ACUITY. Thus instead of gray dots a small black disk with radius varying according to the blackness is printed. Usually, for newspaper 60-80 and for magazines 150-200 different radiuses are used. This process is called HALFTONING.

40

dither matrix[25] A dither matrix is a rectangular pattern of threshold values that seeks to produce optimal output for a local

region of the source. When dithering a WxH source image with a NxN dither matrix, the dithering matrix is generally much smaller

than the source and is therefore repetitively tiled to generate threshold values for every source sample. Dither matrices correspond to pattern fonts since the thresholds generally correspond to the likelihood of a

black pixel occurring in any one of the fonts. Dither matrices are generally square and must be scaled to the color depth of the source.

41

dither matrix example[25]

42

Error Diffusion[25]

The ‘error’ between the source and destination is used to adjust the threshold as the source image is scanned

The error is then pushed into unprocessed nearby samples in order to make sure that the ‘correct’ percentage of black/white pixels are generated locally.

Various ways of diffusing the error Floyd-Steinberg takes the error and distributes it using the ratios given below

Remember that we are doing a raster scan. Samples above and to the left have already been processed.

43

Floyd-Steinberg Example[25]

44Floyd-Steinberg Example[25]

45

REFERENCES:

1. https://books.google.com/books?id=-4ngT05gmAQC&pg=PA733&lpg=PA733&dq=cones+and+flaps+computer+graphics&source=bl&ots=QXIqcViss9&sig=pwgXBrdD6_Vk3uGhe4IgC0O9lQM&hl=en&sa=X&ved=0CCMQ6AEwAGoVChMItve-1YjNyAIVSR8eCh2cogef#v=onepage&q=cones%20and%20flaps%20computer%20graphics&f=false

2. http://www.infoplease.com/encyclopedia/science/color-apparent-color-objects.html3. https://en.wikipedia.org/wiki/Lambert%27s_cosine_law4. https://en.wikipedia.org/wiki/Specular_reflection5. http://slideplayer.com/slide/5114241/#6. http://slideplayer.com/slide/794870/#7. http://www.sgidepot.co.uk/lights.html8. http://www.slideshare.net/fungfung/cg-opengl-surface-detectionillumination-modelssurfacerendering-mo

delscourse-99. http://prosjekt.ffi.no/unik-4660/lectures04/chapters/jpgfiles/matlab1.jpg10. http://escience.anu.edu.au/lecture/cg/Color/gammaCorrection.en.html11. http://www.slideshare.net/cs1973/computer-vision-5121429212. http://encyclopedia.thefreedictionary.com/Colour+component13. http://www.huevaluechroma.com/105.php14. http://science.jrank.org/pages/1593/Color-Transparent-translucent-opaque.html15. https://en.wikipedia.org/wiki/Snell%27s_law16. https://en.wikipedia.org/wiki/Photorealism17. https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=light+source+d

efinition18. http://www.thefreedictionary.com/attenuation

46

19. https://books.google.com/books?id=USZzZDMT2vwC&pg=PA188&lpg=PA188&dq=half-way+vector+in+computer+graphics&source=bl&ots=g_EGWipsZF&sig=_FvWDB3QwXvteMqDZpSjNpb4v1M&hl=en&sa=X&ved=0CEIQ6AEwB2oVChMI6YOh8pTPyAIVA9WACh0eygj4#v=onepage&q=half-way%20vector%20in%20computer%20graphics&f=false

20. http://www.cs.ucsb.edu/~cs180/notes/shadow.pdf21. https://

books.google.com/books?id=zTFPF3uN7ecC&pg=PA408&lpg=PA408&dq=Shadows+as+surface+patterns+computer+graphics&source=bl&ots=I7AXl20NN1&sig=mjyVY9i046JdiX146agfXnKbxLY&hl=en&sa=X&ved=0CB0Q6AEwAGoVChMIrO32pKLPyAIViaoeCh0NpQwd#v=onepage&q&f=false

22. https://en.wikipedia.org/wiki/Halftone23. http://t-biznetwork.com/articles/screenprinting/halftone-dots-made-easy/24. http://www.mat.univie.ac.at/~kriegl/Skripten/CG/node6.html25. http://slideplayer.com/slide/5845192/26. http://pc.net/glossary/definition/opacity

Recommended