New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Interactive Comp Graph

by: Marian Kertzmann DVM

Interactive Comp Graph CS 5610

Marketplace > University of Utah > ComputerScienence > CS 5610 > Interactive Comp Graph
Marian Kertzmann DVM
The U
GPA 3.78

Charles Hansen

Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Charles Hansen
Class Notes
25 ?




Popular in Course

Popular in ComputerScienence

This 59 page Class Notes was uploaded by Marian Kertzmann DVM on Monday October 26, 2015. The Class Notes belongs to CS 5610 at University of Utah taught by Charles Hansen in Fall. Since its upload, it has received 54 views. For similar materials see /class/229977/cs-5610-university-of-utah in ComputerScienence at University of Utah.

Similar to CS 5610 at The U

Popular in ComputerScienence


Reviews for Interactive Comp Graph


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/26/15
OpenGL 20 Logical Diagram Fragment Processor Flexibility for texturing and perpixel operations pixel Fragment processing replaces the following i d iueS rPixel Zoom 7 p5 on in erpola e Va rTexlure access rTexlure application 09 7 Color Burn 7 Scale arid b as 7 Color matrix FP does NOT replace snaoing model Diinenng Coverage Plane masking Pixel ownersnip lest Histogr ClSS irirnax Slipple Pixel packing arid Aipna lest unpacking Depth lest Ste ii lest Aipna oienoing Logi ai ops Fragment Processor Overv39ew OpenGL Fixed Function Fragment liii GL2 Fragment Generalize Input W W 39 i i m i ii Standard OpenGL Texture Blending Register Combiners on GeForce3 GeForce 3 Fragment Ops Limits l 39 Em H 1 Fr Derivatives Can take derivative wrt screen xy ofany expression inside a 39agment program Exploits parallelism difference wl neighbors Radiosity Pram Earhart lEI39aannF Wallace and Greenber39g 19E l From Email il39armmza Grmnbarg angina 1934 an i f Ilf39rt39ii 1 men n M Eflf lli u quot is I r Ebertrun L l i39l39i39J Iril sII 1 ch Irilim fi on Elm Hamming John Ferram Eonstructltiri in Wood iii ayli ht Emmiririlmniia iiitirmlll Radiosity Enclosures Bi total rate of energy leaving surface i per unit area sometimes called flux Fluquotx contains 2 parts Surfacoj Bi 2 El piHi Ei rate at which the surface I emits energy as a source piHi rate at wh ch the incident light energy is reflected back into the environment N surfaces pi reflectIVIty of the surface Hi radiant energy incident on surface I Incident flux Z flux from all surfaces Figure 5 81 A hypothetical enclosure N Hi ZBJ39A 11 F1 Ai N N 7 3 m Radiosity reciprocity relation 39AiFij iAij39i Radiosity reciprocity relation 39AiFij VAiji N N AFI AiF d l i1 Radiosity reciprocity relation 39AiFij VAiji AjF N xiFu N HFXBj ri HFXBj x jl 3931 Radiosity reciprocity relation 39AiFij VAiji N N AFR AF Hz 21ij H1 21ij i1 1 Radiosity Equation Bi Ei piHi N B1 Ei Pi ZBjFij i1 Radiosity Enclusures mum um Figun H Ahypulimum mxriasum Classic Rudicsil y Power balume Kigali i128 if a 4 film Linear system of equalians i r Bi suns um u Radiosity Form Factors Rad iosity Form Factors a Fu 2 Hum m 31 Classic Radiosin Algorilhm Mgsh Surfuin Emu Emuquot umpma Farm Fudurs mam llama solquot Lima m hominid and away Salniun mu m n Simple Room Szene Table in room sequenze from Cohen and Wallam m patches visible lo path I palcllv smmmgmamy mm a m nu mg n m ma on pauwllgv u m mm m imm muthuvnurnnnwxl Hun mmqu mm i lnwdll mun v m WWW mu m uiutiM Ii quotmquot Hemicuhe Delta Form Factors mm iv an in r whiplth Igt nuuh Distributing the Energy For hierarchical methods each path is multi resolution I m m r n L Solve linearsystem J 1 tr My Diagonal dominant i rm arr l n I Use GaussSeldel Hierarchical methods Do interaction between 2 faraway groups of patches all at once Hierarchical Radi sity Usually an adaptive hierarchy is used mm halo 2 r Hierarchical methods Accuracy initial condition k Uniform Mesh Reference Solution Table in room sequence from Cohen and Wallace I 4 l v am csuu ham 1 Arlifacis Increasing Resolution A o yshadows quot quotquot quot5 3 Missing leaiuns CMac n s D Inappropriate shading dimminumes E Unresolved disconlinuilie mu tum n sm India v Adaptive Meshing Discontinuity Mesh wallnunquot 4 l ms u 4e s 2 e 9 run Cumphquot l ul we Summary Remember assumpviens Dilluse reflectance ygons mm to relax assumpfinns Compukl nn challenges Meshing Cumplex inpnv geumuny Cumplexily due ns sneaews Dense oupling I Ulll l makix demerits Hi leads Io 0m ulgoriinm ignoring dismn nui es ssm wquot n m mum 5m m2 OpenGL Relook at equations ApprOXImate onebounce ltem buffer rendered frurn llgnt item buffer ls scanned by rnulllple CPU to determlrle puiyguns Wnlen re em maxlmum Energy Flrstbuunce ufbngntestpuiyguns appruxlmated by pulnt llgnls Only one pass lfp ls number ul plpES than 8 ylnual llgnls used Nu ylslblllly SlrlEE lrltErlSlty uf ylnual llgnts ls luvv lncurrect lllumlnatlun ls nut nutlceable lrl musi SCENES Indirect lighting Locauorl of 240 vlrtuai lghts Result Tlme 15 Seconds 7 7 Slide Credits IcguPEG Pat Hanrahan Stanford 083488 Pete Shirley Siggraph 98 Radiosity Course Shadows quot Thanks to Fr do Durand and Seth Teller MIT Shadows Realism Depth cue Spatial relationship between objects cam tlevlaoA Spatial relationship between objects Spatial relationship between objects cam mums c am new Spatial relationship between objects Spatial relationship between objects cEaal sierra s m new Shadows add visual acuity Shadows and art Wiihu m Only in Western pictures here Caravaggio Shadows and art Duality shadowview Shadows asthe origiri ofpainting A point is lit ifit is the visible from m light souree 0 s Shadow 0 computation Very similar to view Coroners W i Shadow ray Ray from visible point to light source If blocked discard light contribution One shadow ray per light Optimization 7 Stop a er rst intersection don t Worry about tmin 7 Test latest obstacle rst I Raycasting shadows g 1652 Early plcmms mannered mm my muan Cutlrlusy 01 Arthur Altpl lHM n Watson Rusnurcn Cenle 14 Local vs Global lllum1nat1on Global Shadows Core OpenGL uses local illumination model A point is in shadow if the light got blocked Light sources used distant Pointy Spot between the light source and point 7 Pros Lnjvl Smut Fast calculation of pixel color using Phong only needs 7 Posttlon amp dtrectton ofltght source 7 Matertal properties dtffuse specular arnbtent coeff r Ltgntsetttngs tntenstty falleoff color but nu infu abnut mher nbjecu in the some Each pnrnlu39ve can be processed Independently of others 7 Cons Goodlooking images need global effects e Re ectedllghte g environment mapping Need mask that contams 1nformat1on about Shamquot blocked non blocked pixels 16 Fake methods OverV1ew Project Shadows Shadow map 9 7 Imageprecision texture mapping Shadow volume 7 Object space So shadows 18 Planar Projection Projected Geometry Render a groundplane Render an object Render an object Then render the object again but this time 7 Projected onto the plane 7 without light so that the shadow is black Halftransparent using blending to avoid completely dark shadows 7 Avoid multiple darkening on one spot by using or nary zbuffer checks BlinnSS M2 and my kg shaduw 7 sh dows for selectedlarge receiver polygons Gruun plane Walls Projected Geometry Projected Geometry Examplemz plane aty0 Transformation as 4 by 4 matrix 571x00 00005 071150 Projected Geometry Projected Geometry General case receiverpolygon in plane E 4x4 matrix seeBlinn Basic algorithm 7 Render seene full lighting M formation modelyiew Render seleeted oeeluder geumetxy e DarkenElack Planar Shadows Constructing a Shadow Matrix Shadaw is projected into the plane or the oor wsmumr1smvumuwmddm smqmosnm mmdnvum V n4447n4u411m nutmrnwrmlrrwnlrhnnmm s wound 25 26 How to add shadows 7 How to add shadows 7 Can be done in two ways 7 Zmd cumectmethud Usemask fureaehhght 7 15 method Full illumination darkening FB DrffuseTexEl Lxght Mask Lxghtl Mask LnghtZ quot MaskZ ma 7 DiffuseTexO Lighto Lightl Lightz xfplxel m m shadow thh respect to Lxght Mask 1quot PM umensmsmmmuspmmths 39 mpxsnsmbyugnx u 1 was an sum 9ng st saw edge This is wrong since the contribution ofLightll m is also affected Accumulatmn uf Light quot Mask canbe dune usmg adamve blendmg 27 22 How to add shadows 7 How to Render the Shadow Algorithm 7 Render scene with ambientxllummahun Unly Rmder SEWu black shadnw cnlnr an up nfwhatzver 7 Fur eaehhght suuree 39he nnr appmrznms 39 Rmdnscem thhx lxmmhm 39am mummy E EMMEWL BLEND Scaledlummhmbyshadawmask 9quot F 5GL7SRC7ALFHAv Amp smmm me we GLJNLM NUSERCALFHA 39 gDimhl GLiLlGHTING che the SEWu black Expenswe but correct gcmmm v v v s SpeedUp 7 Use mure hgms amssksm unepass Mllshmmiw Masks madasuxm s Frnject the shzdnw glM tMatrbd39GL nzt nnrshzdnw A mskssmu usn e a smmtms my p g g 9 drawninnssuro gwanzmxo 3n Not Quite So Easy 1 Not Quite So Easy 2 Without stencil to avoid double blending the shadow pixds Notioe darks spots on the planar shadow Stilminn barstensrlm zen an lborwithstensii irons an shadow ifslznlilis one lfsllzduw39s sunsntestpassessetstensiitotwo Nu donbleblending 3 There s still another problem even irusing stencil to avoid double blending depth bulrer z ghting artiracts Shadow lights with depth values from the oor plane Use polygon olrset to raise shadow polygons slightly in z 32 Not Quite so Easy 3 Planar Projection Good Bad Notice right image s re ection falls 01quot the floor I ame problem with Sha owsi 33 Fast e Can be done with amatrix operation Easy e Just use the Modelview transform Very unrealistic e Just planar shadows Projected Geometry Fake shadows using textures Problems e zFightin Use bias when rendenng shaduwpulyguns Use steneil buffer nu depth test e Bounded reeeiver polygon 7 Use stennl buffer restnet drawing tn reeeiver area e shadow polygon overlap 7 Use steneil eeunt onlythe rst pixel gets througi Separate obstacle andreceiver Compute bw image of obstacle from light Use projective textures image 39um light souree BW image ufubstaele Final image memldollsrahmus mellm mamas 36 Fake shadows using textures Shadow maps Limitations Image 39nm light suuree BW image ufubstaele Fleming Mann some no1 1m mm Final image 37 Use texture mapping but using depth Zpasses at least 9 a E e Cumpute nal image 11s 1m Faky o 1 cmpmx new moo ma Plumequot 32 Shadow map look up Shadow map look up 39 We have a 3D point nysZ 39 How do We look up hi H1111 the shadow map 11s 1m nky o 1 new new moo ma Humequot 39 We have a 3D point Xsysz How do we look up the shadow map Use the 4x4 camera matrix from the light source We get X VY VZ Test ShadowMapx y ltz x39y39139 quot ixg1139 quot 11s 1m Faky o 1 cmpmx new moo ma Plumequot 4n Shadow maps Shadow maps In Renderman e Highend production so ware Can be done in hardware ware texture mapping s uvw generated usmg 4x4 matrix ardware permts tests un texture v ues G Imagespace shadow deterrn39nation 7 Lance willrarns published the basic idea in 1978 By corncrdenc sarne year a geat vintage year for gaphl 7 Completely imagerspace algo th means no lmowle ge ofscenes geometry is required rnust deal with aliasing artifact 7 Well lmown so s are rendering technique Prxars RenderMan uses the algorithm Basic shadowing technique for Toy story etc Introducing Another Technique Shadow Mapping irn Bllnn invented bump rnapping cs I Important SIGGRAPH papers 7 Lance PH 78 H87 7 Mark Segal et al SGI Fast Shadows andL Effects Using Texture Mapping SIGGRA e Wil iarn Reeves David Salesin and R0 ert Cook Pixar Rendering antialiased shadows with depth maps SIGGRAP ighting H 92 Shadow Mapping References Williams Casting Curved Shadows 0n Curved Surfaces SIGGRA The Shadow Mapping Concept 1 Depth testing from the 1ight s pointof view 7 Two pass algorithm 7 First render depth buffer from the 1ight s point ofView 39 the result is a depth map or shadow map 39 essentially a 2D function indicating the depth of closest pixels to 39 t 7 This depth map is used in the second pass e For each rasterized fragment used to create the dept rnap map to fragment s light posi The Shadow Mapping Concept 3 The Shadow Map Comparison 7 Two Values A 7 2 value from depth map at fragment s light xv position B 7 2 value offragment s xvz light position 7 HE is greater than A then there must be something closer to the light than the fragment then the fragment is shadowed 7 If A and B are approximately equal the fragment is lit The Shadow Mapping Concept 2 I Shadow determination with the depth map 7 Second render scene from the eye s pointofview determine fragment s XYZ position relative to the light this light position should be setup to match the frustum compare the depth value at light position xv in the depth 39 39on Z Shadow Mapping with a Picture in 2D 1 The A lt B shadowed fragment case depth map image plane depth map 2 A 303 II light eve poshoh eye view image i fragm eht s an i a k a the frame buffer lightz B Shadow Mapping with aPicture in 2D 2 Shadow Mapping with a Picture in 2D 3 The A E unshadowed fragment case depth map image plane depth mapZ A eye pusitiun eye WEW image plane a k a the name Mai i I iiagmem s 1 iigm z a 49 Note im age precision mism atch The depth map c uld be at a ditterent resolution mm the iramebutier This mismatch can lead to ariltacts Visualizing the Shadow Visualizing the Shadow Mapping Technique 1 A fairly complex scene with shadows the point light source Mapping Technique 2 Compare with and without shadows with shadows without shadows Visualizing the Shadow Visualizing the Shadow Mapping Technique 3 The scene from the light s pointof View FYI from the eye 395 pointorvieu again Mapping Technique 4 The depth buffer from the light s pointof View FYI fromthe again Visualizing the Shadow Visualizing the Shadow Mapping Technique 5 Mapping Technique 6 Projecting the depth map onto the eye s View Projecting light s planar distance onto eye s View FYI depth ma Iight39s pointofw39ew again 55 55 Visualizing the Shadow Visualizing the Shadow Mapping Technique 6 Mapping Technique 7 Comparing light distance to light depth map Scene with shadows Nongreen is where shadows should 7 Problems with shadow maps Field of view problem Field ofview What ifpoint to Bias shadow is outside i eld ofview of w Aliasing 39 shadonap 7 7 5 Use cubical shadow 7 7 map M i Use only spot lights l l 59 Problems with shadow maps The bias nightmare Field ofview For a point visible from the light source Bias ut u ShadowMapx y xsz 39 Allasmg Avoid erroneous self shadowing J 61 e The bias nightmare Bias for shadow maps Shadow ray casting 39lk ShadowMapx y bias lt 2 Choosing the good bias value can be Very tricky biastoo Iatge gt shadow leaks Construct Light View Depth Map Justi cation for glPolygonOffset Realizing the theory in practice unfortunately depth values tend to requre more precision than 87bit typical for textures depth precision typically 16rbit or 247th When Constructing Shadow Maps Depth buffer ruhtams winduw spacequot depth values 7 emperepecuw uuuemmmtm mm 7 glPalyguerfsztxs guumgeuu be Mum We term Dumg a clip spacequot ngranslatefis hut suf cient e cummm mm mm mummmmm 7 Actual bus in d 7 Na We mum step arpuygm pthhusrer uutswut vuyaverthz hum Depth Map Bias Issues How much polygon offset bias depends Too little bias everything begins to shadow Too much bias shadow starts too far back Just right 67 Selecting the Depth Map Bias 0 Not that hard Usually the following works well glPolygonOffsetscale l l bias 4 0 Usually better to error on the side of too much bias adjust to suit the shadow issues in your scene Depends somewhat on shadow map precision more precision requires less ofa bias When the shadow map is being magnified a larger scale is often required Problems with shadow maps 0 Field of View licil 1W LVN Aliasing 69 Shadow map aliasing Undersampling of shadow map 0 Reproj ection aliasing 70 Alaising Finite shadow map resolution 0 Result pixelized shadows 71 Shadow map ltering 0 Does not work Filtering depth is not meaningful Surface at z 498 xlt lt498 j 39 gt gt 229 1 3 Ordinary texture map filtering Does not work for depth maps 72 12 Percentage closer ltering Percentage closer ltering Filter the result of the test But makes the bias issue more tricky Surface at z 498 502 500 500 lt498 x4 501 12 11 o 1 1 tilEeE 55 13 14 12 I 1 1 1 Sample Transform Step 73 5X5 samples Nice antialiased shadow Using a bigger lter produces fake soft shadows But makes the bias issue more tricky Shadows in production Movie Time Often use shadow maps Ray casting as fallback in case of robustness issues Alaising Bad aliasing cases Large Scenes High resolution shadow map required Closeups to shadow boundaries Zoom in Shadow stretches along the receiver 77 76 Aliasmg Duelling frusta Light shines opposite to Viewing direction 78 l3 Aliasing Four Images of Dueling Frusta Case Duelling frusta 7 Resolution mismatch Euer View Light s View Eger View with pyoieaioa ofcoloreoaea miynuxp levels pom light Red mini cuvl39nn Lighth View with repny39eax39nn nfubove image harm the eye 80 Interpretation of the Images Dueling Frusta Blocky Shadow of the Dueling Frusta Case Region mat is smallest 599quot region that is large View in me eye s view nus implies that it woala requl a veig iesolaoioa snaaow map to avoia obvious mucky snaaow eage aroiraas Lighth ew Edge Artifacts Ligla posioioa 81 82 AllaSlng Good Situation Close to the 39 3 Miner s headlamp Mlner s Lamp 7 Similar frusta 7 Similar sampling Eer 7 One shaduwmap pixel for image pixel View V similar Lighth 535quot is m eccioa woala be in aaow 3 84 Render Scene and Access the Depth Texture What is Projective Texturing Realizing the theory in practice An intuition for pmj ective textun39ng e Fragment39s ugm posmor can be generated usmg eye 7 The shde projector ana n eratxon 7 er yOperGL39sGLiEl EilmEARtexgen 7 gene re s t r e texture camamates 5 e TampL memes such receperee accelerate urgent e xehes engre echve ermrrrrg Source Wollgang Heidrich ya 25 About Projective Texturing 1 About Projective Texturing 2 Firstwhatisperspecdveconecttextudng So what is projective textun39n e Nurmal 2 ts turemzppmguses s t cuurdmates 7 MW eerrsraerhemegerreeus texture cuurdmates r ZD perspecnvercunect texture m m 7 539 L X39 q quotgt 59 U immerse me E r e ermlar m hnma mere ch camamateswhue erreerpereeermrrrymeyeepree w 1ng WW eseeem me exrvemx w W Andiw P P 39 39 7 Ideas tn have sq we rq be prujected perr 39agnent e Lmeadymterpalated thesethree parameters ever perygrr 7 mmgnmmm 5 W W e Ths requn39es aperr 39agnent under m M e Yxkes ndersm hardware are fmxlyexpemve e Remus m pexr 39agnent perspectwe canects39 r 27 22 About Projective Texturing 3 About Projective Texturing 4 Hardware designer s View oftexturing Tn clung hardware mto domg projective textures e Ferspeeuvereerreet textunng is a praeueal requirement 7 creme Wequot e1 w hardware eempmes per J m e Paypechwrcmectuxuxmg alreadyxequ es the W W W Wax Expense afapexr 39agnent nder e Netresult pmjemvelmun e Clever raee SegaL et al 92 r gem L tires Francine tilt11 e We e re re 12mg re 7 Interpalatz w mmadafamplylw r m m 5 mm 7 Saprmemve uxuxmgxspucuca y ee 1fyvu already are pewpechwrcmxectuxaxmg e Eymtezpulaung hmem swam Back to the Shadow Mapping Discussion Assign lightspace texture coordinates via exgen e Transform eye space x y z w coordinates to the 1i ght s view frustum match how the light s pth map is generated er transform these coordinates to map directly into the light view s depth map 7 Expressible as a projective transform e Load this oansfnrmintn the 4 eye hnear plane equanuns fur s T and Q ennrdinates e sq my will map to light s depth map texture OpenGL s Standard Vertex Coordinate Transform 0 From object coordinates to window coordinates out oooomaee ty 1 wt World oootomeres tx y 1 wt Eye ooototmes tx y 1 wt cttr ooototmes tx y 1 wt nomtteeo newee ooototmes txty 1 Window oootomeres m w w OpenGL s Standard Vertex Coordinate Transform 0 From object coordinates to window coordinates eye oootowteres my 1 wt om eye ooontmes tx y 1 wt Ltgmc w ooototmes ctno coordinates xy1 wt tx y 1 wt ith nomtteen newee normalized device oootomeres ordm 95 txty 1 Window ooototmes P w VD rth wmnowooontmes m w my OpenGL s Standard Vertex Coordinate Transform 0 From object coordinates to window coordinates ooyeo mootquot two wt World oootomeres tx y z w t eye oootomeres om eye ooontmes tx y 1 wt tx y 1 wt Ltgmc w ooototmes cttr ooontmes I w tx y 1 wt out yttw oyi normalized device ooontmes 1x y 1 dang none Window ooototmes P an L7 OpenGL s Standard Vertex Coordinate Transform 0 From object coordinates to window coordinates nrdm es x y 1 wt World oootomeres 1x y 1 wt tom eye ooontmes Eye ooototmes txty 1 wt txty 1 wt Ltgmc w oootomeres cwo ooototmes M y 1 wt tx y 1 wt um ayttt Dw nomyeen otewtoe ordm 95 tomam onwm Window ooontmes P w 1L7 OpenGL s Standard Vertex Coordinate Transform 0 From object coordinates to window coordinates eo oooom two wt no eye oooometes eye oooometes M y W my 1 wt Ltgm otto oooomaee cyo ooootmee x y L W tx y 1 wt nomyeen otewtoe eoonme s tx y 1 TPle1xVEquot Window ooontmes P w w OpenGL s Standard Vertex Coordinate Transform 0 From object coordinates to window coordinates on 9t 737471 33 World wormlass tx y r w am eye assumes Eye menses xiitnwl tx y z w ngMcN wordmi as y r w cm assumes x x y r w t I quotamass sieves Wm es T Pl x Vl x V571 T s x ll x Vl where S scale and bias 97 WNW eaaetnses w w w Setting Up Eye Linear Texgen 4 planem Qplane4 YE PLANE splane E PLANE Tplane Each eye plane equation is transformed by current inverse modelview matrix 7 Very handy thing for us otherwise apitfall 7 Note texgen object planes are 710 transformed by the inverse modelview Eye Linear Texgen Transform Plane equations form aprojective transform 5 Splanem Splanem Splanem Splanem X t rplanem rplanem rplanem Tplane3 yquot I Rplanem Rplanem Rplanem Rplanem 2 q aplanem aplanem aplanem aplanem we The 4 eye linear plane equations form a4x4 matrix 7 No need for the texture matrix 99 Shadow Map Eye Linear Texgen Transform ngieeGen automatically his when applies t X9 X0 modelvicw matrix containsjust the eye view ye oreu Modeling ye mushm 2 look at matrix 10 we matrix wo 12 1 s nigh i an e Inverse xe e e t 12 12 frast new 2 ye Lnreieetr im took at 2 mm mauix ma erre quotWquot 1 9 11 matrix we 1 Supply this combined transrorru to gmaeoen 100 Shadow Map Operation 39 Automatic depth map lookups 7 fter the eye linear texgen with the proper transform loaded 7 sq Uq is the fmgmmt s Correspondlng location within the llgat s depth texture 7 rq is the z planar dlstance ofthe fragment relative to the llgat s 39ustum scaled and blased to 01 e 1 rang 7 Next compare texture value at sq tq to value rq 7 If taituresq Uq erq then not shadowed 7 If testuresq tq ltrq then shadowed Shadow Mapping Hardware Support 1 I OpenGL now has of cial shadow mapping extensions 7 Depth textures 7 adds depth texture formats 7 Seebook on page 463 7 Previously ARBidepthitzxturer adds de th texture formats ARBishzdnw 7 adds percentage closerquot filtering for depth textures rhetwo extensionsareusedtoget er I Based on prior proVen SGI proprietary extensions 7 SGIXidqtthiwxmre 7 SGIXishadow Shadow Mapping Hardware Support 2 I SGIXidepthitext39ure amp SGIXishadow support 7 SGI s RealityEngine amp InfrniteReality 7 Brian Paul s Mesa3D OpenGL Workalike r NVIDIA s GeForce3 GeForce4 Ti and Quadro 4 XGL r Su fware emulatlun fur GeFurcel amp Z I ARB extensions now implemented 7 Latest NVIDIA drivers and Mesa4 0 ARBshadow APT Usage I Request shadow map ltering with ngexParameter calls 7 ngexParameteriGL7TEXTURE72 G 7 icOMPAREiMODEiARB GL7COMPARE7R7T07TEXTURE 7 Default is GLiNONE for normal ltering 7 Only applies to depth textures I Also select the comparison function 7 Either GLiLEQUAL default or GLiGEQUAL 7 ngexParameteriGL7TEXTURE72D TEXTUREicOMPAREiFUNciARB GLiLEQUAL ARBshadow Filtering Mode Performs the shadow test as a texture ltering operation 7 Looks up texel at sq tq in a 2D texture 7 Compares lookup value to rq 7 rftexel is greater than or equal to rq then generate 1 0 7 rftexel is less than rq then generate 0 0 I Modulate color with result 7 Zero iffragment is shadowed or unchanged color ifnot New Depth Texture Internal Texture Formats ARBidepthitexture supports textures containing depth values for shadow ma in I Three new internal formats 7 GL7DEPTH7COMPONENT167ARB 7 GLiDEPTHicoMPONENTZALARB 7 GLiDEPTHi omo NT ZiAkB same as 247bit on GeForce34Xbox Use GLiDEPTlIi Work with glCopySubTexrmag buffer to texture 7 NVIDIA optimizes these copy texture paths NT 139 your external format eZD for fast copies from depth Depth Texture Details Usage example glCopyTexImage 2D GL7TEXTURE72D level0 TH7COMPONENT 0 0 w256 h256 border0 Then use glCopySubTexImageZD for faster updates once texture internal format initially de ned Hint use GL7DEPTH7COMIPONENT for your texture internal format 7 Leaving offthe niARB precision specifier tellsthe drwerto match your depth buffer s precision 7 c y texture performance is optimum when depth buffer precision matches the depth torture precision Depth Texture Copy Performance The more depth valuesyou copy the slower the performance 7 512x512 takes 4 times longer to copy than 256x25 7 Tradeon better defined shadows require higherresolution shadow maps but slows copying I r 79 r are contained in 32bit words 7 Requesting a lobit depth buffer evm with 3Zrblt colorbufreo and copying to a 167bit depth texture is faster than using a 24bit depth utrer 7 Note that using lobit depth buffer usually requires giying up stencil Hardware Support Hardware Support OpenGL 14 e GLiAkBiDEPTlLTEXTU39RE internal texture format to store depth values e g1 exGen generation oflight space coordinates as texture oordinates e GL ARB SHADOW special texture mode return texturest lt r 7 Black White I PeBuffers or FBO r offscreen rendering of shadow map 7 large shadow maps sizes I GLiARBiRENDERiTEXTURE and GLiNViRENDERiTEXTURE r bind PBuffer depth buffer as depth texture rno copy needed Advice for shadowed Illumination Model 1 The Need for Dimming Diffuse Typleal rllurnrnauun rnudel wlth deeal texture wwwgruee damnapearlar e 3p supplres a shaduwmg terrn Assume shaduwrnap supphes a shaduwrngterrn hade e Percentage shrdnwed e lEIEI39 e fu yvlslhle n39 e rulysnrdnwed Ohvluus updated lllummanun rnudel fur shaduwmg mwnhmz 39uxe 39dzmlxhad 3195qu pruhlernrsrealewurld llghts don39t lun black drfluse shadrng un shaduwed surfaees e nghtsmttersralevmrldllgdtsarenutldalpulnts N drrnrnrngshadewed Wlth drrnrnrngshadewed regions have 0 duruse regions have 40 duruse and 0 specular and 0 specular A sml evrdenee of curvature glans annearunnaturally nat m shadewed regmns m lrrent facing shadewed Advice for shadowed Illumination Model 2 lllummatlun rnudel wth drrnrnrng mmudmm une urns dudwpemh and where dlffuseShade ls armreneunnreqrneunnreJnnr Easy tu lrnplernent wlth NVireglita39icumbma39s amp OpenGL l 2 separate specular calmquot suppurt Separate speeular keeps the dlffuse amp speeularperevetex lrgnung sunet results dr Wiregstericumbmers ean eurnhrne the pnrnary dlffuse and seeundary weeular eulurs pereprxel wlth the ahuve math Careful about Back Projecting Shadow Maps 1 Just like standard projective textures shadow maps ean backproject a heeded llght seuree handle e aeleenrejeenen at spotlights eene etrllurnrnatran Spatllghts at eene etrllurnrnatran where huequot shadows ean terrn Combining Shadow Mapping with other Techniques are il about Rack Prniectin Shadow Maps 2 keproj ecu on khan minimising new Sienna ht erbehind the syndigln Techniques to eliminate ban Menniesnsnew mnnsnnwnn mm h e M in teen summer mes Use i sin elm seeieensa n is Plan defmd by is light nesinenini would dmccnn inniy Avoid denying geenm behmdquot tie ign whanzyplymg is 5142de my beinmnnis Film iw smegma ohms xouciiyv mas Good in eombinanon VJILh techniques 7 se Stm l tn tag pixels as inside Dr uutside ufshaduw daring techniques in extra passes min ns 7 Shaduwmappmg canbe intemtedmtu mure cumplex meanness rendering eigenuinns Shadow mapping eigonuinn does not require access to vertexievei ata 7 Easytu mX Winn vmex piemms and such Pros and Cons Hardware Support general 7 everything that can be renda ed can cast and ieeeive a shaduw s I Register Combiners Fragment Programs 7 for shadow application 7 ifpoint is in shade leave ambient lightun anng intent light has nu engin uius cannutbe shaduwed dim diffuse light 7 seme shading remams tn shuw surface unentanun ieinove specular lig t 7 ninnnnssnsnnew 7 Weeks tugether mi vertex pmgram fast 7 full hardware suppen 7 almust nu Warhead Dr static seenes 7 twu passes needed fur iyneinie seenes robust easy to implement Aliasing Limited to light frustum NearFar plane clipping Questions Questions Overview Shadow v olum es shadow m 7 Image preeision texture mapping 0 shadow volume 7 Object space Soft shadows Explicitly represent the volume ofspaee in shadow For each polygon 7 Pyramid with point light as apex 7 Include polygon to cap shadow test similar to clipping Shadow volumes naive rendering Shadow volumes smarter rendering Pick your favorite rendering algorithm For eaeh visible point 7 For each light Fur each shaduw vulume 7 upentmse vume rentismsiunw Great hut usdy puly lgut tests fur eaeh yisihle point New way to de ne insideoutside Consider ray from eye to visible point Points lit counter 0 Hardware shadow volumes Optimizing shadow volumes Add euunter buffer Draw seene with no shading Tum offhufferupdate 1 Draw huntfaung shaduw pulyguns 8 gs s 9 go a Use silhouette edges only Problem if eye inside shadow Problem if eye inside shadow Then aeounter ofO does not necessarily rnean lit 1 Three solutions e Explicidy test eye point wn all volumes 7 Clip the shadow Volumes and inelude these new polygons r Zfail shadow volumes 7 Clip the shadow Volumes and inelude these new polygons Zfail shadow volume Zfail shadow volume Count horn inlinity Draw seene with no shading umoffb fferupdate Draw ontfacing shadow polygons r Deerement cuunter Draw backfacing shadow poly r lfzrfzil Aegis g a Litpuints have cuunteFEl Count from in nity Then we can have problems with far clipping plane Can be solved with new hardware trick 7 Depth clamp at clipping stage 7 instead ofclipping a polygon it ean he rendered with rnaxirnurn depth Questions Overview 39Lm n rrniinhiui IA Wu i rm t and l quothum m lithium unit 131 shadow map 7 Imageprecision texture mapping shadow volume 7 Object space Soft shadows and MonteCarlo ray tracing G Soft shadows Fully lit Soft shadows Radiosity Soft shadows using raytracing Send multiple rays to sample the light source Use the fraction ofoccluded rays I Traditional Ray Tracing Ray Tracingsoft shadows MonteCarlo raytracing Probabilistic sampling approach Solve the complete light trarispon equation Probabilistic alternative to raoliosity MonteCarlo computation of 7 I Take a square I Take a random point xy in the square I Test if it is inside the 4 disc x2y2 lt l I The probability is 1 4 MonteCarlo computation of 7 I The probability is 1 4 I Count the inside ratio n inside total trials I 1 m n 4 I The error depends on the number or trials MonteC arlo I Cast a ray from the eye through each pixel 13 MonteCarlo I Cast a ray from the eye through each pixel I Cast random rays from the visible point 1 MonteC arlo I Cast a ray from the eye through each pixel I Cast random rays from the Visible point I Recurse le MonteCarlo I Cast a ray from the eye through each pixel I Cast mndom rays from the Visible point I Recurse 24 MonteCarlo MonteCarlo 39 Systematically sample primary light 39 Take BRD eg Phong model into account 7 Multiply incoming light A Radiance rendering system Ward Radiance rendering system Ward 1 Radiance rendering system Ward Variation Photon mapping l 39 Animation by Henrik Warm Jensen 25 Next week Graphics hardware An Interactive Introduction to OpenGL Programming Double 39 39E I Bufferins a Buffers m E r x Animation Using Double Depth Buffering and Bu ering Hidden Surface Removal 9 Request a double buffered color buffer qlutInitDisplayllodel cum ms I leil lovbli39 1 7 m Cl ear color buffer gal1 Glical oxiavrrixiazT 1 scene l mu Na swap of front and back buffers M M s glut Swap uffers mm 7 I Repeat steps 2 4 for animation Depth Buffering Using OpenGL iii Request a depth buffer gnu toisplayxrmle aw me I Law 15 leiv i q1 lea at 101011 swam 51139 alibipmizs w rixiiazi39 r 2 Render scene 3 Snap color buffers An Interactive Introduction to OpenGL Programming Other Buffers I Color buffers I Front L amp R Back L amp R I An ary Depth Accumulation Stencil Accessing Accumulation Buffer op I operations I Request them I Enable use amp masking Specify behavior I within the accumulation buffer GLADD GLMULT I 39om read buffer GLACCUM GLLOAD I transfer back to write buffer GLRETURN lAccumGLACCUM 05 multiplies each value in write buffer by 05 and adds to accumulation buffer Full Scene Antialiasing Jittering the View I Each time we move the viewer the image shifts I Different aliasing artifacts in each image I Averaging images using accumulation t buffer averages ou these artifacts l I El 1A Accumulation Buffer 0 Problems of compositing into color buffers I limited color resolution I clamping I loss of accuracy Accumulation buffer acts as a oating pointquot color buffer I accumulate into accumulation buffer I transfer results to frame bufer Accumulation Buffer Applications I Compositing Full Scene Antialiasing Depth of Field Filtering Motion Blur Depth of Focus Keeping a Plane in Focus I Jitter the viewer to keep one plane unchanged BackPlane 4439 From Plane Focal Plane eye pos2 An Interactive Introduction to OpenGL Programming Depth of Field Motion Blur Fragment Operations Scissor Box Additional Clipping Test ngcissor x y w h any fragments outside of box are clipped useful for updating a small section of a viewport Scissor test Alpha Test Reject pixels based on their alpha value glAlphaFunc fume value glEnahle GLALPHAEST 39 use alpha as a mask in textures An Interactive Introduction to OpenGL Programming Stencil Buffer Used to co drawing based on values in the stem buffer 39 Fragments that fail the stencil test are not drawn 39 Example create a mask in stencil buffer and draw only objects not in mask area ngtencilFuncfunc ref mask A Bitwise mask for comparison using func How to set the stencil Controlling Stencil Buffer glstencillmnc func ref mask 39 compare value in buffer with ref using fune 39 only applied for bits in mask which are 1 fune is one of standard comparison functions glstencilOp fail zfail zpass 39 Allows changes in stencil buffer based on passing or failing stencil and depth tests GLKEEP GLINCR ngtencilOpfailzfailzpass Pass Stencil Pass Depth 1 Creating a Mask glInitDisplayMode GLUTSTEIICILI g1Enab1e GLSTEIICILTEST 39 glclearstencil 0x0 glstencili unc GLALWAYS 0x1 0x1 glstencilop GLREPLACE GLREPLACE L LA E draw mask An Interactive Introduction to OpenGL Programming Using Stencil Mask I u Qt draw objects where stencil 1 ngtencilFme GLNOTEQUAL 0x1 0x1 ngtenCilOp GLKEEP GLKEEP GLKEEP draw objects where stencil Example Room w Window Room with a view Room with a view 1 Turn on color buffer 1 Turn on color buffer 1 glColorMasWFrFF 2 Turn on depth putter updates 2 Turn on depth putter updates 2 lDepmMaskF 3 Turn on st lbuff 3 rn on s lbuff 3 glEnabiestenoHest 4 Setup the stench test 4 Setup the stench test 4 Q SIenCilFWdADW 5 Dra e wr ow 5 Draw the wrndow 0W grStencrrOpWR 6 Sets up the stencil testror background 6 Sets up the stencil testror background 5 Draw the W ndow 7 Turn on t e color utter 7 Turn on t e color buffer 6 Stenc md 0W 8 urn on the depth putter 8 rn on the depth putter X 9 Draw the backgroun 9 Draw the backgroun ngtencilOpKKk 10 S t test to th u 10 S t test to th H 7 glColorMask T TrT M raw the wall M Draw the wal 8 rDepthMasm 12 Reset st 12 Res 9 Draw background 13 Draw any rntenor 13 Draw any rntenor 10 glsljtepcilFuncl 0x01 x M Draw wall 12 grDrsapretstencrrtest 13 Draw anythrng else Decals gt Fquot gt9 N Decaling w Depth Buffer Painter s Alg Disable depth buffer updates Draw the base polygon Draw the decal polygons Disable color buffer updates Enable depth buffer updates Draw base polygon Reset state enable color buffers An Interactive Introduction to OpenGL Programming Decaling w Depth Buffer Painter s Alg nablectDEPTHjEs 1 Disable depth buffer updatesg En 2 Draw the base polygon E DEWMEMGL FALSE 3 Draw the decal polygons 4 Disable color buffer updates gimmmsyyekmsg 5 Enable depth buffer updates 6 Draw base polygon 7 Reset state enable color buffers glCuluiMaskcthuE gloepinMaskcthuE Decaling w stencil buffer A Create a mask in the stencil buffer which defines the decal region B Use this mask in 2 passes base polygon decal polygons w ooxtmoib Decaling w stencil buffer Enable stenciling set test to always pass r l maSKZl Set stencil function to pass Disable writes to tne stencil but Turn off deptn buffering Render tne decal polygon Decaling w stencil buffer glEnable GListenclliTest ngtencllFundGLiALWWSl l l Enaplestenciling 2 Set test to always pass ngtencllOpGLJltEEP GLJERO GLiREPLACE w w 9 0 u 4 ane base i go ngtencllFundGLiEOUAL l 5 Set stencil function to pass QlSIeHCllONGLJEEF i GLJltEEPi 6 Disable writes to tne stencil but 7 Turn off deptn buffering ngl abldGLDEF THJEST 8 Render tne decal polygon ngl abldGL TENC LJEST g Regetgtate glEnableGL7DEPTl lJEST Hidden Lines Page 276 polygon offset draw twice Polygon Offset depthbuffer biasing Page 615 draw on per object basis with stenciling Correct method 9 Slide credits Dave Shreiner Ed Angel Vicki Shreiner Siggraph 2000 Math tacks Load and Mult Matrices m m M AME mumth M MatHx Sfa ks W rld COordinateISystem o This concept helps to create a scene oMuch easier than using other systems only 0 Usually considered the Identity Matrix 0 Basis for Object Coordinate System 0 Righthand System Transformations o In OpenGL transformation39are performed in the opposite orderthey arercalled QpenGL quotand Matrices a Transformation39matnces are 4x4 arrays ll39l vides mat F l h in m n Deeper look at Transformation matrices imp 39n l m u ObjectiCoordinate System 0 Used to place objects in scene 0 Draw atjorigin ofWCS 0 Scale and Rotate 0 Translate to nal position 0 glMatrixModeGLMODELVlEVV o ngcalefdx y z n glRotatefdangle x y z ningranslatefdx y z agluLookAteyex eyey eyez x y z upx upy upz Rotatio and Scaling o Rotation39and Scaling39 is done about origin G You always 39get What you expect oCorrect on all parts of model Stopped on39 Tues StackOperati39ons o gIPushMatrix o gIPopMatrix Relative Transformation A better and easier way 2 Relative transformation Specify the transformation or each object relative to its parent Hierarchical Representation scene Graph 0 We can describe the object dependency using a tree structure on cene Gra ph Transformations 0 Two ways to specify transformations a 1 Each part of the object is transformed independently relative to the origin Not reasonable for complex scenes Why 0 ject39Dependency u A graphical scene often consists of many small objects 1 The attributes of an object positions orientations can depend on others Relative Transformation Relative transformation Specify the transformation for each object relative to its parent Step 1 Translate base a d its des 1dants by 50 Relative Transformation 2 Rotate the lower anquot descendants to slocalyax b 90d Do it 39in OpenGL e39Translate base and all its descendants by 500 0 Rotate the39lower arm and its des39cendantsiby 90 degree about the local coord frame Y DO this 0 Base and everything translate 500 0 Lelt hand rotate 75 degree about the local y a Right hand rotate 75 degree about the local y Relative Transformation o Represent relative transformations usmg scene grap A more complicated example39 0 How aboutthis model ersal Program this transformation by depthfirst traversal What39s wrong we want to transform the rig hand relative to the base not to the left hand Undo the previous transformatiom39s Ope nGL Matrix StaCk o Need to save the modelview matrix right aiter we a We can use OpenGL Matrix Stack to perform matrix draw base save Push and Pop Matrix Stack Push a d Pop Matrix Stack a A simple bperiGL routine a Nested push and pop operations i push Transformation Tutorial Advanced Shading Techniques 5k H Re ection u m Re ection 39 Planar reflectors r Stenclltechnique r Textured technique Curved re ectors Interre ections Refraction Re ection Re ection 9m Unifying concepts Raytracing too expensive for any reasonably sized Image Approximate appearance of re ected objects Build second version of scene that looks re ected to eye 7 For each vertex in scene Calculate virtual vertex in re ected scene Blend that second scene with the rst somehow I Eye Minor Pmnt Re ection Rcllculcd Mirror is XY plane at some 2 point Planar Reflectors Start with re ectors which lie in a plane Mathematicain straightforward Reflectlon math Is the same forall verticas Define re ection matrix from plane Planar Reflections Panar Reflectors Dinosaur is reflected by the planar floor Easy hack draw dino twice second time has gt t I r ngcalef111to reflect through the floor gt V m But what if it s not the XY plane ul N mulrn J st like shadows Planar Reflectors Stencil buffer implementation Configure proiection and Viewmg matrix clear buffers 39 Apply reflection transformation Draw scene normally will be re ected skip mirror Clear stencil to 0 and clear depth buffer Draw mirror polygon as stencil 1 Clear color bu er everywhere stenc Plan r Reflectors Planar Reflectors Stencil buffer implementation cont39d Remove reflection transformation Modulate re ected scene by mirror color amp lighting Render remainder of scene normally skip mirr r Original Scene Re ect11 Scene rkc c 1 5m lcared ercuut in Mm Plan r Reflectors Planar Reflectors Projected texture implementation Con gure proyection and viewing matrix clear buffers Apply re ection transformation Draw scene normally will be reflected skip mirror Copy framebuffer into texture Can save just rectangular region around mirror Re ected Socnc ulalcd by lud Ongmm Scene Mirror Immutm Rand d Planar Reflectors Planar Reflectors Projected texture implementation cant d Clear buffers Remove reflection transformation Set up texture projection identical to camera plOJECtiOI39l Render mirr modulating with color and lighting Render scene normally skip mirror Original Scene Ru uotud Swnu Fwd m Planar Reflectors slugtul ll meulmffcr l lin39or Drmm Origilml Scene Silver M Lh l39 x39lu chdclod Planar Reflectors Planar Reflectors xiv hurli One last technique Shiny marble etc If you scene has a background that lls window Mirr Draw reflected scene Clear depth can have color texture lighting etc Stencll Draw modulated by re ection in framebuffer Texture Draw modulated with re ection texture Drew minor modulated Wlll39l reflection 7 May need multipass or multitexture Draw background will ll in areas around mirror Draw unre acted scene Planar Reflectors Planar Reflectors slljljlul ll lmplementa tion issues Implementation issues Can cull to a frustum that bounds mirror polygon Texture implementation may be slow f o copy to texture Need clipping plane in plane ofrnlrror Stencil buffer implementation requires stencil bufferl 7 Stuff tran stormed to front of mirror shouldn39t be rendered Could draw mirror into stencil up front but 7 Can also create skewed projection so near plane clips 7 Stencil enabled duran entire re ected scene Magni cationminlfication special effect Could just draww1th Clip planes if mirror quad r Hack for slight concavityconvexity Translate re ected scene perpendlcular to mirror lnterreflections 39 Interreflections Adding More Re ection Bounces Adding More Re ection Bounces Limit re ections to n bounces handle recursively r Render scene re ected in A Render scene reflected In both B and A clipping to intersection ofA and B on screen Add in scene re ected in A clipping to A r Render scene reflected in B Scene rctlcctcd m B Sumac mndB Un39gmal Scene 7 then re ected in A m led m r Add in original scene Recursive Planar Mirrors The Trick bird s eye view Basic idea of planar re ections can be applied recursively Requires more stencil bits OpenGL Pipeline What is it let s draw it OpenGL Terminology How are objects represented What s a Fragment What s a buffer How many and name them What s a texture Blending Blending Learn to use the A component in RGBA colorfor Blending for translucent surfaces Compositing images Antialiasing Opacity and Transparency Opaque surfaces permit no light to pass through Transparent surfaces permit all light to pass Translucent surfaces pass some light translucency 1 opacity a Physically Correct Translucency Dealing wilh lrahslueehey in a physically enneel manner is dif cult due In The cnmplexi39y nnhe ihlemal ihleraelinhs nllighl and mz er Limilalinhs nl xedrpipeline rendering w Slale Maehihe Window Transparency Look out a window What s wrong with that Screen Door Transparency glEnahieGLiPOLVGONisTlPPLEGL7POLVGON78TlPPLE gt gt Example Frame Buffer assuming 32bits Simple color model R G B 8 bits each Example 1 a channelA anotherB bits Examgle 2 Alpha determines opacity pixelby pixel a opaque a 0 transparent 0 lt a lt1translucent Blend translucent objects during rendering Achieve other effects eg shadows Compositing Blending Back to Front Front to Back Combine fragments with pixel values that are already in the framebu er nglendFunC src dst l C 11xt Imam moi Image Compositing Compositing operation 0 rce39 s ss sb sa Destination d d dg db da b b bg bb be source blending factors c c cg cb ca destination blending factors s39 Vd owv vdv hbsb ebob oia cidi OpenGL Blending and Compositing Must enable blending and pick source and destination factors glEnableGLELEND gIElendFuncsourcefactordestinationfactor Only certain factors supported GL E DGLDNE GLSRCALPHA GLDNEMNUSSRCALPHA GLDSTALPHA GL0NEMNUSDSTALPHA See Red Booworeornolete ilst nglenquuation GLFUNCADD GLFUNCSUBTRACT GLREVERSESU BTRACT GLMN GLMAX Blending Errors Operations are not commutative Operations are not idempotent Interaction with hiddensurface removal 7 Pulygun oenlno ooaooe one snoolo oe nlooen e Translucent ln frunt or uthers snoolo oe cumpuslted Show Demo ofthe problem Solution Blending Errors Interaction with hiddensurface removal 7 ulygun oenlno opao one shuul enl den 7 Translucentln frunt uf uthers snoolo be Eumpuslted 7 Solution T opessesosngepnezeolng glAlphaFunc lstpass alphal accepted andZHd passaiphalti accepted make zrhutlel leadrunlylulllanslucenl polygons alphaltl Won ngepthasleL FALSE 7 Derno Antialiasing Removing the Jaggies glznable mode 3 LINE M GL s GLPOLYGONSMOOTH alpha value computed by compuling subpixel cov rage available in both RGBA and oolormap modes Antialiasing Revisited Singlepolygon case rst Set a value of each pier to covered fraction Use destination factor of 1 oquot Use source factor of o This will blend background with foreground Overlaps can lead to blending errors Antialiasing with Multiple Polygons Initially background color CD a 0 Ren er Irs polygon color C1 fraction 041 7 Cd MGM 0101 ad m Render second polygon assume fraction 04 If no overlap case a then v i ada1 Antialiasing with Multiple Polygons Now assume overlap case b Average overlap is aia2 80 ad a1az alaz Make frontback decision for color as usual Antialiasing in OpenGL Avoid explicit acalculation in program Enable both smoothing and blending glEnzhlelGL POINT SMOOTH glEnzhlelGL LINE sMooTHi glEnzhlelGL BLEND nglendFunchL snc ALPHAGL ONE MINUS snc ALPHA Can also hint about quality vs performance using ngint Depth Cueing and Fog Another application of blending distancedependent z blending 7 Linear dependence39 depth cueing effect Exponential dependence log e ecl 7 This IS note physicallyrbased model Example Fog Fog in RGBA mode 0 C 1 4 depmaependenx fog laclor Guloar mum Exampha Fog Tutor 5m u Fog urm mum mavhmglwm mm w mm mm Example Depth Cue Man an mu 1mm


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Jennifer McGill UCSF Med School

"Selling my MCAT study guides and notes has been a great source of side revenue while I'm in school. Some months I'm making over $500! Plus, it makes me happy knowing that I'm helping future med students with their MCAT."

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.