Visibility (hidden surface removal)

Slides:



Advertisements
Similar presentations
COMPUTER GRAPHICS SOFTWARE.
Advertisements

CSC418 Computer Graphics n Polygon normals n Back Faces n Visibility Algorithms.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Graphics Pipeline.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Hidden Surface Removal 고려대학교 컴퓨터 그래픽스 연구실.
Part I: Basics of Computer Graphics
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
CGDD 4003 THE MASSIVE FIELD OF COMPUTER GRAPHICS.
1 CSCE 441: Computer Graphics Hidden Surface Removal (Cont.) Jinxiang Chai.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
Hidden Surface Removal
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
1 10/24/ :01 UML Graphics II Shadows Session 4.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Hidden Surface Removal
Implementation II.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Visible Surface Detection
Computer Graphics I, Fall 2010 Implementation II.
Rendering.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
1 Computer Graphics Week11 : Hidden Surface Removal.
Learning Objectives Classification of Visible Surface Detection Algorithms Classification of Visible Surface Detection Algorithms Back-Face Detection Back-Face.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Spring 2006 G5BAGR – Advanced Computer Graphics
Visible Surface Detection
- Introduction - Graphics Pipeline
Computer Graphics Implementation II
Photorealistic Rendering vs. Interactive 3D Graphics
Week 2 - Friday CS361.
Solid Area Scan Conversion or Visible Surface Detection
Hidden Surface Removal
CSC418 Computer Graphics Back Faces Visibility Algorithms.
Intro to 3D Graphics.
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Hidden Surfaces Dr. Scott Schaefer.
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Models and Architectures
CSCE 441: Computer Graphics Hidden Surface Removal
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Implementation II Ed Angel Professor Emeritus of Computer Science
Introduction to Computer Graphics with WebGL
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
Lecture 13 Clipping & Scan Conversion
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
CS5500 Computer Graphics May 29, 2006
Introduction to Computer Graphics with WebGL
Hidden Surface Removal
Ref: OpenGL Programming Guide (The Red Book)
The Framebuffer 1 Lecture 37 Fri, Nov 30, 2007.
Clipping University of British Columbia CPSC 314 Computer Graphics
Implementation II Ed Angel Professor Emeritus of Computer Science
Introduction to Computer Graphics
Presentation transcript:

Visibility (hidden surface removal) A correct rendering requires correct visibility calculations Correct visibility – when multiple opaque polygons cover the same screen space, only the front most one is visible (remove the hidden surfaces) wrong visibility Correct visibility

Visibility (hidden surface removal) Goal: determine which objects are visible to the eye Determine what colors to use to paint the pixels Active research subject - lots of algorithms have been proposed in the past (and is still a hot topic)

Visibility Where is visiblity performed in the graphics pipeline? v1, m1 modeling and viewing per vertex lighting projection v3, m3 v2, m2 Rasterization texturing Shading visibility viewport mapping interpolate vertex colors clipping Display

OpenGL - Image Space Approach Determine which of the n objects is visible to each pixel on the image plane for (each pixel in the image) { determine the object closest to the pixel draw the pixel using the object’s color }

Image Space Approach – Z-buffer Method used in most of graphics hardware (and thus OpenGL): Z-buffer algorithm Basic idea: rasterize every input polygon For every pixel in the polygon interior, calculate its corresponding Z value (by interpolation) Choose the color of the polygon whose z value is the closest to the eye to paint the pixel.

Z (depth) buffer algorithm How to choose the polygon that has the closet Z for a given pixel? Initialize (clear) every pixel in the z buffer to a very large negative value (remember object in front of eye always negative Z values) Then run the following loop:

Z (depth) Buffer Algorithm For each polygon { for each pixel (x,y) inside the polygon projection area { if (Z_polygon_pixel(x,y) > depth_buffer(x,y) ) { depth_buffer(x,y) = Z_polygon_pixel(x,y); color_buffer(x,y) = polygon color at (x,y) }

Z buffer example Z = -.5 Z = -.3 eye Final image Top View

Z buffer example (2) Step 1: Initialize the depth buffer -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999 -999

Z buffer example (3) Step 2: Draw the blue polygon (assuming the OpenGL program draws blue polyon first – the order does not affect the final result any way). eye Z = -.3 Z = -.5 -999 -999 -999 -999 -.5 -.5 -999 -999

Z buffer example (4) Step 3: Draw the yellow polygon -999 -999 -999 -999 -999 -.3 -.3 -999 -.5 -.3 -.3 -999 -.5 -.5 -999 -999

OpenGL functions glEnable(GL_DEPTH_TEST) glDepthFunc(GLenum fun): GL_NEVER; GL_ALWAYS; GL_LESS; GL_LEQUAL; GL_EQUAL; GL_GEQUAL; GL_GREATER; GL_NOTEQUAL; Default: GL_LESS Need to remember to initialize the depth buffer in GLUT glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH); glDepthMask(GLboolean flag) Whether to write to the depth buffer or not GL_TRUE or GL_FALSE Default is GL_TRUE once gl depth test is enabled

Other Approaches Not implemented by most of the graphics hardware Back face culling (supported by OpenGL) View frustum culling Ray tracing Painter’s algorithm And many more …

Back Face Culling Back face culling – remove the back faces of a closed opaque object) How to detect back faces? N V

View-Frustum Culling Remove objects that are outside the viewing frustum Done by application

Ray Tracing Ray tracing is another example of image space method Ray tracing: Cast a ray from eye through each pixel to the world. Calculate ray-object intersection. Topic of 681

Painter’s Algorithm A depth sorting method Surfaces are sorted in the order of decreasing depth Surfaces are drawn in the sorted order, and overwrite the pixels in the frame buffer Two problems: It can be nontrivial to sort the surfaces It can be no solution for the sorting order