大三05計算機(jī)圖形學(xué)tracing_第1頁
大三05計算機(jī)圖形學(xué)tracing_第2頁
大三05計算機(jī)圖形學(xué)tracing_第3頁
大三05計算機(jī)圖形學(xué)tracing_第4頁
大三05計算機(jī)圖形學(xué)tracing_第5頁
已閱讀5頁,還剩23頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、Ray Tracing1Angel: Interactive Computer Graphics 5E Addison-Wesley 2009原著Ed AngelProfessor of Computer Science, Electrical and Computer Engineering, and Media ArtsUniversity of New Mexico編輯 武漢大學(xué)計算機(jī)學(xué)院圖形學(xué)課程組2Angel: Interactive Computer Graphics 5E Addison-Wesley 2009IntroductionOpenGL is based on a pi

2、peline model in which primitives are rendered one at timeNo shadows (except by tricks or multiple renderings)No multiple reflectionsGlobal approachesRendering equationRay tracingRadiosity3Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Ray TracingFollow rays of light from a point sourceCa

3、n account for reflection and transmission4Angel: Interactive Computer Graphics 5E Addison-Wesley 2009ComputationShould be able to handle all physical interactionsRay tracing paradigm is not computationalMost rays do not affect what we seeScattering produces many (infinite) additional raysAlternative

4、: ray casting5Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Ray CastingOnly rays that reach the eye matterReverse direction and cast raysNeed at least one ray per pixel6Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Ray Casting QuadricsRay casting has e the standard way to v

5、isualize quadrics which are implicit surfaces in CSG systemsConstructive Solid GeometryPrimitives are solidsBuild objects with set operationsUnion, intersection, set difference7Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Ray Casting a SphereRay is parametricSphere is quadricResulting

6、equation is a scalar quadratic equation which gives entry and exit points of ray (or no solution if ray misses)8Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Shadow RaysEven if a point is visible, it will not be lit unless we can see a light source from that pointCast shadow or feeler r

7、ays9Angel: Interactive Computer Graphics 5E Addison-Wesley 2009ReflectionMust follow shadow rays off reflecting or transmitting surfacesProcess is recursive10Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Reflection and Transmission11Angel: Interactive Computer Graphics 5E Addison-Wesley

8、 2009Ray Trees12Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Ray Tree13Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Diffuse SurfacesTheoretically the scattering at each point of intersection generates an infinite number of new rays that should be tracedIn practice, we onl

9、y trace the transmitted and reflected rays but use the Phong model to compute shade at point of intersectionRadiosity works best for perfectly diffuse (Lambertian) surfaces14Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Building a Ray TracerBest expressed recursivelyCan remove recursion

10、 laterImage based approachFor each ray .Find intersection with closest surfaceNeed whole object database availableComplexity of calculation limits object typesCompute lighting at surfaceTrace reflected and transmitted rays15Angel: Interactive Computer Graphics 5E Addison-Wesley 2009When to stopSome

11、light will be absorbed at each intersectionTrack amount leftIgnore rays that go off to infinityPut large sphere around problemCount steps16Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Recursive Ray Tracercolor c = trace(point p, vector d, int step) color local, reflected, transmitted;

12、point q; normal n; if(step max) return(background_color);17Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Recursive Ray Tracerq = intersect(p, d, status);if(status=light_source) return(light_source_color);if(status=no_intersection) return(background_color);n = normal(q);r = reflect(q, n)

13、;t = transmit(q,n);18Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Recursive Ray Tracerlocal = phong(q, n, r);reflected = trace(q, r, step+1);transmitted = trace(q,t, step+1);return(local+reflected+transmitted);19Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Computing Inter

14、sectionsImplicit ObjectsQuadricsPlanesPolyhedraParametric Surfaces20Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Implicit SurfacesRay from p0 in direction d p(t) = p0 +t dGeneral implicit surfacef(p) = 0Solve scalar equation f(p(t) = 0General case requires numerical methods21Angel: Int

15、eractive Computer Graphics 5E Addison-Wesley 2009QuadricsGeneral quadric can be written aspTAp + bTp +c = 0Substitute equation of ray p(t) = p0 +t dto get quadratic equation22Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Sphere(p pc) (p pc) r2 = 0p(t) = p0 +t dp0 p0 t2+ 2 p0 (d p0) t +

16、(d p0) (d p0) r2 = 023Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Planesp n + c = 0p(t) = p0 +t dt = -(p0 n + c)/ d n 24Angel: Interactive Computer Graphics 5E Addison-Wesley 2009PolyhedraGenerally we want to intersect with closed objects such as polygons and polyhedra rather than pla

17、nesHence we have to worry about inside/outside testingFor convex objects such as polyhedra there are some fast tests25Angel: Interactive Computer Graphics 5E Addison-Wesley 2009Ray Tracing PolyhedraIf ray enters an object, it must enter a front facing polygon and leave a back facing polygonPolyhedron is formed by intersection of planesRay enters at furthest intersection with front facing planesRay leaves at closest intersection with back facing planesIf entry is further away than ex

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論