Week 2 - Wednesday CS361.

Slides:



Advertisements
Similar presentations
Real-Time Rendering 靜宜大學資工研究所 蔡奇偉副教授 2010©.
Advertisements

Graphics Pipeline.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
1 Computer Graphics Chapter 8 3D Transformations.
3D Graphics Rendering and Terrain Modeling
CS 4363/6353 INTRODUCTION TO COMPUTER GRAPHICS. WHAT YOU’LL SEE Interactive 3D computer graphics Real-time 2D, but mostly 3D OpenGL C/C++ (if you don’t.
HCI 530 : Seminar (HCI) Damian Schofield.
CGDD 4003 THE MASSIVE FIELD OF COMPUTER GRAPHICS.
Part I: Basics of Computer Graphics Viewing Transformation and Coordinate Systems Chapter
Graphics Systems I-Chen Lin’s CG slides, Doug James’s CG slides Angel, Interactive Computer Graphics, Chap 1 Introduction to Graphics Pipeline.
Game Engine Design ITCS 4010/5010 Spring 2006 Kalpathi Subramanian Department of Computer Science UNC Charlotte.
OpenGL (II). How to Draw a 3-D object on Screen?
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Week 1 - Friday.  What did we talk about last time?  C#  SharpDX.
Basics of Rendering Pipeline Based Rendering –Objects in the scene are rendered in a sequence of steps that form the Rendering Pipeline. Ray-Tracing –A.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CSE 381 – Advanced Game Programming Basic 3D Graphics
Geometric Objects and Transformations. Coordinate systems rial.html.
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.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
1 Useful Tools for Making Video Games Part V An overview of.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
10/7/04© University of Wisconsin, CS559 Fall 2004 Last Time Transformations Homogeneous coordinates Directions Rotation Geometry 101 – Points, edges, triangles/polygons.
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.
3D Models and Meshes Asst. Prof. Rujchai Ung-arunyawee COE, KKU.
Mark Nelson 3d projections Fall 2013
Basic 3D Concepts. Overview 1.Coordinate systems 2.Transformations 3.Projection 4.Rasterization.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
2/19/04© University of Wisconsin, CS559 Spring 2004 Last Time Painterly rendering 2D Transformations –Transformations as coordinate system changes –Transformations.
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
1 Perception and VR MONT 104S, Fall 2008 Lecture 20 Computer Graphics and VR.
Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group computer graphics & visualization GameFX C# / DirectX 2005 The Rendering Pipeline.
A Photograph of two papers
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
Computer Graphics One of the central components of three-dimensional graphics has been a basic system that renders objects represented by a set of polygons.
OpenGL LAB III.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
Applications and Rendering pipeline
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.
Introduction to Computer Graphics
- Introduction - Graphics Pipeline
CSCE 441 Computer Graphics 3-D Viewing
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.
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
A Photograph of two papers
Chapter V Vertex Processing
Presentation transcript:

Week 2 - Wednesday CS361

What did we talk about last time? More SharpDX examples Graphics rendering pipeline Application stage Geometry stage Rasterizer stage Input and non-graphical output Texture animation Animation via transforms Collision detection Updating the state of the world in general Outputs geometric primitives

Questions?

Project 1

Graphics rendering pipeline For API design, practical top-down problem solving, and hardware design, and efficiency, rendering is described as a pipeline This pipeline contains three conceptual stages: Produces material to be rendered Application Decides what, how, and where to render Geometry Renders the final image Rasterizer

Student Lecture: Geometry Stage

Geometry Stage

Model and View Transform Geometry stage The output of the Application Stage is polygons The Geometry Stage processes these polygons using the following pipeline: Model and View Transform Vertex Shading Projection Clipping Screen Mapping

Model Transform Each 3D model has its own coordinate system called model space When combining all the models in a scene together, the models must be converted from model space to world space After that, we still have to account for the position of the camera

Model and View Transform We transform the models into camera space or eye space with a view transform Then, the camera will sit at (0,0,0), looking into negative z The z-axis comes out of the screen in the book's examples and in SharpDX (but not in older DirectX)

Vertex Shading Figuring out the effect of light on a material is called shading This involves computing a (sometimes complex) shading equation at different points on an object Typically, information is computed on a per-vertex basis and may include: Location Normals Colors

Projection Projection transforms the view volume into a standardized unit cube Vertices then have a 2D location and a z-value There are two common forms of projection: Orthographic: Parallel lines stay parallel, objects do not get smaller in the distance Perspective: The farther away an object is, the smaller it appears

Clipping Clipping process the polygons based on their location relative to the view volume A polygon completely inside the view volume is unchanged A polygon completely outside the view volume is ignored (not rendered) A polygon partially inside is clipped New vertices on the boundary of the volume are created Since everything has been transformed into a unit cube, dedicated hardware can do the clipping in exactly the same way, every time

Screen mapping Screen-mapping transforms the x and y coordinates of each polygon from the unit cube to screen coordinates A few oddities: DirectX has weird coordinate systems for pixels where the location is the center of the pixel DirectX conforms to the Windows standard of pixel (0,0) being in the upper left of the screen OpenGL conforms to the Cartesian system with pixel (0,0) in the lower left of the screen

3D Rendering in SharpDX

Drawing a model We're going to start by drawing a 3D model Eventually, we'll go back and create our own primitives Like other SharpDX content, the easiest way to manage it is to add it to your Content folder SharpDX can load (some).fbx files and a number of other files supported by Assimp Model loading is one of the newer features of SharpDX and seems to have a number of bugs

Loading a model First, we declare a member variable to hold the model Then we load the model in the LoadContent() method Model model; model = Content.Load<Model>("Ship");

Setting up the matrices To draw anything in 3D, we need a world matrix, a view matrix and a projection matrix You'll need these repeatedly, so store them as members Matrix world = Matrix.CreateTranslation(new Vector3(0, 0, 0)); Matrix view = Matrix.LookAtRH(new Vector3(0, 0, 7), new Vector3(0, 0, 0), Vector3.UnitY); Matrix projection = Matrix. PerspectiveFovRH( 0.9f, (float)GraphicsDevice.BackBuffer.Width / GraphicsDevice.BackBuffer.Height, 0.1f, 100.0f);

What do those matrices mean? The world matrix controls how the model is translated, scaled, and rotated with respect to the global coordinate system This code makes a matrix that moves the model 0 units in x, 0 units in y, and 0 units in z In other words, it does nothing Matrix world = Matrix.CreateTranslation(new Vector3(0, 0, 0));

And the view matrix? The view matrix sets up the orientation of the camera The easiest way to do so is to give Camera location What the camera is pointed at Which way is up This camera is at (0, 0, 7), looking at the origin, with positive y as up Matrix view = Matrix.CreateLookAt(new Vector3(0, 0, 7), new Vector3(0, 0, 0), Vector3.UnitY);

And projection? The projection matrix determines how the scene is projected into 2D It can be specified with Field of view in radians Aspect ratio of screen (width / height) Near plane location Far plane location Matrix projection = Matrix.CreatePerspectiveFieldOfView( .9f, (float)GraphicsDevice.BackBuffer.Width / GraphicsDevice.BackBuffer.Height, 0.1f, 100f);

Drawing Drawing the model is done by drawing all the individual meshes that make it up Each mesh has a series of effects Effects are used for texture mapping, visual appearance, and other things They need to know the world, view, and projection matrices foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) effect.World = world; effect.View = view; effect.Projection = projection; } mesh.Draw();

Quiz

Upcoming

Next time… Rendering pipeline Rasterizer stage

Reminders Keep reading Chapter 2