POST-PROCESSING SET09115 Intro Graphics Programming.

Slides:



Advertisements
Similar presentations
Exploration of advanced lighting and shading techniques
Advertisements

Compositing and Blending Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 1/16 Deferred Lighting Deferred Lighting – 11/18/2014.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Frame Buffer Postprocessing Effects in DOUBLE-S.T.E.A.L (Wreckless)
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Graphics Pipeline.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Week 11 - Wednesday.  Image based effects  Skyboxes  Lightfields  Sprites  Billboards  Particle systems.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
Real-time Dynamic HDR Based Lighting in a Static Environment Marcus Hennix Daniel Johansson Gunnar Johansson Martin Wassborn.
Rasterization and Ray Tracing in Real-Time Applications (Games) Andrew Graff.
Ch 1 Intro to Graphics page 1CS 367 First Day Agenda Best course you have ever had (survey) Info Cards Name, , Nickname C / C++ experience, EOS experience.
GEOMETRY SHADER. Breakdown  Basics  Review – graphics pipeline and shaders  What can the geometry shader do?  Working with the geometry shader  GLSL.
Post-rendering Cel Shading & Bloom Effect
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
SET09115 Intro Graphics Programming
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
Basic Graphics Concepts Day One CSCI 440. Terminology object - the thing being modeled image - view of object(s) on the screen frame buffer - memory that.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
INTRO TO COMPUTER GRAPHICS TEXT EDWARD ANGEL: EDITION 5 CS770/870
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Visual quality techniques.
Geometric Objects and Transformations. Coordinate systems rial.html.
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.
A Crash Course in HLSL Matt Christian.
TERRAIN SET09115 Intro to Graphics Programming. Breakdown  Basics  What do we mean by terrain?  How terrain rendering works  Generating terrain 
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
1 Introduction to Computer Graphics SEN Introduction to OpenGL Graphics Applications.
Real-time Shadow Mapping. Shadow Mapping Shadow mapping uses two-pass rendering - render depth texture from the light ’ s point-of-view - render from.
Week 6 - Wednesday.  What did we talk about last time?  Light  Material  Sensors.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
1 Computer Graphics Week2 –Creating a Picture. Steps for creating a picture Creating a model Perform necessary transformation Lighting and rendering the.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
CSE 381 – Advanced Game Programming GLSL Lighting.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
Realtime NPR Toon and Pencil Shading Joel Jorgensen May 4, 2010.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
BUMP-MAPPING SET09115 Intro to Graphics Programming.
Computer Graphics Blending CO2409 Computer Graphics Week 14.
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
Maths & Technologies for Games Advanced Graphics: Scene Post-Processing CO3303 Week
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.
Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
The Graphics Pipeline Revisited Real Time Rendering Instructor: David Luebke.
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.
- Introduction - Graphics Pipeline
Discrete Techniques.
Week 7 - Monday CS361.
Week 2 - Friday CS361.
Week 11 - Wednesday CS361.
Deferred Lighting.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Chapters VIII Image Texturing
Introduction to Computer Graphics with WebGL
UMBC Graphics for Games
Computer Graphics Module Overview
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
Frame Buffers Fall 2018 CS480/680.
OpenGL-Rendering Pipeline
Presentation transcript:

POST-PROCESSING SET09115 Intro Graphics Programming

Breakdown Background Review – shading and texturing What is post-processing? Working with Post-Processing Greyscale shader Working with OpenGL Example Post-Processes Gaussian blur, motion blur, depth of field

Recommended Reading Course Text Chapter 8, section 8.11 onwards Real Time Rendering Chapter 10 All interesting 10.9 onwards relevant

Background

Review – What are Shaders? Shaders are small programs that run on the GPU Shaders allow us to implement effects that we may wish for in our rendered scene Lighting, texturing being the most basic Three types of shader Vertex Geometry Fragment (or pixel)

Review – Shading Pipeline Vertex data goes in at the start Final rendered image comes out at the end It is possible to get data from the pipeline without displaying anything Stream output (geometry stage) Render to texture (rasterization stage)

Review – What is Texturing? Texturing is the process of attaching images to geometric objects Texturing can be used to provide more realistic detail than colour and lighting alone

