0% found this document useful (0 votes)
16 views11 pages

CG (Computer Graphics Notes For Reference Only Theory)

BIM 5th semester

Uploaded by

bhattasandeshraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
16 views11 pages

CG (Computer Graphics Notes For Reference Only Theory)

BIM 5th semester

Uploaded by

bhattasandeshraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 11
Translation hitps:/genvinenates.com + Translation in 30 is similar to translation in the 2D except that there is one more direction parallel to the z-axis. It, ty, and tz are used to represent the translation vectors. Then the translation of the position P(x, y, 2) nto the point P (x,y, 2')is done by P'=T.P + In matrix notation using homogeneous coordinate this is performed by the matrix multiplication, Y tos: iligenuinenotes.com 2.Rotation i) Rotation about x ais X-component does not change. ¥'=¥ cos8-Zsind Z=Y sin8+Z cose x=X Matic represertaton fort around Xan, wv) [1 0 0 O}fx y'| |0 co —sind 0|| 2] [0 sind cosé 0/] 1} jo 0 0 il y hitps:fgenuinenotes.com 2.Rotation i) Rotation About -axis: Z-component does not change. x ‘cos -Y sind =X sin +¥ cos (S Matrixrepresentation fr rotation around a, x'] [cos -sind 0 0 y'|_|sin@ cosa 0 0]] y mj} o 0 1 Ol: mio ow eis H orffeedinenctes.com 2.Rotation iil ii) Rotation About Y-axis: i ‘Y-component does not change. <> 0s -X sind sin +X cos® ad Matix represertation for rotation around Vs, cod 0 sind 0])x yl] 0 100 Olly z'| |-sind 0 cos 0): 1 10598 1 Antipstigenuinenotes.com hitgsilgenuinenctes.com 3. Scaling Scaling about origin A X'=X. Sx Wav sy A U=2.82 aa | fe OO) fe S, 0 0 (I-S)x, os, 0 0] ly z ; =Jo 0 s, o| |: rere]? 5 9 (-S)y 1 oo 04 [1 0 0 S, (-S,)z, rae P=S-P : rapeitecranenotoncom CM, = T(X 5) 52 p)-S(5,55,95,oL(-Xys-Vys-Zy) 3. Scaling + Scaling about an arbitrary point or Fixed point (ft #f) Ti 1, Polygon Tables te Polygons tables can be used specified specify polygon surfaces, ‘We specify @ polygon surface with a set of vertex coordinates and associated attribute parameters, As information for each polygon is input, the data are placed into tables that are to be used in the subsequent processing display, and maniulation ofthe objects in a scene * Vertex tables It stores co-ordinate values for each vertex of the object. * Etdge Table The edge table contains pointers back into the vertex table to identity the vertices for each polygon edge. * Surface table: And the polygon table contains pointers back into the edge table to identify the edges for each polygon surfaces. Sutherland-Hodgeman Polygon Clipping Algorithm + The Sutherland-Hodgeman Polygon-Clipping Algorithms clips given polygon successively against the edges of the given clip- rectangle. It starts with the initial set of polygon vertices, first clips the polygon against the left rectangle boundary of the window. Then successively against the right boundary, bottom boundary, and finally against the top boundary, as shown i figure. Original Polygon Clip Left Clip Right DDAExamples ™?"9endnenotes com Q.> Digitize a Line with end point A(2,3) and B(6,8), using DDA. A> Here, Slope (M) = (8-3)/(6-2) = 1.25 here Slope is postive and greater than 1 ‘And moving left to right and 1/m=0.8 So, we use K Yen M ed [OM a [arose [a ba) 2 |sarosss6~s [5 (as) 3 |=36+08-4e~4 6 146) ¢ |[=sa+08=52-5 [7 67) 5 [=s2r0a-6 8 (6a) Thus, ‘The initial decision parameter (PO) = 24 Clip Bottom Clip Top htpsigenunenctes com Example-1: Digitize the line with end points (20, 10) and (30, 18) using BLA Solution : Here Starting point ofline= x,y} = (20,10) and Ending point of ine = (2 y2} = 30, 18) Thus, slope of line, m = Ay / Ax = y2-y2 / x2-x1 = (18-10) (30-20) =8/10 ‘Asthe given points, itis clear that the line is moving left to right with the positive stop |m|=08 https://genuinenotes.com 2°8—10=6 Since, for the Bresenham’s Line drawing Algorithm of slope, |m| <1, we have MP0 (he. d1-d2 is Negative ) then, PLP, +2 ay -20x (20, 10) K Pe Xe Yeu | Cie. Yeo) 0.16 201 =21 ne [enn 1. | G+258 210-2 211 = 22 2 12) 2. [24288 2°10 2241 = 23 2D 12) 3. | -242"8 =14 2341 = 24 1B 13) 4. [14248-21010 | 24+1 = 25 14 1a) 3. [10 +2*8-2"10=6 | 25+1= 26 15 15) [64258 -2*10-2 26+1=27 16 16) 7._[ 24288 2°10 2741 = 28 16 16) [24288 — 14 281 = 29 7 17) 9. [14+ 288-2*10=10 | 2941 = 30 18 18) ‘Example: Digize line with eneietigGhubnates G8) using Bresenhan's Line Drawing Algorithm. (102016) Solution: Here, (X,¥sI= (62) 8 (6513.20) Me (20-2436) = 8/3, ve slope and |M| >1 P= Pye 20x-2.By ‘Example: Digitze the given line pagpigentAReholendc), 18) using Bresenhamis lnedravingalgortm, Solution: Here, (X,¥,)= (15,15) & x= [1015] =5 (l= (1018) 1845] Ms (18-15}/(10-15)=3/-5-ve slope and || <1 2 x Xa You | Oa Yosd fi eiiiana| sta test K a Fa _| Yor _| Moves) 7 lesa oft mw |e [ass 2 ennai shit] 8 1 Fe 3 a [7 [wn 2 2 |v __|uaan 4 ee 3 a (7 [aan 5 Ce Ce) A 1 /® (10,48) 6 a [° _|¢0) Example: Digite the given Ineimptgsndiritb wed, 5) using Bresenans Example: Dt line with epapnipdRuhbdlih wing Brsenhans Line Tne davingalgorihn aoe Dravingagritim ‘c=[3020]=10 Soliton: Sy=11051=5 Here, (N63) tae 012056) ae Me (6:3)(5-6)=3/-1 ~ve slope and |M| >1 190 Kah Yarhel x m teed Deer Rt 2-2y 2 [ena i eM eae ma x ’ Yar_| You | Bound ase a Ti aa ENN eTN a ee Tas 1 [phat HN 8 [sore (a0.10) 2 | =142a1 2863 HNN SI tel Imioa ues0 uez0 Sah uae pibyizay Pose. ez ay-20% Pos py 2 ax-2ay Po =2ay- ax Py =2.ax- ay Bresenham’s Line Algorithm https://genuinenotes.com Depth Buffer Method (Z-Buffer Method) + A commonly used image-space approach to detecting visible surfaces is the depth-buffer method, which compares surface depths at each pixel position on the projection plane. + Also called z-buffer method since depth usually measured along z-axis. This approach compares surface depths at each pixel position on the projection plane + Each surface of a scene is processed separately, one point at a time across the surface. And each (x, y, z) position on a polygon surface corresponds to the projection point (x, y) on the view plane. https://genuinenotes.com Depth Buffer Method (Z-Buffer Method) This method requires two buffers: - Az-buffer or depth buffer: Stores depth values for each pixel position (x, y)- + Frame buffer (Refresh buffer): Stores the surface-intensity values or color values for each pixel position’ = As surfaces are processed, the image buffer is used to store the color values of each pixel position and the z-buffer is used to store the depth values for each (x, y) position ye PIT Lay fed nups:/)genuinenotes.com A - Buffer Method + The A-buffer (anti-aliased, area-averaged, accumulation buffer) is an extension of the ideas in the depth-buffer method (other end of the alphabet from "2-buffer"). - A drawback of the depth-buffer method is that it deals only with opaque(Solid) surfaces and cannot accumulate intensity values for more than one transparent surfaces. + The A-buffer method is an extension of the depth-buffer method. + The A-buffer is incorporated into the REYES ("Renders Everything You Ever Saw") 3-D rendering system. + The A-buffer method calculates the surface intensity for multiple surfaces at each pixel position, and object edges can be ant aliased. A- Buffer Method The algorithm proceeds just like the depth buffer algorithm - The depth and opacity values are used to determine the final colour of a pixel - Scan lines are processed to determine surface overlaps of pixels across the individual scan lines. + Surfaces are subdivided into a polygon mesh and clipped against the + The opacity factors and percent of surface overlaps are used to determine the pixel intensity as an average of the contribution from the overlapping surfaces DEPTH SORT (Painter Algorithm) + This method uses both object space and image space method. + In this method the surface representation of 3D object are sorted in of decreasing depth from viewer. * Then sorted surface are scan converted in order starting with surface of greatest depth for the viewer. 1. Sort all polygon surface according to the smallest (farthest) Z co-ordinate of each. 2. Resolve any ambiguity this may cause when the polygons Z extents overlap, splitting polygons if necessary. 3. Scan convert each polygon in ascending order of smaller Z-co-ordinate i.e. farthest surface first (back to front) A Lapvithn * This algorithm is also called "Painter's Algorithm" as it simulates how a painter typically produces his painting by starting with the background and then progressively adding new (nearer) objects to the canvas. + Thus, each layer of paint covers up the previous layer. * Similarly, we first sort surfaces according to their distance from the view plane. The intensity values for the farthest surface are then entered into the refresh buffer. Taking each succeeding surface in turn (in decreasing depth order), we "paint" the surface intensities onto the frame buffer over the intensities of the previously processed surfaces. Light Source.. Value (olor) Some illumination made ae: Point source: Simplest model for a light emitter like tungsten 4. Ambient ight filament bulb compares tothe Kirfoces inthe scene Ike lucrescent intone Rfltion any object n 2 room — Dituse reflection: Scatter refected ah in all rection by 3. Gwe Reon and pug mae Specular-reflection: highlights or bright spots created by light source, particularly on shiny surfaces than on dull surfaces. 1. Ambient light: + This is a simplest illumination model + We can think of this model, which has no external light source-self-luminous objects. A surface that is not exposed directly to light source still will be visible if nearby objects are illuminated. + The combination of light reflections form various surfaces to produce a uniform illumination is called ambient light or background light. + Also called background light + Ambient light means the light that is already present in a scene, before any additional lighting is added. It usually refers to natural light, either outdoors or coming through windows. etc. It can also mean artificial lights such as normal room lights. raapeters ger nue ner enews 2. Diffuse Reflection * Objects illuminated by ambient light are uniformly illuminated across their surfaces even though light are more or less bright in direct proportion of ambient intensity. * Surfaces are rough * Incident light is scattered with equal intensity in all directions * Surfaces appear equally bright from all direction. * Such surfaces are called ideal diffuse reflectors (also referred to as Lambertian reflectors) 3. Specular reflection and phong model + When we look at an illuminated shiny surface, such as polished metal, a person's forehead, we see a highlight or bright spot, at certain viewing direction. Such phenomenon is called specular reflection It is the result of total or near total reflection of the incident light in a concentrated region around the " specular reflection angle = angle of incidence". Perfect reflector (mirror) reflects all lights to the direction where angle of reflection is identical to the angle of incidence It accounts for the highlight un a peapouryerunnerusce.cuns Object-Space methods Algorithms to determine which parts of the shapes are to be rendered in 3D coordinates. * Methods based on comparison of objects for their 3D positions and dimensions with respect to a viewing position. For N objects, may require N*N comparision operations. + Efficient for small number of objects but difficult to implement. Depth sorting, area subdivision methods. * Deals with object definitions directly. * Compare objects and parts of objects to each other within the scene definition to determine which surfaces, as a whole, we should label as visible. It is a continuous method. * Compare each object with all other objects to determine the visibility of the object parts. image Space Methods Deals with the projected images of the objects and not directly with objects. * Visibility is determined point by point at each pixel position on the projection plane. * Itis a discrete method. * Accuracy of the calculation is bounded by the display resolution. + A change of display resolution requires re- calculation + Based on the pixels to be drawn on 2D. Try to determine which object should contribute to that pixel. + Running time complexity is the number of pixels times number of objects. + Space complexity is two times the number of pixels: = One array of pixels for the frame buffer - One array of pixels for the depth buffer + Coherence properties of surfaces can be used. + Depth-buffer and ray casting methods. 1. Constant Intensi -Fast and simple method for rendering an object ‘with polygon surface -Each polygon shaded with single intensity calculated for the polygon PROCEDURE 1. Take a point on the object surface and calculate the intensity 2. Render the surface with same intensity throughout the surface 3. Repeat above procedure for each mn peat: pr polygo! ASSUMPTIONS 1. Object is a polyhedron 2. light sources should be sufficiently G.e. NLL and attenuation function are constant) 3. Viewing position is sufficiently far Ge. V-Ris constant over the surface) DRAWBACK: intensity discontinuity at the ‘edges of polygons 2. Gouraud Shading @ Intensity interpolation method @ Renders a polygon surface by linearly interpolating intensity values across the surface. ® Intensity discontinuity at the edges of polygons is eliminated by matching intensity values of each polygon with adjacent polygons PROCEDURE 1. Determine the average unit normal vector at each polygon vertex 2. Calculate each of the vertex intensities by applying an illumination model 3. Linearly interpolate the vertex intensities over the polygon surface Advantages: Removes discontinuities of intensity at the edge compared to constant shading model Limitations: Highlights on the surface are sometimes displayed with anomalous(irregular) shapes and linear intensity interpolation can cause bright or dark intensity streaks, called Mach Bands to appear on the surfaces. Mach bands can be reduced by dividing the surface into a greater number of polygon faces or Phong shading (requires more calculation). Hapourgenunenucocunt 3.Phong Shading * A more accurate method for rendering a polygon surface is Phong shading, or normal vector interpolation shading which first interpolate normal vectors, and then apply the illumination model to each surface point. It displays more realistic highlights on a surface and greatly reduces the Mach- band effect. A polygon surface is rendered using Phong shading by carrying out the following steps: * Determine the average unit normal vector at each polygon vertex. * Linearly interpolate the vertex normals over the surface of the polygon. * Apply an illumination model along each scan line to calculate projected pixel intensities for the surface points. More accurate method for rendering Int normal d apply. * aa terpolate vectors and aj y illumination model to each surface peint PROCEDURE ed ‘Scan line 1. Determine average unit normal vectors at each polygon vertex Hy, 2. Linearly interpolate the vertex normals cover the surface of the polygon 3. Apply an illumination model along each scan to calculate projected pixel intensities for the surface points” Gouraud Vs Phong Shading * Gouraud shading is faster than Phong shading * Phong shading is more accurate

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy