# Other Rendering Techniques Types of rendering 1 Wireframe

- Slides: 30

Other Rendering Techniques • Types of rendering – – • • 1 Wireframe techniques Scan-line conversion Reyes rendering Ray tracing (done) Shadows Reflections Depth of field, focus, etc. Antialiasing CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Line only techniques • Hidden-line removal – Line graphics – Wireframe images – “Halo” line images 2 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Floating Horizon Algorithms 3 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Robert’s Algorithm • • 4 First visible line algorithm O(N 2) complexity All objects must be convex volumes Excessively complex CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Warnock Algorithm • Spatial subdivision – Quad-trees 5 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Appel’s Algorithm • Quantitative invisibility – When a line goes behind something, increment by 1 – When it comes out, increment by -1 6 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Haloed Lines 7 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

So much for wireframe… 8 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

What are the ways to convert primitives to image? • Scan-line conversion • Ray tracing ? e s l ge in h t ny A 9 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Scan-line conversion • Each primitive is mapped to 2 D and then converted to image – List priority algorithms – Z-buffer techniques – A-buffer techniques 10 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Painters Algorithm • Sort back to front • Draw back to front – That’s all there is to it • Does this always work? 11 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Z-buffer algorithms • Associate a z value with each pixel – Contains z for nearest point drawn so far – Open. GL, Direct 3 D, etc. • Where do we get the Z? 12 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

A-Buffer Algorithms • • 13 Create a list of polygons for each scan line Determine x extents for each line Sort in z order Draw pixel for nearest line CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Spanning Scan Line Algorithms • Create a list of polygons for each scan line • Determine x extents for each line • Determine spans – All end points and intersections partition spans • Draw front line for each span 14 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

List priority algorithms • Sort things in depth order – Painter’s algorithm paints back to front – We could just paint front if no overlaps • Newell-Sancha Algorithm – Provides way to sort polygons • Splits any polygons if there is a cyclical relationship 15 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Doing things in a z-buffer world • Z-buffer: the most common scan-line method – What’s good about it? – What’s bad about it? 16 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Shadows? • Why does Open. GL not show shadows? 17 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Drawing Shadows • Assume a light at (0, 0, 0). We want to know were the shadow projects on a plane defined by ax+by+cz+d=0 – – – 18 An occluding point S=(sx, sy, sz, 1) Anything along line through S would be: (asx, asy, asz, 1) Line intersection with plane is: aasx+absy+acsz+d=0 a=-d/(asx+bsy+csz) Intersection with plane is: -d(sx, sy, sz)/(asx+bsy+csz) CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Using this equation Similar approach exists For lights at infinity • -d(sx, sy, sz)/(asx+bsy+csz) 1. Translate so light is at origin ? ? ? 2. Put this matrix on stack (using translated plane) 3. Draw object we are casting shadow of in shadow color 19 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

How I got this working… • I display the shadow into the stencil buffer • I then draw the polygon with alpha value that decreases brightness • See example program… 20 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Shadow Direction Image from light 0 viewpoint Image from light 1 viewpoint What all can we do with this? 21 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Lit Polygon Determination Image from light 0 viewpoint Image from light 1 viewpoint Partition polygons into lit/not lit sets Subdivide any that are partially lit 22 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Shadow Texture Image from light 0 viewpoint Image from light 1 viewpoint Create a texture map for each visible polygon 23 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Shadow Map Image from light 0 viewpoint Depth map from light 0 viewpoint The map partitions the space into shadowed/not shadowed. For each point, determine which partition we are in 24 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Deep Shadow Maps 3 D texture where each point is how much illumination we receive 25 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Shadow Volumes • Polygons cast polyhedra of shadow volumes • Intersect polyhedra and object space 26 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Reflections/Transparency? • How? 27 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Environment Maps • Uses vertex normals to generate texture coordinates • How can we use this to generate: – Reflections – Transparency with refraction? 28 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Depth of Field? • What? • Why? • How? 29 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Motion Blur • What? • Why? • How? 30 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics