Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 8 Views F Views in 3D rendering process.

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Defining the Viewing Coordinate System
Three Dimensional Viewing
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Lecture21 Other Java Gamming technologies – Java3D (This lecture will not be assessed)
CS 352: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 8 Views.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
Scenes, Cameras & Lighting. Outline  Constructing a scene  Using hierarchy  Camera models  Light models.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Introduction to 3D viewing 3D is just like taking a photograph!
Basic 3D Graphics Chapter 5. Bird’s Eye View  Basic 3D Graphics –Basic concepts of 3D graphics, rendering pipeline, Java 3D programming, scene graph,
Viewing and Projections
Computer Graphics (fall 2009)
02/26/02 (c) 2002 University of Wisconsin, CS 559 Last Time Canonical view pipeline Orthographic projection –There was an error in the matrix for taking.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Computer Graphics Bing-Yu Chen National Taiwan University.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
Computer Graphics I, Fall 2010 Computer Viewing.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
Graphics Graphics Korea University kucg.korea.ac.kr Viewing 고려대학교 컴퓨터 그래픽스 연구실.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Jinxiang Chai CSCE 441 Computer Graphics 3-D Viewing 0.
Three-Dimensional Viewing
Three-Dimensional Viewing Hearn & Baker Chapter 7
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
Graphics CSCI 343, Fall 2015 Lecture 16 Viewing I
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
A Photograph of two papers
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 5 Basic 3D Graphics.
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
Chapter 1 Graphics Systems and Models Models and Architectures.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CS5500 Computer Graphics March 20, Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Computer Viewing Isaac Gang University of Mary Hardin-Baylor.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
CS 490: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
Outline 3D Viewing Required readings: HB 10-1 to 10-10
A Photograph of two papers The Model: 2 papers – 8cm x 8cm and 5cm x 5cm The Camera – Simple pinhole – No focusing capability The Scene – Arrangements.
Chapter 11 Three-Dimensional Geometric and Modeling Transformations
Three Dimensional Viewing
Rendering Pipeline Fall, 2015.
CSCE 441 Computer Graphics 3-D Viewing
CSC461: Lecture 20 Parallel Projections in OpenGL
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
CSC461: Lecture 19 Computer Viewing
Models and Architectures
A Photograph of two papers
Three Dimensional Viewing
Computer Graphics Imaging
Last Time Canonical view pipeline Projection Local Coordinate Space
Viewing (Projections)
Viewing (Projections)
Interactive Computer Graphics Viewing
THREE-DIMENSIONAL VIEWING II
CS 352: Computer Graphics Chapter 5: Viewing.
Presentation transcript:

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 8 Views F Views in 3D rendering process F Parallel and perspective projections F Specifying the viewing matrix F Specifying the projection matrix F Java 3D standard view model F Java 3D compatibility mode view model F Picking in a 3D scene F To use the avatar in SimpleUniverse

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 2 What is a View? F A scene graph has two main branches –Content branch –View branch F The view branch defines the geometric configuration that controls the process of mapping a 3D world to a 2D image F Think of the view as the digital analog of a camera

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 3 Views in Java3D F Low-level APIs support a camera-based view model –Dynamic changes of view are difficult F Java3D has a versatile view system –Supports dynamic view changes

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 4 View Properties F Projection type F Field of view F Limits to view distance F Size of view plate

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 5 Projections F A projection maps a point in the virtual world onto a view plane –view plate is a finite window in the view plane –also limit the depth that is rendered F Two types of projection –parallel –perspective

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 6 Parallel Projection F Project along parallel lines from objects in scene to the view plane F For the view plate in the x-y plane –x and y unchanged –z goes to 0

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 7 Orthographic Projection F Special case of parallel projection where the projection lines are parallel to the view plane F Used in engineering drawings –front, top and side elevations

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 8 Perspective Projection F Projection lines converge at the view point –more distant objects are smaller F If the viewpoint moves to infinite, projection becomes parallel

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 9 Computing Projected Coordinates F Using similar triangles y'/d = y/(d + (-z)) y' = y / (1 - z / d) –and similarly for x'

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 10 View Specification F View Volume –represented by a projection matrix F View positioning –represented by a view matrix F

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 11 View Volume Parameters F Projection – parallel or perspective projection. F View Plate – the window for the rendered image. It is usually a rectangular region. In a real camera the view plate corresponds to the film frame. F Field of view (fov) – the horizontal angle between the left and right plane of the frustum. The vertical field of view and diagonal field of view can be defined similarly. F Focal length – the distance between the view plate and the view point. F Aspect ratio – the ratio of width over length of the view planes. F Front clip plane – the front or near plane of the frustum. F Back clip plane – the back or far plane of the frustum.

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 12 Projection Matrix F Defined in the eye-coordinate system –eye at origin facing negative z direction F Maps the given view-volume to a standard volume F For front plane at -c and back plane at -d and -a<x<a and -b<y<b

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 13 Viewing Position F Viewpoint, view-reference point (vrp, eye) – the camera or eye position, the 3D point where the camera is located. F View center (look) – the center of view plate or the point that the eye is looking at. F View up direction (up) – the upward direction from a viewer’s perspective. F View plane – the plane of the projected image. F View plane normal (vpn) – the normal vector of the view plane.

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 14 Java 3D View Model

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 15 Classes used for View Specification F ViewPlatform - encapsulates the view matrix F View - encapsulates the projection matrix F PhysicalBody - specification of user's head F PhysicalEnvironment - input devices, audio F Canvas3D - canvas of rendering F Screen3D - properties of display device (e.g. console)

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 16 ViewPlatform F Defines observer –Position, Orientation, Scale F Is a Leaf node –Attach to a Locale through one or more TransformGroup nodes –Need one Transform to establish the viewing matrix

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 17 View F Attached to the ViewPlatform F Can render to multiple Canvas3D objects F Properties –projection and clip parameters (fov, front and back clip distances) –depth buffer –compatibility mode –rendering policies, etc

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 18 Configure a 3D View F Transform3D method to construct the viewing matrix void lookAt(Point3d eye, Point3d look, Vector3d up) F View class has methods to set up the projection matrix void setFieldOfView(double fov) void setFrontClipDistance(double d) void setBackClipDistance(double d) void setProjectionPolicy(int projection)

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 19 The Compatibility Mode F A simple mode compatible with OpenGL camera-based model –Static camera –Restricted view mode F Most view parameters are set in the View object F To enable compatibility mode public void setCompatibilityModeEnable( boolean enabled)

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 20 Construct the projection matrix F Methods from the Transform3D class public void perspective( double fov, double aspect, double near, double far) public void frustrum( double left, double right, double bottom, double top, double near, double far) public void ortho( double left, double right, double bottom, double top, double near, double far) Coordinates are relative to eye position

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 21 Set the projection matrix F Methods from the View class public void setVpcToEc( Transform3D viewingMatrix) public void setLeftProjection( Transform3D viewingMatrix) public void setRightProjection( Transform3D viewingMatrix)

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 22 CompatibilityMode.java F Creates all scene graph components directly –Canvas3D, VirtualUniverse, Locale in constructor –BranchGroup, ViewPlatform, View, PhysicalBody, PhysicalEnvironment in createView –Content in createContent

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 23 SimpleUniverse F Default implementation for viewing system –Viewer = View, ViewAvatar, PhysicalBody, PhysicalEnvironment, Canvas3D –ViewingPlatform = ViewPlatform, MultiTransformGroup F Default view parameters –Compatibility mode: false –Left projection, Right projection, vpc to ec transform: identity –Field of view: π/4 –Front clip distance: 0.1 –Back clip distance: 10

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 24 RotateView.java F Uses SimpleUniverse F Similar to Dodecahedron program from chapter 5 except –Rotator is applied to the ViewPlatform instead of the Dodecahedron

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 25 Scene Graph

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 26 Using VirtualUniverse F SimpleUniverse is easy to use but not always adequate F Set up a VirtualUniverse manually for more control

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 27 Create Your Own Views View view = new View(); view.setProjectionPolicy(View.PARALLEL_PROJECTION); ViewPlatform vp = new ViewPlatform(); view.addCanvas3D(cv); view.attachViewPlatform(vp); view.setPhysicalBody(new PhysicalBody()); view.setPhysicalEnvironment(new PhysicalEnvironment()); Transform3D trans = new Transform3D(); trans.lookAt(eye, center, vup); trans.invert(); TransformGroup tg = new TransformGroup(trans); tg.addChild(vp); BranchGroup bgView = new BranchGroup(); bgView.addChild(tg);

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 28 Multiple Views F A scene graph can contain multiple views –MultipleViews.java has the standard perspective view from SimpleUniverse plus 3 orthographic projections

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 29 Picking F The process of selecting a world-space object through the projected (2D) image –The inverse of viewing –Identifies objects that project to a particular point F A point in the 2D plane corresponds to a line in 3d –If the point has a size, it corresponds to a cylinder or cone in 3D

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 30 Picking F Pick cone for point (x', y') in the view plate –r is radius of pick point

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 31 Core Functionality F PickShape hierarchy F SceneGraphPath specifies path from Locale to a terminal node in the scene graph F Locale and BranchGroup have methods for picking

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 32 Picking Methods F Several choices of of behavior SceneGraphPath[] pickAll(PickShape pickShape) SceneGraphPath[] pickAllSorted(PickShape pickShape) SceneGraphPath pickAny(PickShape pickShape) SceneGraphPath pickClosest(PickShape pickShape)

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 33 More Pick Classes F com.sun.j3d.utils.picking package provides higher level support F PickTool F PickResult –picked object, SceneGraphPath, Intersection F PickIntersection –detailed information about intersection

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 34 Picking.java F Start with 6 wire-frame objects –set capability bits for picking and appearance changes F Use a PickCanvas to perform pick operation F Selecting with mouse click enables lighting –pc.setShapeLocation( MouseEvent)

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 35 Head Tracking F Adjustment of view parameters following dynamic head position changes –Based on input from a 6-degree-of-freedom device F Java 3D head tracking support –View –Sensor –PhysicalBody –PhysicalEnvironment

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 36 Six Degrees of Freedom F Three for translation –forward/back –up/down –left/right F Three for rotation –roll –pitch –yaw

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 37 InputDevice F InputDevice interface –provides methods for interacting with devices F An InputDevice needs to be registered with the PhysicalEnvironment –Three predefined 6DoF tracking devices u 0: UserHead u 1: DominantHand u 2: NondominatnHand

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 38 Avatar F Avatar is physical representation of viewer in the scene

Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 39 HeadTracking.java F Uses a VirtualInputDevice to simulate a 6DoF input device F ViewerAvatar is a set of coordinate axes (LineAxes)