Ch 10: Game Event Management. Quiz # 4 Discussion

Similar documents
Shaders. Slide credit to Prof. Zwicker

CS 130 Final. Fall 2015

The Rasterization Pipeline

Point Lighting Using Shaders

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2014

CSE 167: Introduction to Computer Graphics Lecture #7: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2015

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping

CS451Real-time Rendering Pipeline

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

CHAPTER 1 Graphics Systems and Models 3

Software Engineering. ò Look up Design Patterns. ò Code Refactoring. ò Code Documentation? ò One of the lessons to learn for good design:

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Lecture #8: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

INFOGR Computer Graphics

3D GRAPHICS. design. animate. render

Underwater Manager (Optional)

Shading. Shading = find color values at pixels of screen (when rendering a virtual 3D scene).

Illumination and Shading

Lecture 1. Computer Graphics and Systems. Tuesday, January 15, 13

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

CS GPU and GPGPU Programming Lecture 7: Shading and Compute APIs 1. Markus Hadwiger, KAUST

Programming Graphics Hardware

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

Programmable Graphics Hardware

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

LEVEL 1 ANIMATION ACADEMY2010

INFOGR Computer Graphics

Evolution of GPUs Chris Seitz

CS559 Computer Graphics Fall 2015

03 RENDERING PART TWO

Real - Time Rendering. Graphics pipeline. Michal Červeňanský Juraj Starinský

Introduction to Shaders.

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

Programmable GPUs. Real Time Graphics 11/13/2013. Nalu 2004 (NVIDIA Corporation) GeForce 6. Virtua Fighter 1995 (SEGA Corporation) NV1

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Shadows. Prof. George Wolberg Dept. of Computer Science City College of New York

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Computergrafik. Matthias Zwicker. Herbst 2010

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

Computer Graphics (CS 543) Lecture 10: Normal Maps, Parametrization, Tone Mapping

Programming with OpenGL Part 3: Shaders. Ed Angel Professor of Emeritus of Computer Science University of New Mexico

CS5620 Intro to Computer Graphics

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Texture mapping. Computer Graphics CSE 167 Lecture 9

Assignment 2 Ray Tracing

Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)

Recall: Indexing into Cube Map

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

IMAGE-BASED RENDERING AND ANIMATION

Chapter 7 - Light, Materials, Appearance

Computer Graphics I Lecture 11

Mattan Erez. The University of Texas at Austin

12.2 Programmable Graphics Hardware

TSBK03 Screen-Space Ambient Occlusion

Today. Texture mapping in OpenGL. Texture mapping. Basic shaders for texturing. Today. Computergrafik

Computer Graphics Coursework 1

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading

GUERRILLA DEVELOP CONFERENCE JULY 07 BRIGHTON

The Application Stage. The Game Loop, Resource Management and Renderer Design

Lecture 2. Shaders, GLSL and GPGPU

Technical Game Development II. Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS 4731 Computer Graphics

6.837 Introduction to Computer Graphics Quiz 2 Thursday November 20, :40-4pm One hand-written sheet of notes allowed

lecture 19 Shadows - ray tracing - shadow mapping - ambient occlusion Interreflections

Homework 3: Programmable Shaders

X3D - Texture, Material Properties, Artificial Light Models -

CS 464 Review. Review of Computer Graphics for Final Exam

Computer Graphics. Illumination and Shading

Virtual Reality for Human Computer Interaction

Lab 9 - Metal and Glass

CEng 477 Introduction to Computer Graphics Fall

Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express

Computer Graphics. Lecture 02 Graphics Pipeline. Edirlei Soares de Lima.

Deferred Rendering Due: Wednesday November 15 at 10pm

Could you make the XNA functions yourself?

Real-Time Universal Capture Facial Animation with GPU Skin Rendering

LIGHTING AND SHADING

EDAF80 Introduction to Computer Graphics. Seminar 3. Shaders. Michael Doggett. Slides by Carl Johan Gribel,

Graphics and Interaction Rendering pipeline & object modelling

Computer Graphics. Instructor: Oren Kapah. Office Hours: T.B.A.

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

Normal Maps and Cube Maps. What are they and what do they mean?

GLSL 1: Basics. J.Tumblin-Modified SLIDES from:

Rendering Algorithms: Real-time indirect illumination. Spring 2010 Matthias Zwicker

CS 4620 Program 3: Pipeline

CPSC / Illumination and Shading

Graphics for VEs. Ruth Aylett

CS GPU and GPGPU Programming Lecture 12: GPU Texturing 1. Markus Hadwiger, KAUST

CS 354R: Computer Game Technology

Graphics for VEs. Ruth Aylett

Spring 2011 Prof. Hyesoon Kim

AGDC Per-Pixel Shading. Sim Dietrich

CS GPU and GPGPU Programming Lecture 11: GPU Texturing 1. Markus Hadwiger, KAUST

Ray Tracer Due date: April 27, 2011

Computer Graphics. Illumination and Shading

Per-Pixel Lighting and Bump Mapping with the NVIDIA Shading Rasterizer

Transcription:

Ch 10: Game Event Management Quiz # 4 Discussion

Moving the Camera Toggle between first and third person view Translate object

Transformations ò Quaternion: rotation around arbitrary axis ò Advantages : ò They simply never suffer from gimbal lock (rotations cancelling each other out) ò simple ò You can easily created smooth transitions between several rotations ò You can concatenate them (like matrices) to do several rotations at once

Class Work ò Put several 3D model2 in the scene ò Create a simple environment ò Make a Camera Fly through the scene

Effects Chapter 6 from Tom Miller s book

Effects ò Textures and Texture Maps ò Lighting ò Light Maps

ò Environment Maps: is an approximation of how the environment is reflected on a reflective object. Effects

Effects ò Bump Maps: Is a technique in graphics to approximate wrinkles and bumps

Effects ò Lighting: ò Many different effects From: beyond3d From: opengl programming

Effects ò Lighting: ò Many different effects From: Joshua Andersen s work at Utah

Effects ò Lighting: ò Many different effects From: Joshua Andersen s work at Utah

Review from Graphics Color and Texture Mapping

Color Models ò RGB Color Model ò HSV/HSL Color Model ò CIEXYZ Color Model

RGB Color Model ò Point is described in 3D space (R, G, B) ò 0,0,0 is black ò 1, 1, 1 is white From: http://www.clear.rice.edu/elec301/projects02/artspy/color.html

HSL/HSV Model ò Transformation of RGB into a double cone ò Lightness 0-1, white to black, correspond to diagonal in RGB model http://zone.ni.com/reference/en-xx/help/372916l-01/ nivisionconcepts/color_spectrum/ http://prosjekt.ffi.no/unik-4660/lectures04/chapters/

HSL/HSV Model ò Lightness = ò Saturation = (radial distance) 1 (R +G + B) 3 x 2 + y 2 x = 1 (2R G B), y = 1 (G B) k x k y http://zone.ni.com/reference/en-xx/help/372916l-01/ nivisionconcepts/color_spectrum/ ò Hue = tan 1 (x, y)

CIE-Lab Color Space ò Defined in X, Y, Z space corresponding to how the retina behaves to light ò RGB to XYZ space is linear transformation:! # # # " R G B $! & # & = # & # % " 3.24 1.53 0.49 0.96 1.87 0.04 0.05 0.20 1.05 $! &# &# &# %" X Y Z $ & & & % http://www.cmpg.org/site/2005/07/26/an-introduction-t color-space-and-color-calibration/

Texture Mapping basic idea ò You don t want to model everything mathematically ò To give the environment more depth and realism, we can use images imposed on the models. http://radoff.com/blog/2008/08/22/anatomy-of-an-mmorpg/ http://siharat.blogspot.com/2009/08/glsl-parallax-map.html

3D Textures Texture Mapping Approaches ò Develop a texture mathematically, using f (x, y, z) = c ò Store values in 3D table and look up values http://www.siggraph.org/education/materials/hypergraph/mapping/r_wolfe/

Example procedural texture ò Using Sine wave to develop procedural texture ProcTexture (x, y, z)! {! if (sin(x) >0)!!return Color.Red;! else!!return Color.White;! }! You can see how this can be extended to 3D

Example procedural texture ò Using Sine wave to develop procedural texture ProcTexture (x, y, z)! {! if (sin(z) >0)!!return Color.Red;! else!!return Color.White;! }! From Hurst s Lecture Notes

Texture mapping 2D n y u,v i,j 0 n x Problem: map i.j (texel) u,v (pixel)

Texture mapping 2D n y u,v i,j 0 n x One Solution (tiling): Remove the integer portion of u, v (e.g., 0.9,2.2 ->.9,.2) Interpolate to find exact i, j