Review – How Texturing Works Texturing requires two pieces of information The texture to be used The texture coordinates for each vertex of the model The texture coordinates are used to determine parts of the image to attach to individual pieces of geometry Sort of a mixture between wrapping paper and cutting out and gluing

What do we mean by Post-Processing? Post-processing is any rendering technique we apply after the main object render Pixel shader Post-processing covers a wide range of techniques Depth of field, toon shading, motion blur, etc.

How does Post-Processing Work? Post-processing typically utilises two techniques we have covered Shaders Textures Instead of rendering to the screen, we render to a texture We take this texture, render it to the whole screen, and use a post-process shader on it to manipulate it Render to texture Render texture to screen We can also render the texture to texture again Multi pass post-processing

OpenGL Frame Buffer Objects OpenGL uses a technique called frame buffer objects to get textures from the GPU Three stage process Create an empty texture Create a frame buffer object Attach texture to frame buffer object We can then use the frame buffer object at any time Bind it to enable render to the texture Unbind to enable render to the screen

Example Post Process Call of Duty: Modern Warfare 2 Motion Blur [Link]Link

Questions?

Working with Post-Processing

Simple Example

GLSL Pixel Shader uniform sampler2D texture; in vec2 texCoord; out vec4 colour; void main( void ) { vec4 temp = texture2D(texture, texCoord); float I = * temp.r * temp.g * temp.b; colour = vec4(I, I, I, 1.0); }

Setting up OpenGL // Create a texture data = new GLubyte[800 * 600 * 3]; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_TEXTURE_2D, 0, 3, 800, 600, 0, GL_RGB, GL_UNSIGNED_BYTE, data); // Create a framebuffer glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); // Attach texture glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

Performing the Render First bind the framebuffer glBindFramebuffer(GL_FRAMEBUFFER, fbo); Perform your render Unbind the framebuffer glBindFramebuffer(GL_FRAMEBUFFER, 0); Bind the texture rendered to glBindTexture(GL_TEXTURE_2D, texture) Perform screen render

Output

Depth Buffer Objects It is also possible to get the depth buffer from the render Image data is greyscale based on distance from viewer Darker pixels closer Lighter pixels nearer Why would we want this?

Screen Space Ambient Occlusion Using a depth buffer lets us perform fast ambient occlusion Sample surrounding pixel depths Use this to determine if pixel is being occluded by any of the pixels First used in Crysis (2007)

Questions?

Example Post-Processes

Gaussian Blur Gaussian blur is a common technique used in graphics Sometimes called Gaussian smoothing The goal is to reduce noise in the image See top But this will also remove detail See bottom

How Gaussian Blur Works Gaussian blur operates using a pixel sampling technique Each pixel is effected by a number of surrounding pixels Instead of sampling each surrounding pixel 25 pixel reads The blur is done in two stages 10 pixel reads total

Edge Detection Edge detection allows us to detect the edges of an object Essentially the change in colour between pixels Edge detection is also done using a filter and pixel sampling approach

Motion Blur Motion blur is a technique that works by taking a number of existing frames Texture renders And then blending them together based on the pixel colour change No change In focus Change Blurred

Depth of Field Depth of field is a technique that enables objects out of focus to look blurred Two techniques Multiple camera positions Depth buffer

HDR High Dynamic Range HDR is a technique to allow a wider range in contrast between colours Dark colours dont turn so much to black with no detail Light colours dont turn so much to white with no detail

Bloom Bloom is the effect where light has a glow which effects the other objects around it Typically an extension of HDR, where light is blended into the other objects

Film Grain A noise addition technique where we make the image look like it was recorded using old film Can be useful when you want to use some pre-rendered cut- scenes

Questions?

To do this week… Practical this week still in Games Lab Shaders You should investigate some post-processing techniques, and maybe try and implement them if you have time We have only really scratched the surface Hopefully, you have all started work on the coursework Ill come round and have a look on Thursday

Summary Post-processing is any rendering technique that we apply after the main render We typically use two techniques Texturing Shading We can implement post-processing by rendering the main scene to a texture, then manipulating the texture Numerous techniques exist Blurring, depth of field, toon shading, etc.