Lecture 08: Blending Dr. Manal Helal – Fall 2014

Slides:



Advertisements
Similar presentations
Interpolation and Splines
Advertisements

Animation in Video Games presented by Jason Gregory
Video Mosaics CS 294/283 Final Project Steve Martin U.C. Berkeley, Fall 2003.
 Caesar used to encrypt his messages using a very simple algorithm, which could be easily decrypted if you know the key.  He would take each letter.
Computer Graphics - Class 10
Eleven colors and rasters. Color objects [color name] Returns color with the specified name [color red green blue] Returns color with the specified amounts.
Now Playing: Gong Sigur Rós From Takk... Released September 13, 2005.
Lesson 4: Percentage of Amounts.
CS 450: COMPUTER GRAPHICS QUATERNIONS SPRING 2015 DR. MICHAEL J. REALE.
ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Line Integrals.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
Art 321 Lecture 7 Dr. J. Parker. Programming In order to ‘make things happen’ on a computer, you really have to program it. Programming is not hard and.
Game Architecture 2/6/15: Splines Brought to you by Squirrel Eiserloh.
Digital Media Lecture 4.1: Image Encoding Practice Georgia Gwinnett College School of Science and Technology Dr. Jim Rowan.
ME 2304: 3D Geometry & Vector Calculus
Specular Reflection Lecture 27 Mon, Nov 10, 2003.
AP Physics C – Vectors. 1.1 Vectors. Vectors are mathematical quantities indicated by arrows. The length of the arrow denotes the magnitude or the size.
Digital Media Dr. Jim Rowan ITEC 2110 Chapter 3. Roll call.
Digital Media Lecture 4.2: Image Encoding Practice Georgia Gwinnett College School of Science and Technology Dr. Jim Rowan.
Computer Graphics Lecture 17 3-D Transformations-I Taqdees A. Siddiqi
COMPUTER GRAPHICS CS 482 – FALL 2016 CHAPTER 28 COLOR COLOR PERCEPTION CHROMATICITY COLOR MODELS COLOR INTERPOLATION.
Copyright © Cengage Learning. All rights reserved. Normal Curves and Sampling Distributions 7.
Motion In One Dimension Physics Honors furai-race-car.html.
Introduction to CSCI 1311 Dr. Mark C. Lewis
Genetic Algorithms 11-Oct-17.
3D Rotation: more than just a hobby
Color Basics.
Game Engine Architecture
Mr Barton’s Maths Notes
Vector 2.
Lecture Outline Chapter 3 Physics, 4th Edition James S. Walker
CPSC 641: Computer Graphics Rotation Representation and Interpolation
COMPUTER GRAPHICS CHAPTERS CS 482 – Fall 2017 TRANSFORMATIONS
Digital Media Lecture 4.1: Image Encoding Practice
Mr F’s Maths Notes Number 7. Percentages.
Lecture Outline Chapter 3
Deferred Lighting.
Motion In One Dimension
Computer Programming Methodology Luminance
Math Linear Algebra Introduction
Vectors and Scalars Chapter 2.
Add the vectors A, B, and C shown in the figure using the component method. A = 5.0m, B = 7.0m, and C = 4.0m Adding like components of two or more vectors.
EEL 3705 / 3705L Digital Logic Design
Physics VECTORS AND PROJECTILE MOTION
Functions BIS1523 – Lecture 17.
Digital Media Dr. Jim Rowan ITEC 2110.
Rasterizing Lines 1 Lecture 32 Mon, Nov 12, 2007.
ID1050– Quantitative & Qualitative Reasoning
Bitwise Operations and Bitfields
Algebraic Addition of Vectors
Lecture Outline Chapter 3 Physics, 4th Edition James S. Walker
Chap. 3: Kinematics in Two or Three Dimensions: Vectors
Developing Sentence Skills
Mr Barton’s Maths Notes
Physics VECTORS AND PROJECTILE MOTION
Genetic Algorithms 25-Feb-19.
Learning Chapter 18 and Parts of Chapter 20
Mean & Standard Deviation
Physics VECTORS AND PROJECTILE MOTION
Lecture Outline Chapter 3 Physics, 4th Edition James S. Walker
CDA 3100 Fall 2012.
Binary CSCE 101.
UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN
Genetic Algorithms 26-Apr-19.
CHAPTER 2 FORCE VECTOR.
Have the book completed for me to grade next class
Developing Sentence Skills
Lighting Calculations
Screw Rotation and Other Rotational Forms
Presentation transcript:

Lecture 08: Blending Dr. Manal Helal – Fall 2014 Computer Graphics CC416 Lecture 08: Blending Dr. Manal Helal – Fall 2014

Averaging and Blending First, we start off with the basics. I mean, really basic. Let’s go back to grade school. How do you average two numbers together? (A + B) / 2

Averaging and Blending Let’s change that around a bit. (A + B) / 2 becomes (.5 * A) + (.5 * B) i.e. “half of A, half of B”, or “a 50/50 blend of A and B”

Averaging and Blending We can, of course, also blend A and B unevenly (with different weights): (.35 * A) + (.65 * B) In this case, we are blending “35% of A with 65% of B”. We can use any blend weights we want, as long as they add up to 1.0 (100%).

Averaging and Blending So if we generalized it, we would say: (s * A) + (t * B) ...where s is “how much of A” we want, and t is “how much of B” we want ...and s + t = 1.0 (really, s is just 1-t) so: ((1-t) * A) + (t * B) Which means we can control the balance of the entire blend by changing just one number: t

Averaging and Blending There are two ways of thinking about this (and a formula for each): #1: “Blend some of A with some of B” (s * A) + (t * B)  where s = 1-t #2: “Start with A, and then add some amount of the distance from A to B” A + t*(B – A)

Averaging and Blending In both cases, the result of our blend is just plain “A” if t=0; i.e. if we don’t want any of B. (1.00 * A) + (0.00 * B) = A or: A + 0.00*(B – A) = A

Averaging and Blending Likewise, the result of our blend is just plain “B” if t=1; i.e. if we don’t want any of A. (0.00 * A) + (1.00 * B) = B or: A + 1.00*(B – A) = A + B – A = B

Averaging and Blending However we choose to think about it, there’s a single “knob”, called t, that we are tweaking to get the blend of A and B that we want.

Blending Compound Data

Blending Compound Data We can blend more than just simple numbers! Blending 2D or 3D vectors, for example, is a cinch: P = (s * A) + (t * B)  where s = 1-t Just blend each component (x,y,z) separately, at the same time. Px = (s * Ax) + (t * Bx) Py = (s * Ay) + (t * By) Pz = (s * Az) + (t * Bz)

Blending Compound Data (such as Vectors)

Blending Compound Data (such as Vectors)

Blending Compound Data (such as Vectors)

Blending Compound Data (such as Vectors)

Blending Compound Data Need to be careful, though! Not all compound data types will blend correctly with this approach. Examples: Color RGBs, Euler angles (yaw/pitch/roll), Matrices, Quaternions... ...in fact, there are a bunch that won’t.

Blending Compound Data Here’s an RGB color example: If A is RGB( 255, 0, 0 ) – bright red ...and B is RGB( 0, 255, 0 ) – bright green Blending the two (with t = 0.5) gives: RGB( 127, 127, 0 ) ...which is a dull, swampy color. Yuck.

Blending Compound Data What we wanted was this: ...and what we got instead was this:

Blending Compound Data For many compound classes, like RGB, you may need to write your own Blend() method that “does the right thing”, whatever that may be. (For example, when interpolating RGBs you might consider converting to HSV, blending, then converting back to RGB at the end.) Jim will talk later about what happens when you try to blend Euler Angles (yaw/pitch/roll), Matrices, and Quaternions using this simple “naïve” approach of blending the components.