CSE 381 – Advanced Game Programming Shading.

Slides:



Advertisements
Similar presentations
16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
Advertisements

Exploration of bump, parallax, relief and displacement mapping
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Graphics Pipeline.
CS-378: Game Technology Lecture #9: More Mapping Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
 Engineering Graphics & Introductory Design 3D Graphics and Rendering REU Modeling Course – June 13 th 2014.
Texture Mapping and Programmable Graphics Hardware
Rasterization and Ray Tracing in Real-Time Applications (Games) Andrew Graff.
CS5500 Computer Graphics © Chun-Fa Chang, Spring 2007 CS5500 Computer Graphics April 19, 2007.
CGDD 4003 THE MASSIVE FIELD OF COMPUTER GRAPHICS.
(conventional Cartesian reference system)
X86 and 3D graphics. Quick Intro to 3D Graphics Glossary: –Vertex – point in 3D space –Triangle – 3 connected vertices –Object – list of triangles that.
Status – Week 277 Victor Moya.
The Graphics Pipeline CS2150 Anthony Jones. Introduction What is this lecture about? – The graphics pipeline as a whole – With examples from the video.
Computer Science – Game DesignUC Santa Cruz Adapted from Jim Whitehead’s slides Shaders Feb 18, 2011 Creative Commons Attribution 3.0 (Except copyrighted.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
UFCEKT-20-33D Modelling and Animation 3D Modelling & Animation Materials and Textures Maps.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
GPU Programming Robert Hero Quick Overview (The Old Way) Graphics cards process Triangles Graphics cards process Triangles Quads.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,
Shading. What is Shading? Assigning of a color to a pixel in the final image. So, everything in shading is about how to select and combine colors to get.
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.
Chris Kerkhoff Matthew Sullivan 10/16/2009.  Shaders are simple programs that describe the traits of either a vertex or a pixel.  Shaders replace a.
A Crash Course in HLSL Matt Christian.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
TERRAIN SET09115 Intro to Graphics Programming. Breakdown  Basics  What do we mean by terrain?  How terrain rendering works  Generating terrain 
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
CS662 Computer Graphics Game Technologies Jim X. Chen, Ph.D. Computer Science Department George Mason University.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
Shader Programming Introduzione. History We have seen ever-increasing graphics performance in PCs since the release of the first 3dfx Voodoo cards in.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
09/25/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Shadows Stage 2 outline.
Ray Tracing using Programmable Graphics Hardware
Where We Stand So far we know how to: –Transform between spaces –Rasterize –Decide what’s in front Next –Deciding its intensity and color.
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.
GLSL I.  Fixed vs. Programmable  HW fixed function pipeline ▪ Faster ▪ Limited  New programmable hardware ▪ Many effects become possible. ▪ Global.
Schedule Update GP 4 – Tesselation/Cg GDS 4 – Subdiv Surf. GP 5 – Object Modeling Lab: Mini-proj Setup GDS 5 – Maya Modeling MCG 6 – Intersections GP 6.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
Applications and Rendering pipeline
Shaders, part 2 alexandri zavodny.
Ying Zhu Georgia State University
Programmable Pipelines
Graphics Processing Unit
Deferred Lighting.
Chapter 6 GPU, Shaders, and Shading Languages
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Understanding Theory and application of 3D
Chapter 14 Shading Models.
Graphics Processing Unit
Computer Graphics Introduction to Shaders
Chapter 14 Shading Models.
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
Presentation transcript:

CSE 381 – Advanced Game Programming Shading

What is Shading? Calculating how a 3D object should look, taking lighting into account Depends on: –mesh data vertices, colors, textures, etc. –lighting properties type of light, position of light, etc. –shading algorithm used How is it done? –basically by running a script on your graphics card

What’s a Shader? A good definition from Wikipedia: –a program used to determine the final surface properties of an object or image –this can include arbitrarily complex descriptions of: light absorption light diffusion texture mapping reflection refraction shadowing surface displacement post-processing effects

Simpler Shader Definition A program that can affect: –the position of a vertex –the color of a pixel –or both Create interesting effects by: –manipulating geometry –manipulating color

Shader Languages HLSL, GLSL, Cg (C for Graphics) Compile to Assembly Shader compilers are on the GPU Compiling is done at runtime

Shading Languages Shader programs may be written for different platforms –can operate on GPU Different platforms use different shading languages, e.g. –High-Level Shading Language (HLSL) uses C-like code –OpenGL Shading Language (GLSL) uses C-like code –Nvidia Cg uses assembly-like code –Pixar’s RenderMan the pioneer among shaders

Shader Types Vertex Shader Pixel Shader (Fragment Shader in GLSL) Geometry Shader Compute Shader

Vertex Shader Job is to process vertices and send them to pixel shader Process? –Transformation & lighting Let’s look at an HLSL example & GLSL example

Shading Techniques Flat shading Smooth Shading –Gouraud shading –Phong shading Additional techniques: –bump mapping –cel shading –and many more

Let’s assume we want to render a red ball Ignore textures for now How can we shade the ball to make it realistic?

Flat Shading Assigns a single color to a polygon Simple & fast Color based on: –Material color –the polygon's normal –the position and intensity of a light source.

Gouraud Shading invented by Henri Gouraud in 1971 simulates smoothly shaded surfaces How? –computes vertex colors using normals & lighting –interpolates vertex colors across a polygon's surface done linearly fast and resource-conscious

Phong Shading invented by Bui Tuong Phong a smooth shading technique approximates curved-surface lighting How? –interpolates the vertex normals of a polygon across the surface Most realistic but expensive

Bump Mapping invented by Jim Blinn an extension of Phong shading simulates bumpy or wrinkled surfaces How? –at each pixel along a surface, slight changes are made to the normal –these changes are usually stored in a texture map

Cel Shading also called “toon shading” technique of making computer generated graphics appear to look hand drawn How? –objects have black outlines (as though done with pencil) done via inversing back-face culling with black vertices & slight translation –only a few shades of each color used for objects

Example of Cel Shading From The Legend of Zelda: The Wind Talker

Different Effects using Different Shaders

Texture Shading Textures can be lit as well –we’ve already seen this How? –make polygon white & light normally –when laying texture, calculate texel brightness using polygon colors before texture We can exert further control over how textures appear –ex: texture blending

Rendering Pipeline Ordered operations involved in transforming a scene to a screen –transformations, hiding, lighting, shading, projection Rendering Options: –Fixed-function pipeline actually emulated these days –Programmable pipeline

What’s wrong with fixed-function? Certain graphics algorithms are pre-programmed into graphics cards (ex: Gouraud shading) So what? –What if we want to use different algorithms? Why is the programmable pipeline necessary? –can perform non-standard lighting/shading –can achieve higher quality lighting/shading –do these things on the hardware level

Typical Graphics Pipeline In the traditional Programmable pipeline, which 2 stages may we control? –vertex processing –pixel processing

Types of Shaders Vertex Shaders –allows programmer to control transformation & lighting operations (T&L) Pixel Shading –the output of a vertex shader provides input to a pixel shader –allows programmer to ultimately decide final pixel colors before rasterization Shader Models –standardized support for shader programs –ex: Microsoft’s Shader Model 3.0

Possible uses of Vertex Shaders Procedural Geometry (Isidoro/Gosslin) –cloth simulation, soap bubbles Advanced Vertex Blending for Skinning and Vertex Morphing (Gosselin) –tweening Texture Generation (Riddle/Zecha) Advanced Keyframe Interpolation –complex facial expression and speech Particle System Rendering Real-Time Modifications of the Perspective View –lens effects, underwater effect Advanced Lighting Models –in cooperation with the pixel shader Displacement Mapping (Calver) And whatever will appear at next year’s SIGGRAPH Conference

Possible Uses of Pixel Shaders Single pass, per-pixel lighting True phong shading (Beaudoin/Guardado) Anisotropic lighting (Isidoro/Brennan) Non-Photorealistic-Rendering (Card/Mitchell) –Ex: cartoon shading, hatching, gooch lighting, image space techniques Per-pixel fresnel term (Brennan) Volumetric effects (Kraus, Hart) Advanced bump mapping (self-shadowing bump maps) –also known as Horizon Mapping Procedural textures (Zecha) Texture perturbation (Isidoro/Riguer) Bidirectional reflectance distribution functions (Moravánsky) And whatever will appear at next year’s SIGGRAPH Conference

Shader Tools Most modeling tools provide shader support –WYSIWYG use of algorithms –generation of shader code –shader work encapsulated in effects Ex: –Maya –3D Studio Max, –NVIDIA’s Effects Browser, Shader City, & Shader Studio

Next Time Shader Examples GLSL & HLSL

Resources GameDev.net – – HowStuffWorks – MSDN – us/directx9_c/directx/graphics/programmingguide/gettingstarted/architecture. asphttp://msdn.microsoft.com/library/default.asp?url=/library/en- us/directx9_c/directx/graphics/programmingguide/gettingstarted/architecture. asp Wikipedia – –