Screen-space Object Manipulation

Slides:



Advertisements
Similar presentations
COMP 175 | COMPUTER GRAPHICS Remco Chang1/6103b – Shapes Lecture 03b: Shapes COMP 175: Computer Graphics February 3, 2015.
Advertisements

CSE 681 Bounding Volumes. CSE 681 Bounding Volumes Use simple volume enclose object(s) tradeoff for rays where there is extra intersection test for object.
Three Dimensional Viewing
Computational Geometry & Collision detection
CS447/ Realistic Rendering -- Solids Modeling -- Introduction to 2D and 3D Computer Graphics.
Computer Graphics - Class 14
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
The Pinhole Camera Model
Multiple Integrals 12. Surface Area Surface Area In this section we apply double integrals to the problem of computing the area of a surface.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
X y z Point can be viewed as intersection of surfaces called coordinate surfaces. Coordinate surfaces are selected from 3 different sets.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
Writing Linear Equations Given Two Points On the Line Using the "Slope – Intercept" Form.
Week 13 - Wednesday CS361.
Vectors and the Geometry of Space
Laplacian Surface Editing
UNIVERSITI MALAYSIA PERLIS
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
COMP 175: Computer Graphics March 24, 2015
Chapter 5: The Orthogonality and Least Squares
Mathematical Foundations Sections A-1 to A-5 Some of the material in these slides may have been adapted from university of Virginia, MIT and Åbo Akademi.
Advanced Computer Graphics Three Dimensional Viewing
Homogeneous Coordinates (Projective Space) Let be a point in Euclidean space Change to homogeneous coordinates: Defined up to scale: Can go back to non-homogeneous.
CS 445 / 645 Introduction to Computer Graphics Lecture 23 Bézier Curves Lecture 23 Bézier Curves.
CS 325 Introduction to Computer Graphics 04 / 26 / 2010 Instructor: Michael Eckmann.
Week 13 - Monday.  What did we talk about last time?  Exam 2!  Before that…  Polygonal techniques ▪ Tessellation and triangulation  Triangle strips,
Chapter VI Parametric Curves and Surfaces
Vectors Addition is commutative (vi) If vector u is multiplied by a scalar k, then the product ku is a vector in the same direction as u but k times the.
Geometric Objects and Transformation
Elementary Linear Algebra Anton & Rorres, 9th Edition
Chapter Nine Vectors and the Geometry of Space. Section 9.1 Three-Dimensional Coordinate Systems Goals Goals Become familiar with three-dimensional rectangular.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Geometric Transformations
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Three-Dimensional Viewing
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
Chapter III Rasterization
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
COORDINATE SYSTEMS & TRANSFORMATION
3D Ojbects: Transformations and Modeling. Matrix Operations Matrices have dimensions: Vectors can be thought of as matrices: v=[2,3,4,1] is a 1x4 matrix.
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
Rendering Pipeline Fall, 2015.
Math Fundamentals Maths revisit.
CS 445 / 645 Introduction to Computer Graphics
Vectors and the Geometry
Copyright © Cengage Learning. All rights reserved.
Intro to 3D Graphics.
Homogeneous Coordinates (Projective Space)
11 Vectors and the Geometry of Space
Copyright © Cengage Learning. All rights reserved.
CENG 477 Introduction to Computer Graphics
Copyright © Cengage Learning. All rights reserved.
3D Clipping.
Three Dimensional Viewing
Chapter XVII Parametric Curves and Surfaces
Vectors and the Geometry
Geometry.
Chapter IV Spaces and Transforms
Chapter III Modeling.
Chapter V Vertex Processing
Chapter VII Rasterizer
Ray Tracing Polyhedra ©Anthony Steed
Chapter XIV Normal Mapping
Feature space tansformation methods
11 Vectors and the Geometry of Space
The Pinhole Camera Model
CHAPTER 3 VECTORS NHAA/IMK/UNIMAP.
Geometry.
Presentation transcript:

Screen-space Object Manipulation Chapter XII Screen-space Object Manipulation

