Description

Beam Following Rendering Strategies Beams for screen pictures Shadows Recursion Z-Support Rendering Articles are promptly drawn onto the screen. We utilize a "z-cradle" to monitor what is in front… Object Organizes Modelview Grid Eye facilitates Projection Network

Transcripts

Beam Tracing Rendering Methods Rays for screen pictures Shadows Recursion

Z-Buffer Rendering Objects are promptly drawn onto the screen. We utilize a âz-bufferâ to stay informed concerning what is in frontâ¦ Object Coordinates Modelview Matrix Eye organizes Projection Matrix Clip directions Homogenize Normalized gadget facilitates Window to Viewport arranges

Visible Surface Raytracing Object Coordinates Modelview Matrix Eye facilitates Intersection Data Structure Raytracing then uses this information structure to manufacture the picture.

Raytracing Invented by Arthur Appel in 1968 at the IBM T.J. Watson Research Center. Not considered a noteworthy achievement since it was esteemed illogical given its tremendous computational prerequisites. Grieved in lack of clarity until the late 1970âs, when PC and showcase capacities started to marginally get up to speed. SIGGRAPHâ77 saw numerous noteworthy improvements, including the first takes a gander at demonstrating reflection and shadows.

More History A genuine recursive beam tracer was introduced surprisingly by Turner Whitted in the exemplary article â An enhanced light model for shaded presentation â in the June, 1980 Communications of the ACM. Note that the article is more worried with the model for enlightenment than the beam following calculation.

That Pinhole Camera Model After eyespace change Projection Plane at z=-d

What does that projection plane speak to? (right, best, znear) (left, base, znear) Pixels

Raytracing If we shoot a line from the focal point of projection through the focal point of a pixel and off into spaceâ¦ What does it hit first? On the off chance that it hits an article, process the shading for that point on the item Thatâs the pixel shading

Rays A Ray is a vector and a Point â The beginning stage of the beam Vector â The beam course This portrays a boundless line beginning at the point and going in the beam heading Starting point is once in a while called the beam birthplace

Simple Ray class CRay { open: CRay(const CGrPoint &o, const CGrPoint &d) {m_o=o; m_d=d;} CRay() {} CRay(const CRay &r) {m_o = r.m_o; m_d = r.m_d;} const CGrPoint &Origin() const {return m_o;} const twofold Origin(int d) const {return m_o[d];} const CGrPoint &Direction() const {return m_d;} const twofold Direction(int d) const {return m_d[d];} CRay &operator=(const CRay &r) {m_o = r.m_o; m_d = r.m_d; return *this;} private: CGrPoint m_o ; //Ray source CGrPoint m_d ; //Ray bearing };

Rays Ray t values A separation along the beam t=1.5

t values Any point along the beam with root (x s ,y s ,z s ) and direction(x d ,y d ,z d ) can be depicted utilizing t: x = x s + t x d y = y s + t y d z = z s + t z d Or: p = o + t d In vector math

Simple Ray class CRay { open: CRay(const CGrPoint &o, const CGrPoint &d) {m_o=o; m_d=d;} CRay() {} CRay(const CRay &r) {m_o = r.m_o; m_d = r.m_d;} const CGrPoint &Origin() const {return m_o;} const twofold Origin(int d) const {return m_o[d];} const CGrPoint &Direction() const {return m_d;} const twofold Direction(int d) const {return m_d[d];} CRay &operator=(const CRay &r) {m_o = r.m_o; m_d = r.m_d; return *this;} CGrPoint PointOnRay(double t) const {return m_o + m_d * t;} private: CGrPoint m_o; //Ray cause CGrPoint m_d; //Ray course };

Where will the viewplane be and how huge is it? We depict projection with: Field of perspective (point) Aspect Ratio (x/y) Or a Frustum

Viewplane z area y - Z area is immaterial, field of perspective is what is important. Weâll use z=-1 Could likewise utilize znear

Viewplane size y fov/2 fov y (in + course) - z 1 (x,y) y = tan(fov/2) tallness = 2y x = aspect*y width = 2x (- x,- y)

The View Plane as a Pixel Grid (x,y) (11,7) 8 tall (- x,- y) (0,0) 12 wide

What we need We need to shoot a beam Starting point (0,0,0) (focal point of projection) Direction through the focal point of a pixel What we need is the inside\'s directions of a pixel

Pixel Centers (x,y) (11,7) (4,5) 8 tall (4,5) (- x,- y) (0,0) 12 wide

Visible Surface Raytracing/width â Screen width, stature â Screen tallness/fov â Field of perspective in degrees, viewpoint â Aspect proportion twofold ey = tan(fov/2. * DEGTORAD); twofold ehit=2 * ey; twofold ex = ey * angle; twofold ewid = 2 * ex; for(int r=0; r<height; r++) for(int c=0; c<width; c++) { ray.start.Set(0,0,0); ray.dir.Set(- ex + ewid * (c + 0.5)/width, - ey + ehit * (r + 0.5)/stature, - 1.); ray.dir.Normalize();/Compute shading in beam heading/Save shading as picture pixel }

How would we make sense of what we will hit? Beam crossing point tests Reduces to illuminating for t x = x s + t x d y = y s + t y d z = z s + t z d Easiest is the circle (x-x 0 ) 2 +(y-y 0 ) 2 +(z-z 0 ) 2 =r 2 Substitute beam mathematical statement in and explain for t

Ray convergence with a circle Questions: Why two t values? How would we tell if there is a convergence? Which t quality do we need?

Intersections with a Plane mathematical statement Ax+By+Cz+D=0 (A,B,C) is the plane ordinary We can process the typical and, given a solitary point, register D Questions: Can t be negative? Zero? Why is this more troublesome than a circle?

Plane Intersection to Polygon Intersection Given a plane crossing point, the inquiry is: Is this point inside the polygon?

Polygon Interior Tests In a 2D projection: Find all edges that cover in one measurement Determine convergence of a line parallel with a hub and the covering edges what number crossing points are to one side of the point?

But, what projection? Venture the polygon for the greatest zone What is the biggest segment of the typical? In the event that x: Use a Y/Z projection If y: Use a X/Z projection If z: Use a X/Y projection Why?

Another Wayâ¦ What I for the most part utilize Suppose you know the crossing point and know a typical for every edge that focuses towards within the polygon How would we figure these normals? What is the normal for focuses inside the polygon?

Computing the Normals Let v 1 , v 2 be two vertices (in counter clockwise request). At that point the edge typical is N x (v 2 - v 1 ) Orthogonal to the edge and the polygon surface ordinary (N). Surface Normal v 2 v 1 Edge Normal

Interior Test For an edge v 1 ,v 2 with edge ordinary e 1 , the convergence p is within side if (p-v 1 )e 1 is not negative.

Faster Intersection Tests Naã¯ve beam tracer: For every beam, test every polygon to check whether the beam hits it. On the off chance that you did this, your tasks would presumably get done with pursuing you graduate Is there a superior way? Thoughts?

Faster Intersection Tests Grouping articles into bouncing boxes If we donât hit the jumping box, donât test inside. Subdivide space into uniform boxes and walk the beam through the crates Only test whatâs inside the containers Subdivide space into non-uniform boxes and walk the beam however the cases Again, just test whatâs inside the cases

Parts of a Ray Tracing System Pixel circle Loops over the pixels and shoots the beams Ray shading calculation Determines the shading a beam hits Ray crossing point framework Determines what a beam hits

So, how would we do? Specular Reflection from Light Sources Specular Transmission from Light Sources Diffuse Reflection from Light Sources Specular Reflection from different surfaces Specular Transmission