Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Chapter 12: Making the Applications Interesting.

Slides:



Advertisements
Similar presentations
Md. Monjur –ul-Hasan Department of Computer Science & Engineering Chittagong University of Engineering & Technology Chittagong 4349
Advertisements

L.Ghadah R. Hadba CT1514-L1.  Computer Graphics :refers to processing of creating a new image from Geometry, Lighting parameters, Materials and Textures.Using.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
03/16/2009Dinesh Manocha, COMP770 Texturing Surface’s texture: its look & feel Graphics: a process that takes a surface and modifies its appearance using.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.
Chapter 10: Coordinate Systems Chapter 10.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Introduction to Computer Graphics Ed Angel Professor of Computer Science, Electrical and.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 7 Chapter 7: Graphical Primitives.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 3 Chapter 3: Simple Graphics Program.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Chapter 11: Hierarchical Modeling.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 4 Chapter 4: Working with Graphics APIs.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 8 Chapter 8: Transformation Operators.
Introduction to Computer Graphics
Graphics and Animation Chapter 8. 8 Graphics in Multimedia Graphics are an element that virtually all multimedia applications include.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
What is ? Open Graphics Library A cross-language, multi-platform API for rendering 2D and 3D computer graphics. The API is used to interact with a Graphics.
Lecture 4 - Introduction to Computer Graphics
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 14 Introduction to Computer Graphics.
CSCE Chapter 5 (Links, Images, & Multimedia) CSCE General Applications Programming Benito Mendoza 1 By Benito Mendoza Department.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
3D Game Programming All in One By Kenneth C. Finney.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
1 Introduction to Computer Graphics SEN Introduction to OpenGL Graphics Applications.
Computer Graphics I, Fall 2008 Introduction to Computer Graphics.
© 2011 Delmar, Cengage Learning Chapter 1 Getting to Know Illustrator.
3D Graphics for Game Programming Chapter IV Fragment Processing and Output Merging.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 3 This presentation © 2004, MacAvon Media Productions Introduction to Computer Graphics.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
CS- 375 Graphics and Human Computer Interaction Lecture 1: 12/4/1435 Fundamental Techniques in Graphics Lecturer: Kawther Abas.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 5 Chapter 5: MVC Architecture.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
CHAPTER 8 Color and Texture Mapping © 2008 Cengage Learning EMEA.
Vector Graphics Multimedia Technology. Object Orientated Data Types Created on a computer not by sampling real world information Details are stored on.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Chapter 15: Working with the Camera.
Texture Mapping CAP4730: Computational Structures in Computer Graphics.
CS 325 Introduction to Computer Graphics 04 / 12 / 2010 Instructor: Michael Eckmann.
File Texture Mapping Pasting images on primitives.
CS COMPUTER GRAPHICS LABORATORY. LIST OF EXPERIMENTS 1.Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2.Implementation of Line,
1 Perception and VR MONT 104S, Fall 2008 Lecture 20 Computer Graphics and VR.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 9 Chapter 9: Combining Transformation Operators.
Graphics and Image Data Representations 1. Q1 How images are represented in a computer system? 2.
1 Sections 5.1 – 5.2 Digital Image Processing Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 5 Examples 1.
Main characteristics of Vector graphics  Vector graphics provide an elegant way of constructing digital images (diagrams, technical illustration and.
David Meredith Aalborg University
- Introduction - Graphics Pipeline
Textures, Sprites, and Fonts
Textures, Sprites, and Fonts
Inserting and Working with Images
Chapter 3 Graphics and Image Data Representations
CS451Real-time Rendering Pipeline
Chapter 3:- Graphics Eyad Alshareef Eyad Alshareef.
Models and Architectures
Chapter 5 Working with Images
Graphics and Animation
File Texture Mapping Pasting images on primitives.
Making the Applications Interesting
Hierarchical Modeling
Introduction to Computer Graphics
Models and Architectures
Chapter 13: A Simple 3D Application Chapter 13.
Computer Graphics 4Practical Lesson
Models and Architectures
Particle Systems - A Technique for Modeling a Class of Fuzzy Objects
Graphics and Animation
Presentation transcript:

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Chapter 12: Making the Applications Interesting

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 This Chapter: we will learn about Simple Mathematics to Orientate SceneNodes Control SceneNode motion Alpha Blending Simulate transparency File Texture Mapping

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tutorial 12.1: Orientation Orientation and movement of a scene node (or object) Arm (scene node hierarchy) Orientates and moves towards mouse click

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Orientation of Objects Current Front Direction Need Target Direction Must compute rotation angle left/right

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Arm OC space Origin: Front position: In WC Space Origin: Front: Front Direction in WC: Front Direction in WC Space

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Target Direction in WC Target position in WC: Target Direction (from arm origin)

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Rotation: angle and direction Rotation angle: Direction:

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tut 12.1: Implementation

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tut 12.1: Implementation (Step 1)

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tut 12.1: Implementation (Step 2)

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tut 12.1: Implementation (Step 3)

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tut 12.1: Lessons Learned Coordinate System Choose WC for all computation OC positions are transformed to WC Directions Front in OC vs. Front in WC (different!) To compute: identify two points in OC and transform to WC to compute a vector Turning Angle: dot product Left vs. right: cross product and examine size of Z Gradual Effect Set transform operator to a percentage of the desired value Achieve gradual approximating the desired effect

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tutorial 12.2: Navigation and Aiming Navigate towards a position (Tut 12.1); … while Aiming (Looking) at another position

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Palm OC space Origin: Front position: In WC Space Origin: Front: Front Direction in WC: Target Position: palm towards target Positions and Directions of The Palm

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tut 12.2: Implementation Goal: Rotate to align to Fundamentally Identical solution!

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tut 12.2: Details …

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Transparency (Alpha Blending) Drawing a rectangle: Source: color of rectangle Destination: pixels in frame buffer Source written into Destination Source overwrites Destination

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Blending vs. Over writing Instead of over writing D  S Compute a new value for D based on current D and S D  f(D x A d, S x A s )

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Example: Simple blending Draw a blue rectangle (no blending) Now set Source blend factor: Destination blend factor: Blending function: Add Draw a red rectangle:

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Blending and Alpha Channel Store blending factor as part of color Instead of Color = (r, g, b) Include a 4 th channel: (r, g, b, α ) α cannot affect pixel color directly (r, g, b) changes pixel directly α used as either source blend factor (A s ) or destination blend factor (A d )

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Example: Working with α Channel Draw a normal blue rectangle Pixel color (Destination) D r D g D b = (0.8, 0.8, 0.8) Now, A red rectangle with Source Color: S r S g S b S α = (0.2, 0.2, 0.2, 0.8) Blending setting: Source blend: A s = S α Destination blend: A d = (1 - S α ) Blending Function: Add α Controls blending: Alpha Blending

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Alpha as: Opacity When: Source Blend Factor Destination Blend Factor Blend Function: Add Alpha is opacity Alpha = 1 Destination is over-written Alpha = 0 Source is completely invisible!

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Graphics API Support for Blending Blending Factors: A s and A d Blending Function: f()

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Program Alpha Blending

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Lib 13: Blending Functionality Drawing Support (DrawHelper) enable/disable for

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Lib 13: Primitive Blending Support Per Primitive … blending enable/disable

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tutorial 12.3: Alpha Blending Alpha value of object color

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 File Texture Mapping Pasting images on primitives

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 File Texture and Mapping File Texture: an image file A 2D array of color stored in a file Texel: each color element in the file Any image or digital photograph Images are stored in formatted files: E.g.: gif, jpg, tiff, png. Mapping: “pasting on” Paste the image (file texture) on a given primitive

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Texture Coordinates Mapping: matching of coordinates A coordinate system on image file (st) - coordinate A coordinate system on primitive (uv) - coordinate Mapping: Match the two coordinate systems!

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Implicit st – Coordinate System implicitly defined on all file textures Origin: upper-left corner s-Axis: Right-wards t-axis: down-wards Range: 0.0 to 1.0 Coverage: always the entire image!

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Explicit uv – Coordinate System uv are Defined on the Primitives Defined by, us, the programmers! Each vertex of a primitive: A Position: (x, y, z) A Color: (r, g, b) NOW: Texture Coordinate (u, v)

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Example of defining uv: rectangle

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Mapping: Texel lookup Texel color (C a ) used as color of primitive

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Programming File Texture 1. We must define uv-coordinate on primitives 2. Select/Load an image file into the graphics API 3. Define how texel will be used 4. Enable texture mapping before drawing the primitive

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tutorial: 12.4: Simple File Texture Select any image Mapped on circle/rectangle

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tutorial 12.4: Details Vertex Format uv on a Unit Square

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tutorial 12.4: uv on a Circle

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tutorial 12.4: File Texture Support

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Lib 13: File Texture Support Resources: Loading and storage of any “files” for now just textures. Implementation: GraphicsSystem Enable/Disable texture mapping: per-primitive support select which texture If texture mapping is enabled Implementation: Primitive and DrawHelper uv coordinate definition As shown in Tutorial 12.4 Implementation: DrawHelper and DeviceVertexFormat

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Lib13: Resources: search/load files

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Lib13: Using file texture resource In GraphcsSystem: Activate/DeActivate Texture

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Lib 13: Per-Primitive Texture Attributes In Primitive class: In DrawHelper class:

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Tut 12.5: File Texture & Blending