Object Picking On touchscreen, an object can be picked by tapping it with a finger. In PC screen, mouse clicking is popularly used for the same purpose. Mouse clicking simply returns the 2D pixel coordinates (xs,ys). Given (xs,ys), we can consider a ray described by the start point (xs,ys,0) and the direction vector (0,0,1). We need ray-object intersection tests to find the object first hit by the ray, which is the teapot in the example. However, it is not good to compute the intersections in the screen space because the screen-space information available to us is about the pixels or fragments, not about the objects. Our solution is to transform the screen-space ray back to the object spaces and do the intersection tests in the object spaces.

Camera-space Ray direction vector of the camera-space ray

Object-space Ray It is straightforward to transform the camera-space ray into the world space and then to the object space.

Ray Intersection In order to determine if a ray hits an object represented in a polygon mesh, we have to perform a ray-triangle intersection test for every triangle of the object. If there exists at least a triangle intersecting the ray, the object is judged to be hit by the ray. Unfortunately, processing every triangle would be costly. A faster but less accurate method is to approximate a polygon mesh with a bounding volume (BV).

Bounding Volumes Bounding volumes Bounding volume creation

Ray Intersection (cont’d) Intersection tests with polygon meshes vs. bounding volumes.

Ray Intersection (cont’d) For the ray-sphere intersection test, let us represent the ray in a parametric representation. Three cases determined by the discriminant. Given two distinct roots, choose the smaller.

Ray Intersection (cont’d) The bounding sphere hit first by the ray is the one with the smallest t.

Ray Intersection (cont’d) Ray-sphere intersection test is often performed at the preprocessing step, and discards the polygon mesh that is guaranteed not to intersect the ray.

Ray Intersection (cont’d) A point in a triangle The weights (u,v,w) are called the barycentric coordinates of p. The triangle is divided into three sub-triangles, and the weight given for a control point is proportional to the area of the sub-triangle “on the opposite side.” Obviously, u+v+w=1, and therefore w can be replaced by (1-u-v), i.e., p=ua+vb+(1-u-v)c.

Ray Intersection (cont’d) Computing the intersection between a ray, s + td, and a triangle, <a, b, c> is equivalent to solving the following equation: The solution to this system is obtained using Cramer's rule: The intersection point is computed by inserting t into the ray equation, s + td, or by inserting u and v into ua+vb+(1-u-v)c.

Ray Intersection (cont’d) In order for the intersection point to be confined to the triangle, the following condition should be satisfied: u ≥ 0, v ≥ 0, and u+v ≤ 1. When every triangle of a mesh is tested for intersection with the ray, multiple intersections can be found. Then, we choose the point with the smallest positive t.

Object Rotating Rotating an object is used as frequently as picking an object. On the 2D screen, the sliding finger's positions, {p1, p2, … , pn}, are tracked. For each pair of successive finger positions, pi and pi+1, a 3D rotation is computed and applied to the object.

Arcball The arcball is a virtual ball located behind the screen and encloses the object to rotate. The sliding finger rotates the arcball and the same rotation applies to the object. For efficient implementation, the 2D screen with dimensions wh is normalized to the 22 square, and the 2D coordinates, (x,y), of the finger's position are accordingly normalized, i.e. pi and pi+1 are converted to qi and qi+1.

Arcball (cont’d) Then, q is orthographically projected along –z onto the surface of the arcball. Let v denote the vector connecting the arcball’s center and the projected point. Note that vx=qx, vy=qy, and vz= . If the projection is out of the arcball, v=normalize(qx,qy,0). Given vi and vi+1, we can compute the rotation axis and angle. The rotation axis is obtained by taking the cross product of vi and vi+1. The rotation angle is obtained from the dot product of vi and vi+1.

Object-space Rotation Axis The rotation axis should be redefined in the object space so that the rotation is made prior to the original world transform. We computed the rotation axis in the arcball's space. It is a temporarily devised coordinate system, which we have not encountered in the rendering pipeline. Our strategy is then to take the rotation axis as is into the camera space of the rendering pipeline. The rotation axis, as a vector, can be thought of as passing through the object in the camera space, and such a configuration is preserved in the object space.