Viva Viva questions(Computer graphics) 1. Definition of computer graphics(CG) It is a branch of computer science which deals with creation, manipulation & storage of images in computer ! applic applicati ation on area areass of of CG CG C"D,#resentation graphics,Computer art,$ntertainment,$ducation & %raining,Visualiation, Image #rocessing '! $plain $plain the func function tion of initg initgrap raph()! h()!
initgraph initialies the graphics sstem b loading a graphics driver from dis* (or validating a registered driver), and putting the sstem into graphics mode! %o start the graphics sstem, first call the initgraph function! initgraph loads the graphics driver and puts the sstem into graphics mode! +ou can tell initgraph to use a particular graphics driver and mode, or to autodetect the attached video adapter at run time and pic* the corresponding driver! dri ver!
! $plain $plain the paramete parameters rs in in initgr initgraph( aph()! )! -or initgraph there are three parameters
They are .graphdriver , graphmode & pathtodriver
1)
.graphdriver Integer that specifies the graphics driver to be used! +ou can give graphdriver a value using a constant of the graphics/drivers enumeration tpe!
graphics/drivers constant D$%$C% CG" 3CG"
0umeric value 1 (requests autodetect) 2
$G" $G"4 $G"3505 I73862 9$:C3505 "%%11 VG" #C';1
' 6 4 ; 8 < 21
).graphmode Integer that specifies the initial graphics mode (unless .graphdriver = D$%$C%)! If .graphdriver = D$%$C%, initgraph sets .graphmode to the highest resolution available for the detected driver! +ou can give .graphmode a value using a constant of the graphics/modes enumeration tpe!
').pathtodriver >pecifies the director path where initgraph loo*s for graphics drivers (.!7GI) first! 2! If the?re not there, initgraph loo*s in the current director! ! If pathtodriver is null, the driver files must be in the current director! 6)@h we are giving it as gd=D$%$C%! %hen the init graph will automaticall detect the graphics driver and itAs mode! 4):esolution! It is defined as the maimum noB of points that can be displaed with out overlap on aC:% 5: It can be defined as the noB of points per centimeter that can be plotted horiontall or verticall $GB 4181 811411 1;48 :esolution of our monitor is 4181
;)"spect ratio :atio of noB of points in the horiontal to the noB of points in the vertical Commonl used aspect ratio is B'
8)$plain raster scan & random scan displas In raster scan sstem electron beam is swept across the screen one row at a time from top to bottom! 9ere the electron beam returns to the leftmost position one line down & scan again & repeat this to cover the entire screen! 7ut in random scan sstems the electron beam is directed onl to the parts of the screen where a picture is to be drawn <)9oriontal retrace It is the returning of the electron beam to the leftmost position of the screen one scan line down (in raster scan sstem) 21)vertical retrace "fter scanning all the scan lines in the screen the electron beam returns to the top most positions in the screen to start the scanning process again!this diagonal movement of the electron beam is called vertical retracing 22):efresh rate It is the noB of times per second that the screen is refreshed It is measured in 9ert! Common refresh rate values are 64,41,46,81,86,<1,211,21 etc 2)#iel(picture element) It can be defined as the smallest sie obect or color spot that can be displaed & addressed on a monitor 2')Vector graphics Images are composed of paths It use mathematical relationships between points & path connecting them to describe an image 2):aster graphics Images are composed of piels!:aster images are *nown as bitmap image!
26)Displa processor or graphics controller #urpose is to free the C# from graphics operations 3ain tas* is scan conversion scan conversionB it is the process of digitiing picture definition given in the application pgm in to a set of intensit values to be stored in the refresh buffer
24)Displa list Graphic commands are stored in the displa file It is a file storing all commands & when this file is interpreted image is displaed on the screen! 2;)$plain the following algorithms DD" line drawing 7resenhams line drawing 7resenhams circle drawing 3idpoint circle drawing 28)Disadvantages of DD" line drawing algm time consuming • accumulation of round off errors • it is orientation dependent! • 2<)"dvantages of 7resenhams line drawing algm "ccurate & efficient • "voids round off function • ses incremental & integer calculations • 1)@hat is the initial decision parameter of! a) 7resenhams line drawing p1=dEd b)7resenhams circle drawing p1='Er c)3idpoint circle drawingp1=6Fr 2) 0ame two graphics standards Generall accepted standards for CG are GH>Egraphics *ernel sstem #9IG>Eprogrammers hierachical interactive graphics sstem
'!$plain 8 wa smmetr of a circle Circle is smmetrical!smmetrical abt ,+ & diagonal ai! "ll piels around a circle can be generated b calculating onl the points with in the sector from =1 to == (6 deg)!beco if we get one point we can find other ; points beco of the smmetr of the circle!
!$quation of line =mJb
6! $quation of a circle J=
4!$quation for translation,:otation & scaling %ranslation
@here
2=J t 2=Jt t & t are translation distances
:otation
2=r cos(K JL) = r cosK cosLErsinK sin L 2= r sin(K JL) = r cosK sinLJrsinK cos L >caling 2=.s 2=.s ;!$plain transformation matri for a)translation b)rotation c)scaling d)reflection e)shear 8! $plain 0ormalied device coordinates %he are device independent units! • In these unit screen measures 2 unit wide & 2 unit high •
It is the mapping of a part of world coordinate to view port coordinate '1!>teps in windowing transformations >tepsB 2) construct world coordinate scene using modeling coordinate transformations ) convert world coordinate to viewing coordinate ') map viewing coordinate to normalied coordinate ) map normalied coordinate to viewport coordinate '2! $plain Viewport %his is the rectangular region in the screen which is selected for displaing the obect '!$plain #oint clipping ''! $plain line clipping '$plain Cohen >utherland line clipping "lgorithm steps 2! find the bit region code of the two end points of the line! $ach bit in the region code is set according tothe following 7it 2 is set if M wmin ie if ithe end point is left 7it is set if Nwma ie if it is right 7it ' is set if Nwma ie if it is below 7it is set if Mwmin ie if it is top
! chec* whether the line end point is completl inside the clip window If line end point is completl inside the clip window then the region code of the line endpoints are 1111 '! chec* whether the line end point is completl outside the clip window! %his is done b perfoming logical "0D operation of the region code & if we get 2 as result then the line is completl outside the clip window !
chec* for intersection with vertical or horiontal boundar and find the new intersection points i f the intersection of the line is with the vertical boundar then its new value will be wmin or wma and new value will be according to th eqn =2Jm(E2) , if(2,2) & (,) will be the line end point coordinate , will be wmin or wma
i f the intersection of the line is with the horiontal boundar then its new value will be wmin or wma and new value will be according to th eqn =2J(E2)Fm , if(2,2) & (,) will be the line end point coordinate , will be wmin or wma
'6!$plain >utherland 9odgeman polgon clipping '4! $plain #arrel proection 9ere the view of a 'd obect is generated b proecting points on the obect surface along parallel lines on to the displa plane! ';! $plain perspective proection 9ere the view of a 'd obect is generated b proecting points on the obect >urface along converging path to the displa plane! '8! $plain Ouadric surfaces!give egB >pheres,ellipsoids,tori,paraboloid,hperboloids 'pline! >pline curve refers to an composite curve formed with polnomial sections satisfing certain boundar conditions at the end points 2! $plain approimation spline In it the curve doent pass through an of the control points ! $plain interpolation spline In it the curve pass through all of the control points '! $plain control graph It is a set of connected line segments connecting the sequence of control points! It is usuall displaed to remind the a designer abt the control point ordering ! $plain conve hull It is a conve polgon boundar enclosing the set of control points 6!$plain different parametric continuit conditions Pero,first & second order
Pero order parametric continuit It ensures that the two curves meet at a common end point! -irst order parametric continuit It ensures that the curve is ero order continuous also their parametric first derivative(slopes or tangents) are equal at the oining points! >econd order parametric continuit It ensures that the curve is ero & first order continuous also their parametric second derivatives are same at the intersection
4!$plain different geometric continuit conditions Pero order geometric continuit >ame as Pero order parametric continuit -irst order geometric continuit It ensures that the curve is ero order continuous also their parametric first derivative(slopes or tangents) are proportional at the oining points! >econd order geometric continuit It ensures that the curve is ero & first order continuous also their parametric second derivatives are proportional at the intersection
;!differences between geometric & parametric continuit! Geometric continuit describes the shape of the curve and the parametric continuit describes the shape but it add restrictions onthe speed with which the parameter traces out the curve 8!7eier curve! It is a miture of interpolating & approimation splines! It has interpolated end points & or more approimated intermediar c ontrol points
#(u)=
#* 7e *,n(u)
@here 7e *,n(u)=C(n,*) u* (2Eu)nE* 61!7lending function of 7eier curve 7e *,n(u)=C(n,*) u* (2Eu)nE* 62!#roperties of 7eier curve 7eier curve alwas passes through first & last control points • 7eier curve alwas lies with in the conve hull of control points • 7eier blending functions are all positive and their sum is alwas 2 •
6! $plain 7eier surfaces!$quations! 6'!7spline curve!Eblending function
$quation of 7spline curve is #(u)=
# * 7 *,d(u)
6!difference between 7eier & 7spline curve! beier
bspline
Interpolate 2 st and last control points & approimates all other points Degree depends onthe noB of control points
"pproimates all control points
2
Degree is independent of the noB of control points
'
0o local control over the shape "llows local control over the shape of the curve of the curve 66!#roperties of bspline Curve has the degree dE2 • -or nJ2 control points the is drawn with nJ2 blending functions! • 7lending functions is defined over d sub interval in the total range of u • %he range of parameter u is divided into nJdJ2 sub intervals • 64!%pes of 7spline! niform B 9ere the spacing between the *not values is constant 0on uniformB>pacing between the *not values is not constant 5penBcombination of uniform & non uniform 7splines 6;! $plain 7spline surfacesEequation 68!$plain boundar & flood fill algorithm! 6
4! 9ow will ou determine that a line is completel outside a clip windowR :efer qnoB' 4'! ! 9ow will ou determine that a line is completel inside a clip windowR :efer qnoB' 4!difference between boundar fill & flood fill algm 7oundar fill algm fills the polgon b chec*ing the boundar colour but flood fill algm fills the polgon b chec*ing the previousl filled colour 46!Disadvantages of raster graphics @hen the raster images are scaled up it produces aggies(stair case • appearance) :aster images require high resolution • Can be overcome b anti aliasing • anti aliasing • It is the application of subtle transition inthe piels along the egdes of images to minimie the agged effect! 44!"dvantages of vector graphics vector images are smooth at an sie or resolution •
4;! illumination model lighting model or >hading model is used to calculate the intensit of light that we should see at a given point on the surface of obect 48!surface rendering >urface :endering algorithms uses the intensit calculations from the illumination model to determine the light intensit for all proected piel positions for the various surfaces in a scene 4< !Diffuse :eflection Diffuse reflection is the reflection of light from an uneven or granular surface >uch that an incident ra is seemingl reflected at a number of angles ;1 !>pecular reflection >pecular reflection is the perfect, mirrorEli*e reflection of light from a surface, in which light from a single incoming direction (a ra) is reflected into a single outgoing direction! ;2! Illumination models tpes
Socal Illumination = direct illumination E considers light traveling directl from source to surface $gB for local illumination models are "mbient Sight model Diffuse :eflection model >pecular reflection @arn model
Global Illumination = indirect illumination E ta*es into account reflection of light from other surfaces $g of global illumination model is :a tracing
;!different visible surface dection methods ! •
7ac*Eface detectionFremoval $plain
•
DepthE7uffer 3ethod
$plain
•
•
"E7uffer 3ethod ! $plain
• •
>canESine 3ethod
$plain
;'!@hich visible surface dection method is used in the case of transparent surface "E7uffer 3ethod •
;!@hich visible surface dection method is used in the case of overlapping surfaces >canESine 3ethod ;6! Different #olgon rendering methods •
•
Constant intensit shading (-lat shading)
•
Gouraud shading
•
#hong shading
$plain
$plain
$plain
;4!what is the main difference between gouroud shading & phong shading In gouroud shading first we determine the average unit normal vector at each polgon verte %hen "ppl an illumination model to each verte to calculate the verte intensit! "nd finall Sinearl interpolate the verte intensities over the surface of the polgon! 7ut in phong shading first step is same ie determining the average unit normal vector at each polgon verte %hen Sinearl interpolate the verte normals over the surface of the polgon and at last "ppl an illumination model along each scanline to calculate proected piel intensities for the surface points! ;;!@hat are mach bands! •
In Gouroud shading ,the inear intensit interpolation can cause bright or dar* intensit strea*s to appear on the surfaces of polgon and the are called mach bands
;8!$plain ra tracing ! Ray Tracing is a global illumination based rendering method.
Ra y t r a ci ngi sar e nde r i ngt e chni quet ha tc al c ul a t e sa ni ma geofas ce neb y si mul a t i ngt hewa yr a ysofl i ghtt r a veli nt her e alwor l d. 79.Explain Gamma correction of intensity
! Gamma correction controls the overall brightness of an image! Images which are not properl corrected can loo* either bleached out, or too dar*! %ring to reproduce colors accuratel also requires some *nowledge of gamma! Varing the amount of gamma correction changes not onl the brightness, but also the ratios of red to green to blue!Gamma correction also plas a big role in ma*ing images for the @@@! 81! Explain Dithering Dithering is an imaging technique which allows a bitmap or a bitmapped de!ice" such as a screen or printer# to appear to display more colors than are actually possible. •
$f the bitmap or bitmapped de!ice# only allows blac% and white" dithering can be used to produce an illusion of gray.
•
$f the bitmap or bitmapped de!ice# allows a palette of colors" then dithering can produce an illusion of more colors being displayed than are in the palette.
&'.Explain fractals. &(.Explain classification of fractals &).Explain the application of fractals *ractals are used to model natural ob+ects li%e mountains"clouds plants and coastlines etc ha!ing irregular or fragmented features. &,.Explain morphing