Texture mapping 2D n y i,j+1 i+1,j+1 u,v i,j i+1,j 0 n x One Solution (tiling): Remove the integer portion of u, v (e.g., 0.9,2.2 ->.9,.2) Nearest-neighbor interpolation to find exact i, j C(i, j) = C(! " un x # $,! " vn y # $ )

Lighting Design Dramatic Tension Visual Focus Style Feel of the space Time of Day Period visibility

Lighting in Traditional Media

Light Maps: Non-Interactive Lighting through dual textures Advantages: ò realistic ò Controllable Disadvantages: x = Images from Lightmaps (static shadowmaps) article written by Kurt Miller from: http://www.flipcode.com/articles/article_lightmaps.shtml ò Don t adapt to variations in the environment ò Requires much memory Image from Max Payne

Use of Dynamic Lighting

Dynamic lighting This is mostly done through shaders and lighting effects

Lighting Models Implementing Lighting Effects ò Shader Language ò Cg (Nvidia) ò HLSL (Microsoft derived from Nvidia) ò GLSL (OpenGL)

Types of Shaders ò Vertex Shaders CPU GPU ò Execute per vertex ò Transform 3D to 2D XNA ò Manipulate position, color, texture ò Cannot add new Vertices ò Geometry Shaders ò Can add/remove vertices ò Can Procedurally generate geometry ò Pixel Shaders Vertices Textures Vertex Shader Position Rasterization Pixel Shader Color ò ò ò Execute per pixel Calculate color for individual pixels Calculates lighting, textures, etc. Display

BasicEffect simplifies the problem and allows you to quickly render basic effects without having to program shaders, So let s look at what the BasicEffect allows you to do

Effect Classes Public interface IEffectMatrices { Matrix Projection { get; set;} Matrix View { get; set;} Matrix World {get; set; } }

Lighting for basic effect ò BasicEffect uses per vertex lighting ò effect.lightingenabled = true; will enable lighting on the model ò effect.lightingenabled = false; switches off the lighting

Effect Classes Public interface IEffectLights { Vector3 AmbientLightColor {get; set; } DirectionalLight DirectionalLight0 {get;} DirectionalLight DirectionalLight1 {get;} DirectionalLight DirectionalLight2 {get;} bool LightingEnabled { get; set;} Void EnableDefaultLighting(); }

Types of Lights ò Ambient ò Directional ò Point ò Spot Light ò Color: RGB color model (1,0,0)

Ambient Light ò Uniform color for all the scene ò Not very realistic and can be dull ò By default color is 0,0, 0 (black) ò Can be used to fill in shadow areas so they won t be completely black, one way to simulate light reflections off of surfaces (global illumination)

Point Light ò Light emitted from a point in 3D space ò Light is emitted uniformly To calculate, need angle bt. Normal and light direction: Dot product, which determines how much of the light color is applied on vertex or pixel: Color = base color * (light intensity * cos(angle) + ambient); If parallel to normal: full color is applied if Perpendicular to normal: no color

Directional Lights ò Light emitted using an angle spread ò Thus, they have a direction ò Used to simulate: sun light

Spot Light ò Light emitted using an angle spread ò Light attenuates over distance

Quality of Lighting ò Diffuse vs. Specular ò In XNA: ò Effect.SpecularColor = Color.White.ToVector3(); ò Effect.SpecularPower = 100.0f; ò Effect.DirectionalLight0.SpecularColor ò Effect.DirectionalLight0.DiffuseColor From: Joshua Andersen s work at Utah

Basic Effects using XNA ò Try out the BasicEffect, Directional Lights, Diffuse and Specular Lights

Basic Effects using XNA

In-class Exercise ò Take a model that you used and play around with the BasicEffect properties ò EnableDefaultLighting ò Add/Remove and change colors for Directional Lights ò Change Diffuse Light and Specular Light properties ò DiffuseColor ò SpecularColor in both the directional light and on effect ò SpecularPower

Per Pixel vs. Per Vertex Lighting ò In XNA: Effect.PreferedPerPixelLighting = true;

Other Effects Public interface IEffectFog { Vector3 FogColor {get; set;} bool FogEnabled {get; set;} float FogEnd { get; set;} float FogStart {get; set;} }

Other Effects ò DualTextureEffect (Light Maps) ò EnvironmentMapEffect

Custom Shaders Chapter 13 from Aaron s Book

Effect File

Effect F

In XNA ò Add the effect into the content ò Effect myeffect; //declare the effect ò In Loading function: ò myeffect = Content.Load<Effect>("SampleEffect");

In XNA

Assignment #2 ò Scene graph for representing your scene ò Think about the architecture: ò Events? ò Effects? ò Movement?